I want to know the difference in using BufferedImage
and the graphics
method to draw the images to ImageIcon
.
Here is an example:
@Override
public void paint(Graphics g) {
g.drawImage(bfImage, 0, 0, this);
g.drawImage(bfImage2, 10, 350, this);
}
public void desenharImagem() {
try{
bfImage = ImageIO.read(getClass().getResource("Imagens/cenario.jpg"));
bfImage2 = ImageIO.read(getClass().getResource("Imagens/0.png"));
}catch(IOException e) {
e.printStackTrace();
}
}