home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.5 KB | 77 lines |
- // UrgencesButton.java
- // 19.03.96
- //
- // the button to take you to the urgences screen
-
- package cybcerone.control;
-
- import java.awt.Rectangle;
- import java.awt.Event;
-
- import cybcerone.utils.Appletlike;
- import cybcerone.utils.IdPanel;
-
-
- /**
- * The button to go to the urgency screen.
- */
- class UrgencesButton extends ControlButton {
- private static final Rectangle placement =
- new Rectangle (202, 0, 80, 100);
-
- private static final String id = "UrgencesButton";
- private static final String statusText = "In case of emergency...";
-
- private static final String bgFile = imagePath + "sos_lache.gif";
- private static final String pressedBgFile = imagePath + "sos_presse.gif";
-
- protected boolean screenUp;
- BackButton back;
-
- UrgencesButton (BackButton back, Appletlike app) {
- super (id, statusText, app);
- reshape (placement);
- this.back = back;
-
- setBackground (bgFile, 0);
- setPressedBg (pressedBgFile, 0);
-
- screenUp = false;
- }
-
- void update (String newPanelId) {
- enable ();
- if (newPanelId.equals (next)) {
- screenUp = true;
- pressed = true;
- repaint ();
- } else {
- pressed = false;
- screenUp = false;
- repaint ();
- }
- }
-
- public boolean mouseUp (Event evt, int x, int y) {
- if (pressed) {
- if (screenUp) {
- pressed = false;
- repaint ();
- back.doAction ();
- } else {
- doAction ();
- screenUp = true;
- }
- }
- return true;
- }
-
- public boolean mouseExit (Event evt, int x, int y) {
- if (!screenUp)
- return super.mouseExit (evt, x, y);
- else
- return true;
- }
-
- }
-