home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / ComponentInputMap.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.1 KB  |  53 lines

  1. package javax.swing;
  2.  
  3. public class ComponentInputMap extends InputMap {
  4.    private JComponent component;
  5.  
  6.    public ComponentInputMap(JComponent var1) {
  7.       this.component = var1;
  8.       if (var1 == null) {
  9.          throw new IllegalArgumentException("ComponentInputMaps must be associated with a non-null JComponent");
  10.       }
  11.    }
  12.  
  13.    public void setParent(InputMap var1) {
  14.       if (((InputMap)this).getParent() != var1) {
  15.          if (var1 == null || var1 instanceof ComponentInputMap && ((ComponentInputMap)var1).getComponent() == this.getComponent()) {
  16.             super.setParent(var1);
  17.             this.getComponent().componentInputMapChanged(this);
  18.          } else {
  19.             throw new IllegalArgumentException("ComponentInputMaps must have a parent ComponentInputMap associated with the same component");
  20.          }
  21.       }
  22.    }
  23.  
  24.    public JComponent getComponent() {
  25.       return this.component;
  26.    }
  27.  
  28.    public void put(KeyStroke var1, Object var2) {
  29.       super.put(var1, var2);
  30.       if (this.getComponent() != null) {
  31.          this.getComponent().componentInputMapChanged(this);
  32.       }
  33.  
  34.    }
  35.  
  36.    public void remove(KeyStroke var1) {
  37.       super.remove(var1);
  38.       if (this.getComponent() != null) {
  39.          this.getComponent().componentInputMapChanged(this);
  40.       }
  41.  
  42.    }
  43.  
  44.    public void clear() {
  45.       int var1 = ((InputMap)this).size();
  46.       super.clear();
  47.       if (var1 > 0 && this.getComponent() != null) {
  48.          this.getComponent().componentInputMapChanged(this);
  49.       }
  50.  
  51.    }
  52. }
  53.