my dog learned polymorphism*
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 Murach's Java Servlets and JSP this week in the Servlets 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
repainting issue
Image is not been added to a label
about setIconImage()
still memory problem with image loading
enum, random card, setIcon problems