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

  1. // FaculteInfoPanel.java
  2. // 17.03.96
  3. //
  4. // a map panel for a faculte
  5.  
  6. package cybcerone.utils;
  7.  
  8. import java.awt.Image;
  9.  
  10. import cybcerone.orient.OrientPanel;
  11.  
  12. /**
  13.  * This is what a Faculte creates when it gets mapped.
  14.  */
  15. public class FaculteInfoPanel extends MapInfoPanel {
  16.   private static final String id = "FaculteInfoPanel";
  17.   private static final String statusText = "Selected faculty or service";
  18.  
  19.   private static final String imageFile = "pictoInfoFaculte.gif";
  20.  
  21.   private static ScrollingPanel theName;
  22.   private static ScrollingPanel thePlace;
  23.   private static ScrollingPanel theTelephone;
  24.   private static ScrollingPanel theFax;
  25.   private static ScrollingPanel theContact;
  26.  
  27.   private static final int x = scale (49);
  28.   private static final int y1 = scale (0);
  29.   private static final int y2 = scale (27);
  30.   private static final int y3 = scale (54);
  31.   private static final int y4 = scale (81);
  32.   private static final int y5 = scale (108);
  33.  
  34.  
  35.   public FaculteInfoPanel (Appletlike app) {
  36.     super (id, statusText, app);
  37.  
  38.     setBackground (OrientPanel.imagePath + imageFile, 3);
  39.  
  40.     theName = newPanel (x, y1);
  41.     thePlace = newPanel (x, y2);
  42.     theTelephone = newPanel (x, y3);
  43.     theFax = newPanel (x, y4);
  44.     theContact = newPanel (x, y5);
  45.  
  46.     thePlace.setColor (gray);
  47.     theTelephone.setColor (gray);
  48.     theFax.setColor (gray);
  49.     theContact.setColor (gray);
  50.   }
  51.   
  52.   private ScrollingPanel newPanel (int x, int y) {
  53.     ScrollingPanel thePanel = new ScrollingPanel (id, statusText, app);
  54.     add (thePanel);
  55.     thePanel.reshape (x, y, size().width - x, scale (25));
  56.     return thePanel;
  57.   }
  58.  
  59.   public void setData (Faculte theFac) {
  60.     theName.setText (theFac.getName ());
  61.     thePlace.setText (theFac.getBatiment ());
  62.     theTelephone.setText (theFac.getTelephone ());
  63.     theFax.setText (theFac.getFax ());
  64.     theContact.setText (theFac.getContact ());
  65.   }
  66. }
  67.