home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 3.0 KB | 130 lines |
- // ControlPanel.java
- // 19.03.96
- //
- // the bar at the bottom
-
- package cybcerone.control;
-
- import java.awt.Rectangle;
- import java.awt.Event;
- import java.awt.Graphics;
- import java.util.Vector;
-
- import cybcerone.utils.Appletlike;
- import cybcerone.utils.IdPanel;
- import cybcerone.utils.Mapable;
-
- import cybcerone.main.MainPanel;
- import cybcerone.init.InitPanel;
-
- /**
- * The bar at the bottom of the screen that controls movement and a
- * few other features.
- */
- public class ControlPanel extends IdPanel {
- private static final Rectangle placement = new Rectangle (0, 668, 1024, 100);
-
- private static final String id = "ControlPanel";
- private static final String statusText = "";
-
- public static final String imagePath = "control/";
- private static final String bgFile = imagePath + "barre_grise_ok.gif";
-
- private boolean buttonPressed;
-
- private UnilButton unil;
- private ForwardButton forward;
- private BackButton back;
- private UrgencesButton urgences;
-
- private Rectangle help = scale (741, 5, 87, 95);
- private Rectangle language = scale (897, 5, 87, 95);
-
- private Object current;
-
- public ControlPanel (Appletlike app) {
- super (id, statusText, app);
- reshape (placement);
-
- setBackground (bgFile, 0);
-
- add (new Clock (app));
- add (unil = new UnilButton (app));
- add (forward = new ForwardButton (this, app));
- add (back = new BackButton (this, app));
- add (urgences = new UrgencesButton (back, app));
-
- unil.setNext (MainPanel.id);
- urgences.setNext (UrgencesPanel.id);
- buttonPressed = false;
- }
-
- /**
- * This panel has been activated, take appropriate action.
- */
- public void update (String newPanelId) {
- if (!newPanelId.equals (InitPanel.id)) {
- unil.update (newPanelId);
- urgences.update (newPanelId);
- if (newPanelId.equals (MainPanel.id)) {
- back.clear ();
- current = null;
- }
- if (!buttonPressed) {
- if (current != null)
- back.update (current);
- forward.clear ();
- }
- buttonPressed = false;
- current = newPanelId;
- }
- }
-
- /**
- * This Mapable object has been selected.
- */
- public void update (Mapable newMap) {
- unil.enable ();
- urgences.enable ();
- if (!buttonPressed) {
- if (current != null)
- back.update (current);
- forward.clear ();
- }
- buttonPressed = false;
- current = newMap;
- }
-
- /**
- * Go forward 1 screen (must have gone back first).
- */
- void goForward (Object panelId) {
- buttonPressed = true;
- back.update (current);
- app.update (panelId);
- }
-
- /**
- * Go back 1 screen.
- */
- void goBack (Object panelId) {
- buttonPressed = true;
- forward.update (current);
- app.update (panelId);
- }
-
- /**
- * Keep the user informed of coming features.
- */
- public boolean mouseMove (Event evt, int x, int y) {
- if (help.inside (x, y))
- app.showStatus ("Help system pending");
- else if (language.inside (x, y))
- app.showStatus ("Multiple language support pending");
- else if (locate (x, y) == null)
- app.showStatus (statusText);
- return true;
- }
-
- }
-