import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public class setImageOnLabel {
public void setImageOnLabel (String path, JLabel label){
ImageIcon imageWL = new ImageIcon(path);
Image scaledImageWL = imageWL.getImage().getScaledInstance(label.getWidth(),label.getHeight(),label.getHeight());
ImageIcon scaledIconWL = new ImageIcon(scaledImageWL);
label.setIcon(scaledIconWL);
}
}
No hay comentarios:
Publicar un comentario
Gracias por su comentario.