trying to add a mouseAdapter to a JButton for a right click to flag the cell. Problem is when I instantiate it onto the button, it won\'t let me. Maybe because it already
MouseAdapter is an abstract class and you cannot create instances of it. That is why you get the error.
button[r][c].addMouseListener (new MouseAdapter()); // this will not work
button[r][c].addMouseListener (new MouseAdapter(){}); // this will
^
button[r][c].addMouseListener (new MouseAdapter(){
public void mouseClicked(MouseEvent e){
// and this will actually do sth. ; )
}
});