home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.9 KB | 69 lines |
- // UniteInfoPanel.java
- // 18.03.96
- //
- // a map panel for a room
-
- package cybcerone.utils;
-
- import java.awt.Graphics;
-
- /**
- * Information about the room you selected.
- */
- public class UniteInfoPanel extends MapInfoPanel {
- private static final String id = "UniteInfoPanel";
- private static final String statusText = "Selected room";
-
- private ScrollingPanel theNumber;
- private ScrollingPanel theLevel;
- private ScrollingPanel theZone;
- private ScrollingPanel theBuilding;
-
- private static final int x = scale (110);
- private static final int y1 = scale (5);
- private static final int y2 = scale (35);
- private static final int y3 = scale (65);
- private static final int y4 = scale (95);
-
- private static final int x2 = scale (10);
- private static final int y5 = scale (27);
- private static final int y6 = scale (57);
- private static final int y7 = scale (87);
- private static final int y8 = scale (117);
-
- public UniteInfoPanel (Appletlike app) {
- super (id, statusText, app);
-
- theBuilding = newPanel (x, y1, false);
- theNumber = newPanel (x, y2, false);
- theLevel = newPanel (x, y3, true);
- theZone = newPanel (x, y4, true);
- }
-
- private ScrollingPanel newPanel (int x, int y, boolean grayed) {
- ScrollingPanel thePanel = new ScrollingPanel (id, statusText, app);
- add (thePanel);
- thePanel.reshape (x, y, size().width - x, scale (25));
- if (grayed) thePanel.setColor (gray);
- return thePanel;
- }
-
- public void setData (Unite theUnite) {
- theBuilding.setText (theUnite.getBuildingName ());
- theNumber.setText (theUnite.getName ());
- theLevel.setText (theUnite.getLevelName ());
- theZone.setText (theUnite.getZoneName ());
- }
-
- public void paint (Graphics g) {
- super.paint (g);
- g.setColor (blue);
- g.setFont (Fonts.bigFont);
- g.drawString ("Batiment", x2, y5);
- g.drawString ("NumΘro", x2, y6);
- g.drawString ("Etage", x2, y7);
- g.drawString ("Zone", x2, y8);
- }
-
- }
-