summaryrefslogtreecommitdiff
path: root/java/gjt/StateButtonController.java
blob: d6fc83830a69c1e35160e017827163983f336c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package gjt;

import java.awt.Event;

/**
 * A controller for a StateButton, that cycles through a 
 * series of images which reside in the StateButton class.  
 * Each time a mouse up is detected in the StateButton, the 
 * buttons image is set to the next image in the array.
 * 
 * @version 1.0, Apr 1 1996
 * @author  David Geary
 * @see     StateButton
 * @see     SpringyImageButtonController
 * @see     gjt.test.StateButtonTest
 */
class StateButtonController extends SpringyImageButtonController {
    public StateButtonController(StateButton button) {
        super(button);
    }
    public boolean mouseUp(Event event, int x, int y) {
        StateButton button = (StateButton)getButton();
        button.setImage(button.nextImage());
        activateButton(event);
        return super.mouseUp(event, x, y);
    }
}