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

  1. // KeypadButton.java
  2. // 28.02.96
  3. //
  4. // a button on a keypad, logical not graphical
  5.  
  6. package cybcerone.utils;
  7.  
  8. import java.awt.Rectangle;
  9. import java.awt.Image;
  10. import java.awt.Graphics;
  11. import java.awt.image.ImageObserver;
  12.  
  13. public class KeypadButton {
  14.   private Object value;
  15.   private Rectangle placement;
  16.  
  17.   public KeypadButton (Object value, Rectangle placement) {
  18.     this.value = value;
  19.     this.placement = placement;
  20.   }
  21.  
  22.   public KeypadButton (Object value, int x, int y, int width, int height) {
  23.     this (value, new Rectangle (x, y, width, height));
  24.   }
  25.  
  26.   public boolean inside (int x, int y) {
  27.     return placement.inside (x, y);
  28.   }
  29.  
  30.   public Object getValue () { return value; }
  31.   Rectangle getPlacement () { return placement; }
  32.   
  33.   public String toString () {
  34.     return ("Button[" + value + ", " + placement);
  35.   }
  36.  
  37. }
  38.