Java GUI repaint problem

Discussion in 'Java' started by Dustin, Jan 28, 2006.

  1. Dustin

    Dustin Guest

    I made a java GUI app that shrinks and then uploads images via FTP to a
    server. It works great on using both of my computers which are both
    running JRE 1.5+, but when I run it on two other computers (that have
    JRE 1.4.x) the GUI won't refresh.

    Usually this problem is caused becuase the processing is taking place
    in the GUI thread or EDT, but I am not doing that. I have a different
    thread doing my processing, so I am not sure what is going on.

    I haven't pasted my code becase there is a lot of it, but here is what
    specifically causes the problem. I have a JList which stores a list of
    file names. The user can click a button and choose one or more files
    to add to this list. When they click OK or whatever, the new file
    names are added to the JList by doing
    list.setListData(imageArrayList.toArray());
    and then validating the main panel which all of the gui components
    reside.

    If the user chooses Cancel instead of OK when choosing more files, this
    problem does not happen. They have to choose files and click OK to
    cause the problem. Does anyone have any general ideas of what could be
    going wrong?
     
    Dustin, Jan 28, 2006
    #1
    1. Advertising

  2. Dustin

    Douwe Guest

    Swing does NOT support multi-threading so what you could try is putting
    the data in the JList inside the Swing-Thread using the method
    SwingUtilities.invokeLater(Runnable)

    Apparently the 1.5 JRE does handle this better as the JRE 1.4
    environment

    I hope this helps ...
     
    Douwe, Jan 28, 2006
    #2
    1. Advertising

  3. Dustin

    hiwa Guest

    hiwa, Jan 28, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian
    Replies:
    1
    Views:
    376
    Andrew Thompson
    Apr 22, 2004
  2. Scott Steiner
    Replies:
    3
    Views:
    28,333
    Thomas G. Marshall
    Apr 5, 2005
  3. Steve Sobol
    Replies:
    0
    Views:
    547
    Steve Sobol
    Jan 10, 2006
  4. MaciekL
    Replies:
    1
    Views:
    927
    supercalifragilisticexpialadiamaticonormalizeringe
    Aug 5, 2011
  5. MaciekL
    Replies:
    2
    Views:
    1,831
    Ian Shef
    Aug 5, 2011
Loading...

Share This Page