How many methods is an ideal amount for an interface to have? And how can you tell how many methods an interface have from an implementation? Would the Mouselistener interface have 5 methods then?:
// ToggleButton Listener Class:
class ToggleButton implements MouseListener {
public void mousePressed(MouseEvent e) { }
public void mouseReleased(MouseEvent e) { }
public void mouseEntered(MouseEvent e) { }
public void mouseExited(MouseEvent e) { }
public void mouseClicked(MouseEvent e) {
// e.getButton() returns 0, 1, 2, or 3, where 1 is the
// left mouse button and 3 is the right mouse button:
mousebutton = e.getButton();
// Identify which JButton was clicked on by getting the
// source of the event e; Book, p. 484 (Event and Event
// Source);
// e.getSource() returns an object of the Object
// superclass, and that object has to be cast to a
// JButton with (JButton):
JButton B = (JButton)e.getSource();
nextSymbol( B );
}
} // end ToggleButton class