diff options
Diffstat (limited to 'java/gjt/RadioImageButtonPanelController.java')
-rw-r--r-- | java/gjt/RadioImageButtonPanelController.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/java/gjt/RadioImageButtonPanelController.java b/java/gjt/RadioImageButtonPanelController.java new file mode 100644 index 00000000000..8dc34d25bff --- /dev/null +++ b/java/gjt/RadioImageButtonPanelController.java @@ -0,0 +1,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; + } +} |