home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / unuy2wen / cybcerone / utils / uniteinfopanel.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  1.9 KB  |  69 lines

  1. // UniteInfoPanel.java
  2. // 18.03.96
  3. //
  4. // a map panel for a room
  5.  
  6. package cybcerone.utils;
  7.  
  8. import java.awt.Graphics;
  9.  
  10. /**
  11.  * Information about the room you selected.
  12.  */
  13. public class UniteInfoPanel extends MapInfoPanel {
  14.   private static final String id = "UniteInfoPanel";
  15.   private static final String statusText = "Selected room";
  16.  
  17.   private ScrollingPanel theNumber;
  18.   private ScrollingPanel theLevel;
  19.   private ScrollingPanel theZone;
  20.   private ScrollingPanel theBuilding;
  21.  
  22.   private static final int x = scale (110);
  23.   private static final int y1 = scale (5);
  24.   private static final int y2 = scale (35);
  25.   private static final int y3 = scale (65);
  26.   private static final int y4 = scale (95);
  27.  
  28.   private static final int x2 = scale (10);
  29.   private static final int y5 = scale (27);
  30.   private static final int y6 = scale (57);
  31.   private static final int y7 = scale (87);
  32.   private static final int y8 = scale (117);
  33.  
  34.   public UniteInfoPanel (Appletlike app) {
  35.     super (id, statusText, app);
  36.  
  37.     theBuilding = newPanel (x, y1, false);
  38.     theNumber = newPanel (x, y2, false);
  39.     theLevel = newPanel (x, y3, true);
  40.     theZone = newPanel (x, y4, true);
  41.   }
  42.  
  43.   private ScrollingPanel newPanel (int x, int y, boolean grayed) {
  44.     ScrollingPanel thePanel = new ScrollingPanel (id, statusText, app);
  45.     add (thePanel);
  46.     thePanel.reshape (x, y, size().width - x, scale (25));
  47.     if (grayed) thePanel.setColor (gray);
  48.     return thePanel;
  49.   }
  50.  
  51.   public void setData (Unite theUnite) {
  52.     theBuilding.setText (theUnite.getBuildingName ());
  53.     theNumber.setText (theUnite.getName ());
  54.     theLevel.setText (theUnite.getLevelName ());
  55.     theZone.setText (theUnite.getZoneName ());
  56.   }
  57.  
  58.   public void paint (Graphics g) {
  59.     super.paint (g);
  60.     g.setColor (blue);
  61.     g.setFont (Fonts.bigFont);
  62.     g.drawString ("Batiment", x2, y5);
  63.     g.drawString ("NumΘro", x2, y6);
  64.     g.drawString ("Etage", x2, y7);
  65.     g.drawString ("Zone", x2, y8);
  66.   }
  67.  
  68. }
  69.