import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Base class for our buttons that have an arrow on them */ public abstract class ArrowButton extends Button { protected enum Direction {LEFTARROW, RIGHTARROW}; public ArrowButton (Square square, Square.ButtonAction action, Direction direction) { //*1 Common to all our arrow buttons super (square, action); //*2 Pass required args to chained constructor if (direction==Direction.LEFTARROW) { //*3 Strip this arg and use it here setIcon (new ImageIcon ("leftArrow.gif")); //*4 Encapsulates icon details } else if (direction==Direction.RIGHTARROW) { //*3 setIcon (new ImageIcon ("rightArrow.gif")); //*4 } } }