Java GUI repaint problem

D

Dustin

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?
 
D

Douwe

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 ...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top