I would like to resize an image to be displayed on my jLabel. Here's my code:
BufferedImage imagem;
Icon novaImg;
try {
String newPath = "file:///" + aleat(); // carrega imagem aleatória
imagem = ImageIO.read(new URL(newPath));
novaImg = new ImageIcon(imagem);
jLabelPrincipal.setIcon(novaImg);
} catch(IOException exception) {
System.err.println(exception);
}