martes, 15 de abril de 2014

Add & remove ImageIcon to JLabel

Java adding ImageIcon to JLabel

ImageIcon image;
image = new ImageIcon(C:/Users/Delfi/Desktop/data4.png);
jlabel1.setIcon(image);

How to use getClass().getResource() method

ImageIcon image;
image = new ImageIcon(getClass().getResource("/Imagenes/data4.png"));
jlabel1.setIcon(image);

Remove an icon on a JLabel

jlabel1.setIcon(null) 
in the event handler that handles the button click, if you're using Swing.

No hay comentarios:

Publicar un comentario


Entradas populares