13lade619
is now a game developer :)
- Reaction score
- 400
i'm using transparent images (.png) to paint my JPanel.
problem is with the artifacts.. how do i clear the Graphics to that it will be empty agaiN?
problem is with the artifacts.. how do i clear the Graphics to that it will be empty agaiN?
Code:
protected void paintComponent(Graphics g)
{
g.drawImage(currentimage,0,0,this);
}
this.addMouseListener(new MouseAdapter()
{
public void mouseEntered(MouseEvent e) {
currentimage = roll;
repaint();
}
public void mouseExited(MouseEvent e) {
currentimage = base;
repaint();
}
public void mousePressed(MouseEvent e) {
//currentimage = roll;
//repaint();
}
public void mouseReleased(MouseEvent e) {
//currentimage = base;
//repaint();
}
});