Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Slow performance of javax.swing.JOptionPane.showOptionDialog

Slow performance of javax.swing.JOptionPane.showOptionDialog

Scheduled Pinned Locked Moved Java
performancetutorialquestioncode-review
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pasan Eeriyagama
    wrote on last edited by
    #1

    Hi, I'm using javax.swing.JOptionPane.showOptionDialog for getting user input. But this is very slow. Please can someone let me know how to improve the functionality of this? or is there any alternative to speed up. It's so disappointing as this takes seconds to load a simple user input window. Below is the code I have used for this, JOptionPane.showOptionDialog( VolChangeMDIFrame.getDesktop(),VolUserInput,VolumeSelectTitle, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null,null,null); Thanx in advance.

    N 1 Reply Last reply
    0
    • P Pasan Eeriyagama

      Hi, I'm using javax.swing.JOptionPane.showOptionDialog for getting user input. But this is very slow. Please can someone let me know how to improve the functionality of this? or is there any alternative to speed up. It's so disappointing as this takes seconds to load a simple user input window. Below is the code I have used for this, JOptionPane.showOptionDialog( VolChangeMDIFrame.getDesktop(),VolUserInput,VolumeSelectTitle, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null,null,null); Thanx in advance.

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      The javax.swing.JOptionPane.showOptionDialog is not slow. I would be suspicious of one of the first three parameters. What is the parent object VolChangeMDIFrame.getDesktop()? Why not just use this?


      Panic, Chaos, Destruction. My work here is done.

      P 1 Reply Last reply
      0
      • N Nagy Vilmos

        The javax.swing.JOptionPane.showOptionDialog is not slow. I would be suspicious of one of the first three parameters. What is the parent object VolChangeMDIFrame.getDesktop()? Why not just use this?


        Panic, Chaos, Destruction. My work here is done.

        P Offline
        P Offline
        Pasan Eeriyagama
        wrote on last edited by
        #3

        Thx, the problem was incorrectly tracked by profiler. It's not a problem with javax.swing.JOptionPane.showOptionDialog ... :)

        W 1 Reply Last reply
        0
        • P Pasan Eeriyagama

          Thx, the problem was incorrectly tracked by profiler. It's not a problem with javax.swing.JOptionPane.showOptionDialog ... :)

          W Offline
          W Offline
          woo_37830
          wrote on last edited by
          #4

          I am having a very long delay with both the presentation of hte JOptionPane.showInputDialogue and when I click on the OK button, I get a 3-6 second delay. Here is the code: viewer.setStatus("Waiting on input"); String reason = JOptionPane.showInputDialog("Redaction Reason", "User"); if( reason != null && reason.length() > 0 ) { viewer.setStatus("Analyzing"); ..... do some analysis } Now, the status shows in the parent "viewer" and then a long wait ( sometimes ) until the option pane appears. Then a long wait while the components are painted, wait for the input field, wait for the OK button, and the Cancel button. Enter input, then click OK. VERY LONG WAIT ( 3-6 seconds ) before panel hides and next statement is executed. No indication of problem. CPU useage very low. Nothing else running to eat up cpu ( highest < 10% ) This seems to have appeared recently. Don't know if it was the upgrade in Java for Snow Leopard, or something I've done in the code, but I don't see why anything I've done that isn't eating up time would affect the time to appear or time to dissappear significantly. Running on Mac OS X Snow Leopard 10.6.3

          W 1 Reply Last reply
          0
          • W woo_37830

            I am having a very long delay with both the presentation of hte JOptionPane.showInputDialogue and when I click on the OK button, I get a 3-6 second delay. Here is the code: viewer.setStatus("Waiting on input"); String reason = JOptionPane.showInputDialog("Redaction Reason", "User"); if( reason != null && reason.length() > 0 ) { viewer.setStatus("Analyzing"); ..... do some analysis } Now, the status shows in the parent "viewer" and then a long wait ( sometimes ) until the option pane appears. Then a long wait while the components are painted, wait for the input field, wait for the OK button, and the Cancel button. Enter input, then click OK. VERY LONG WAIT ( 3-6 seconds ) before panel hides and next statement is executed. No indication of problem. CPU useage very low. Nothing else running to eat up cpu ( highest < 10% ) This seems to have appeared recently. Don't know if it was the upgrade in Java for Snow Leopard, or something I've done in the code, but I don't see why anything I've done that isn't eating up time would affect the time to appear or time to dissappear significantly. Running on Mac OS X Snow Leopard 10.6.3

            W Offline
            W Offline
            woo_37830
            wrote on last edited by
            #5

            In addition, all mouse events seem to be extremely slow with long delays in dragging, clicking, etc. It isn't the time for my code to process the event, it appears to be a delay before my code gets the event.

            W 1 Reply Last reply
            0
            • W woo_37830

              In addition, all mouse events seem to be extremely slow with long delays in dragging, clicking, etc. It isn't the time for my code to process the event, it appears to be a delay before my code gets the event.

              W Offline
              W Offline
              woo_37830
              wrote on last edited by
              #6

              Just measured 20 seconds to display the OK button after the frame of the option panel had appeared. CPU this time was at 60% after starting the show of the pane until the OK button appeared.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups