Example using an Adapter class
public class MyMouseAdapter extends MouseAdapter{
public void mouseEntered(MouseEvent e) {
back = this.getBackground();
this.setBackground(Color.blue);
repaint();
}
public void mouseExited(MouseEvent e) {
this.setBackground(back);
repaint();
}
Previous slide
Next slide
Back to first slide
View graphic version