I have a JPanel where I have array of buttons. It's a kind of memory game, and I wont to show some few frames of animation, for example Double Point.
Here is a part of code: This animation is that some text is slowly showing and disappearing (I used also Alpha channel in those images) , but I don't know why when id should slowly disapearing it didn't like if of this image stay there.
public void paintComponent(Graphics g)
{
//Image img = new ImageIcon("res\\double.png").getImage();
//g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), null);
t.start();
Image img2 = new ImageIcon("res\\double\\double_0000"+i+".png").getImage();
g.drawImage(img2, 0, 0, this.getWidth(), this.getHeight(), null);
}
@Override
public void actionPerformed(ActionEvent e) {
i++;
if(i>30)
t.restart();
repaint();
}
}
}