home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.3 KB | 60 lines |
- // ForwardButton.java
- // 19.03.96
- //
- // the forward button on the control panel
-
- package cybcerone.control;
-
- import java.awt.Rectangle;
- import java.util.Stack;
-
- import cybcerone.utils.Appletlike;
- import cybcerone.utils.IdPanel;
-
- /**
- * The button to advance forward in the history list.
- */
- class ForwardButton extends ControlButton {
- private static final Rectangle placement =
- new Rectangle (589, 0, 80, 100);
-
- private static final String id = "ForwardButton";
- private static final String statusText = "Click to go Forward";
-
- private static final String bgFile = imagePath + "avance_lache.gif";
- private static final String pressedBgFile = imagePath + "avance_presse.gif";
- private static final String disabledBgFile =
- imagePath + "avance_disabled.gif";
-
- ControlPanel parent;
- Stack future;
-
- ForwardButton (ControlPanel parent, Appletlike app) {
- super (id, statusText, app);
- reshape (placement);
- this.parent = parent;
-
- setBackground (bgFile, 1);
- setPressedBg (pressedBgFile, 1);
- setDisabledBg (disabledBgFile, 0);
-
- clear ();
- }
-
- void clear () {
- future = new Stack ();
- disable ();
- }
-
- void update (Object newPanelId) {
- future.push (newPanelId);
- enable ();
- }
-
- protected void doAction () {
- parent.goForward (future.pop ());
- if (future.empty ())
- disable ();
- }
- }
-