summaryrefslogtreecommitdiff
path: root/java/gjt/RadioImageButtonPanelController.java
blob: 8dc34d25bff4775edf20089edb5e0168f9b28066 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package gjt;

import java.awt.Event;

/**
 * A controller for an ImageButtonPanel that ensures that only 
 * one ImageButton in its associated ImageButtonPanel is 
 * selected at a time.<p>
 *
 * @version 1.0, Apr 1 1996
 * @author  David Geary
 * @see     ImageButtonPanelController
 * @see     ImageButton
 * @see     ImageButtonPanel
 * @see     gjt.test.ToolbarTest
 */
class RadioImageButtonPanelController 
                 extends ImageButtonPanelController {
    ImageButton down;

    public RadioImageButtonPanelController(
                ImageButtonPanel panel) {
        super(panel);
    }
    public boolean mouseDown(Event event, int x, int y) {
        ImageButton button;

        if(event.target instanceof ImageButton) {
            button = (ImageButton)event.target;
            if(down == button) return false;

            if(down != null)
                down.paintRaised();

            down = button;
        }
        return false;
    }
    public boolean mouseUp(Event event, int x, int y) {
        return false;
    }
    public boolean mouseDrag(Event event, int x, int y) {
        return false;
    }
}