home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 3.3 KB | 126 lines |
- // SuperPanel.java
- // 27.02.96
- //
- // these are the big panels in which other, smaller panels are embedded
-
- package cybcerone.utils;
-
- import java.awt.Event;
- import java.awt.Image;
- import java.awt.Rectangle;
- import java.util.Vector;
-
- /**
- * This is an extension of IdPanel that is also sort of Appletlike. It
- * can read images and data, and be updated. Automatically takes up the
- * full upper portion of the screen (1024 x 668 before scaling).
- */
- public class SuperPanel extends IdPanel implements Appletlike {
- private static final Rectangle placement = new Rectangle (0, 0, 1024, 668);
-
- /** Make it so. */
- public SuperPanel (String id, String statusText, Appletlike app) {
- super (id, statusText, app);
- this.app = app;
- reshape (placement);
- }
-
- /**
- * Update the panel with this Object. This method just calls a few other,
- * more private methods. It should be overridden in the subclasses to
- * handle any special data types.
- */
- public void update (Object updateVal) {
- if (updateVal instanceof String)
- update ((String)updateVal);
- else if (updateVal instanceof Vector)
- update ((Vector)updateVal);
- else if (updateVal instanceof Mapable)
- update ((Mapable)updateVal);
- }
-
- /**
- * If you're updated with a String, that must be the id of the
- * panel to switch to. Don't forget to override this is that's not
- * the case.
- */
- protected void update (String nextId) {
- app.update (nextId);
- }
-
- /**
- * If you're updated with a Vector, well, we don't know what to do yet.
- * Just print a message for now and override in the subclasses.
- */
- protected void update (Vector data) {
- // System.err.println ("SuperPanel: update called with " + data);
- }
-
- /**
- * We've been updated with a mapable object, let the applet
- * handle this.
- */
- protected void update (Mapable selected) {
- app.update (selected);
- }
-
- /**
- * Put that String on the status line, baby.
- */
- public void showStatus (String newStatus) {
- app.showStatus (newStatus);
- }
-
- /**
- * Go get me this image.
- */
- public Image getImage (String imageFileName) {
- return app.getImage (imageFileName);
- }
-
- /**
- * Go get me this image. I have this priority.
- */
- public Image getImage (String imageFileName, int priority) {
- return app.getImage (imageFileName, priority);
- }
-
- /**
- * Load the file at this filename. The actual reading will be handled
- * by this Literate object. When it's done, notify this Appletlike object
- * through his update method.
- */
- public void getData (String filename, Literate reader,
- Appletlike requester) {
- app.getData (filename, reader, requester);
- }
-
- /**
- * Same as above, but returns of Vector of Strings since there is no reader.
- */
- public void getData (String filename, Appletlike requester) {
- app.getData (filename, requester);
- }
-
- /** Change what the cursor looks like. */
- public void setCursor (int cursorType) {
- app.setCursor (cursorType);
- }
-
- /**
- * Override this in subclasses so that they can put themselves back
- * into their initial state.
- */
- public void reset () {
- // System.err.println ("SuperPanel: reset called on " + getId ());
- }
-
- /**
- * Write this message on the initialization log.
- */
- public void initMessage (String message) {
- app.initMessage (message);
- }
- }
-
-