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

  1. // PersonInfoPanel.java
  2. // 17.03.96
  3. //
  4. // a map panel for a person
  5.  
  6. package cybcerone.utils;
  7.  
  8. import java.awt.Graphics;
  9.  
  10. import cybcerone.orient.OrientPanel;
  11.  
  12. /**
  13.  * When a Person gets mapped, this panel gives you more info
  14.  * about them.
  15.  */
  16. public class PersonInfoPanel extends MapInfoPanel {
  17.   private static final String id = "PersonInfoPanel";
  18.   private static final String statusText = "Selected person";
  19.  
  20.   private static ScrollingPanel theName;
  21.   private static ScrollingPanel theFonction;
  22.   private static ScrollingPanel theUnite;
  23.   private static ScrollingPanel theFaculte;
  24.   private static ScrollingPanel theAdresse;
  25.   private static ScrollingPanel theBatiment;
  26.   private static ScrollingPanel theBureau;
  27.   private static ScrollingPanel theTelephone;
  28.  
  29.   private static final int x1 = scale (58);
  30.   private static final int x2 = scale (585);
  31.  
  32.   private static final int y1 = 0;
  33.   private static final int y2 = scale (27);
  34.   private static final int y3 = scale (54);
  35.   private static final int y4 = scale (81);
  36.   private static final int y5 = scale (108);
  37.  
  38.  
  39.   private static final int x3 = scale (7);
  40.   private static final int x4 = scale (540);
  41.  
  42.   private static final int y6 = scale (22);
  43.   private static final int y7 = scale (49);
  44.   private static final int y8 = scale (76);
  45.   private static final int y9 = scale (103);
  46.   private static final int y10 = scale (130);
  47.  
  48.  
  49.   public PersonInfoPanel (Person thePerson, Appletlike app) {
  50.     super (id, statusText, app);
  51.     
  52.     theName = newPanel (x1, y1, false);
  53.     theFonction = newPanel (x1, y2, true);
  54.     theUnite = newPanel (x1, y3, true);
  55.     theFaculte = newPanel (x1, y4, true);
  56.     theAdresse = newPanel (x1, y5, true);
  57.  
  58.     theBatiment = newPanel (x2, y2, true);
  59.     theBureau = newPanel (x2, y3, true);
  60.     theTelephone = newPanel (x2, y4, true);
  61.  
  62.     setData (thePerson);
  63.   }
  64.   
  65.   private ScrollingPanel newPanel (int x, int y, boolean grayed) {
  66.     ScrollingPanel thePanel = new ScrollingPanel (id, statusText, app);
  67.     add (thePanel);
  68.     thePanel.reshape (x, y, scale (470), scale (25));
  69.     if (grayed) thePanel.setColor (gray);
  70.     return thePanel;
  71.   }
  72.  
  73.   public void setData (Person thePerson) {
  74.     theName.setText (thePerson.getPrenom () + " " + thePerson.getNom ());
  75.     theFonction.setText (thePerson.getFonction ());
  76.     theUnite.setText (thePerson.getUnite ());
  77.     theFaculte.setText (thePerson.getFaculte2 ());
  78.     theAdresse.setText (thePerson.getAdresse ());
  79.  
  80.     theBatiment.setText (thePerson.getBatiment1 ());
  81.     theBureau.setText (thePerson.getBatimentUnite ());
  82.     theTelephone.setText (thePerson.getTelephone ());
  83.   }
  84.   
  85.   public void paint (Graphics g) {
  86.     super.paint (g);
  87.     g.setColor (blue);
  88.     g.setFont (Fonts.bigFont);
  89.     g.drawString ("NOM", x3, y6);
  90.     g.drawString ("FNT", x3, y7);
  91.     g.drawString ("UNI", x3, y8);
  92.     g.drawString ("FAC", x3, y9);
  93.     g.drawString ("ADR", x3, y10);
  94.  
  95.     g.drawString ("BAT", x4, y7);
  96.     g.drawString ("BUR", x4, y8);
  97.     g.drawString ("TEL", x4, y9);
  98.   }
  99.  
  100. }
  101.