Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java GUI repaint problem

Reply
Thread Tools

Java GUI repaint problem

 
 
Dustin
Guest
Posts: n/a
 
      01-28-2006
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?

 
Reply With Quote
 
 
 
 
Douwe
Guest
Posts: n/a
 
      01-28-2006
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 ...

 
Reply With Quote
 
 
 
 
hiwa
Guest
Posts: n/a
 
      01-28-2006
Post a small demo code that is generally compilable, runnable and
could reproduce your problem. See:
http://homepage1.nifty.com/algafield/sscce.html

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: java.awt.Frame - How to repaint without background update MaciekL Java 2 08-05-2011 07:48 PM
java.awt.Frame - How to repaint without background update MaciekL Java 1 08-05-2011 11:36 AM
Runtime.exec() and a repaint problem with JEditorPane Steve Sobol Java 0 01-10-2006 03:54 AM
Simple repaint problem: JFrame is not repainting Scott Steiner Java 3 04-05-2005 01:09 AM
repaint type problem with scrollable Ian Java 1 04-22-2004 06:32 PM



Advertisments