• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to change the ImageIcon of a JLabel?

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic