I resized the picture into 100×100 size by using Graphics class and drawImage() method. But i can’t load the resized the image into JLabel. Is possible to load a resized picture into JLabel?
Image image = jfc.getSelectedFile();
ImageIcon Logo = new ImageIcon(image.getPath());
BufferedImage resizedImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(image, 0, 0, 100, 100, null); // Here i resized. But after that how can i load into Jlabel?
JLabel labelLogo;
labelLogo.setIcon(Logo);
...?
here is an example: you possibliy need to update the layout after modifying the component in
actionPerformed().