Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Update icon in a JLabel  RSS feed

 
Melu Llovio
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hola,

Creo un JLabel con un icono de la siguiente manera:

label.setIcon(new ImageIcon(ruta));

Al intentar actualizar de manera din�mica ese icono, mediante la misma sentencia (ya que la imagen se actualiza con la misma ruta), no se actualiza. Se queda el valor inicial del icono.

Como lo puedo arreglar ??? Muchas gracias!!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you problem could be anything - you would need to post a working sample program
that demonstrates the problem, so we can see exactly how you have it put together.

one possibility is duplicate declarations for label.
i.e. the one you see on the screen is not the one your 'dynamic' code is changing
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!