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

  1. // UniteKeypad.java
  2. // 18.03.96
  3. //
  4. // the keypad on the unite screen
  5.  
  6. package cybcerone.unite;
  7.  
  8. import java.awt.Rectangle;
  9.  
  10. import cybcerone.utils.Appletlike;
  11. import cybcerone.utils.EntryKeypad;
  12.  
  13. /**
  14.  * The keypad for the Unite screen.
  15.  */
  16. class UniteKeypad extends EntryKeypad {
  17.   private static final String id = "UniteKeypad";
  18.   private static final String statusText = "Search for a room number";
  19.  
  20.   private static final String bgFile = 
  21.     UnitePanel.imagePath + "clavier_num.gif";
  22.   private static final String activeBgFile =
  23.     UnitePanel.imagePath + "clavier_num_rouge.gif";
  24.  
  25.   private static final Rectangle entryBox = 
  26.     new Rectangle (74 + 10, 219, 142 - 20, 29);
  27.  
  28.   UniteKeypad (Appletlike app) {
  29.     super (id, statusText, app);
  30.     
  31.     setBackground (bgFile, 8);
  32.     setActiveBackground (activeBgFile, 8);
  33.     setEntryBox (entryBox);
  34.  
  35.     makeButtons ();
  36.   }
  37.  
  38.   /**
  39.    * Map out the buttons used.
  40.    */
  41.   private void makeButtons () {
  42.     int x = 54;
  43.     int y = 265;
  44.     int xIncr = 61;
  45.     int yIncr = 51;
  46.     
  47.     int x1 = x;
  48.     int x2 = x1 + xIncr;
  49.     int x3 = x2 + xIncr;
  50.     
  51.     addButton (eraseChar, x1, y, xIncr * 3, yIncr);
  52.     addButton (backspaceChar, 0, 0, 0, 0);
  53.     
  54.     y += yIncr;
  55.     addButton (new Character ('7'), x1, y, xIncr, yIncr);
  56.     addButton (new Character ('8'), x2, y, xIncr, yIncr);
  57.     addButton (new Character ('9'), x3, y, xIncr, yIncr);
  58.     
  59.     y += yIncr;
  60.     addButton (new Character ('4'), x1, y, xIncr, yIncr);
  61.     addButton (new Character ('5'), x2, y, xIncr, yIncr);
  62.     addButton (new Character ('6'), x3, y, xIncr, yIncr);
  63.     
  64.     y += yIncr;
  65.     addButton (new Character ('1'), x1, y, xIncr, yIncr);
  66.     addButton (new Character ('2'), x2, y, xIncr, yIncr);
  67.     addButton (new Character ('3'), x3, y, xIncr, yIncr);
  68.     
  69.     y += yIncr;
  70.     addButton (new Character ('0'), x1, y, xIncr * 2, yIncr);
  71.     addButton (new Character ('.'), x3, y, xIncr, yIncr);
  72.   }
  73. }
  74.