diff options
| author | pjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-07 18:12:58 +0000 |
|---|---|---|
| committer | pjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-07 18:12:58 +0000 |
| commit | 28fdfa0225c92310a6f0d60f0cf8c334380e0828 (patch) | |
| tree | ba4b0a7a26bf46ea298496a434496695db55bdc1 /java/gjt/SpringyImageButtonController.java | |
| parent | 9c4a1450aec6c149f6491194a48f34a57ed4c39b (diff) | |
| download | ATCD-28fdfa0225c92310a6f0d60f0cf8c334380e0828.tar.gz | |
Added gjt to CVS
Diffstat (limited to 'java/gjt/SpringyImageButtonController.java')
| -rw-r--r-- | java/gjt/SpringyImageButtonController.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/java/gjt/SpringyImageButtonController.java b/java/gjt/SpringyImageButtonController.java new file mode 100644 index 00000000000..3559e040459 --- /dev/null +++ b/java/gjt/SpringyImageButtonController.java @@ -0,0 +1,54 @@ +package gjt; + +import java.awt.Event; +import java.awt.Graphics; + +/** + * An ImageButtonController that reacts to mouseDown/mouseUp + * events exactly as a java.awt.Button does.<p> + * + * @version 1.0, Apr 1 1996 + * @author David Geary + * @see ImageButton + * @see ImageButtonController + * @see StickyImageButtonController + */ +public class SpringyImageButtonController + extends ImageButtonController { + public SpringyImageButtonController(ImageButton ib) { + super(ib); + } + public boolean mouseDown(Event event, int x, int y) { + if(event.modifiers == 0) { + getButton().paintInset(); + armButton(event); + } + return false; + } + public boolean mouseUp(Event event, int x, int y) { + if(event.modifiers == 0) { + if(getButton().isRaised() == false) { + getButton().paintRaised(); + activateButton(event); + } + } + return false; + } + public boolean mouseDrag(Event event, int x, int y) { + if(event.modifiers == 0) { + if(getButton().isInside(x,y)) { + if(getButton().isRaised()) { + getButton().paintInset(); + armButton(event); + } + } + else { + if(getButton().isRaised() == false) { + getButton().paintRaised(); + disarmButton(event); + } + } + } + return false; + } +} |
