aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to change the ImageIcon of a JLabel? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to change the ImageIcon of a JLabel?" Watch "how to change the ImageIcon of a JLabel?" New topic
Author

how to change the ImageIcon of a JLabel?

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Hi,
I have a JLabel with an icon that is shown fine. Only if i try to change the icon, i get no effect. Can you help, please?
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
hi,
try to change the icon inside SwingUtilities.invokeLater() (see the API for more information.)
All Code that changes the graphic inside a GUI has to be called from the Swing thread. To be sure of that always change the gui inside SwingUtilities.invokeLater().
Chantal
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to change the ImageIcon of a JLabel?
 
Similar Threads
still memory problem with image loading
repainting issue
about setIconImage()
enum, random card, setIcon problems
Image is not been added to a label