home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicComboBoxUI$PropertyChangeHandler.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  3.6 KB  |  127 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Color;
  4. import java.beans.PropertyChangeEvent;
  5. import java.beans.PropertyChangeListener;
  6. import javax.swing.ComboBoxModel;
  7.  
  8. public class BasicComboBoxUI$PropertyChangeHandler implements PropertyChangeListener {
  9.    // $FF: synthetic field
  10.    private final BasicComboBoxUI this$0;
  11.  
  12.    public BasicComboBoxUI$PropertyChangeHandler(BasicComboBoxUI var1) {
  13.       this.this$0 = var1;
  14.    }
  15.  
  16.    public void propertyChange(PropertyChangeEvent var1) {
  17.       String var2 = var1.getPropertyName();
  18.       if (var2.equals("model")) {
  19.          ComboBoxModel var3 = (ComboBoxModel)var1.getNewValue();
  20.          ComboBoxModel var4 = (ComboBoxModel)var1.getOldValue();
  21.          if (var4 != null && this.this$0.listDataListener != null) {
  22.             var4.removeListDataListener(this.this$0.listDataListener);
  23.          }
  24.  
  25.          if (var3 != null && this.this$0.listDataListener != null) {
  26.             var3.addListDataListener(this.this$0.listDataListener);
  27.          }
  28.  
  29.          if (this.this$0.editor != null) {
  30.             this.this$0.comboBox.configureEditor(this.this$0.comboBox.getEditor(), this.this$0.comboBox.getSelectedItem());
  31.          }
  32.  
  33.          this.this$0.isMinimumSizeDirty = true;
  34.          this.this$0.comboBox.revalidate();
  35.          this.this$0.comboBox.repaint();
  36.       } else if (var2.equals("editor") && this.this$0.comboBox.isEditable()) {
  37.          this.this$0.removeEditor();
  38.          this.this$0.addEditor();
  39.          if (this.this$0.editor != null) {
  40.             this.this$0.editor.setEnabled(this.this$0.comboBox.isEnabled());
  41.          }
  42.       } else if (var2.equals("editable")) {
  43.          if (this.this$0.comboBox.isEditable()) {
  44.             this.this$0.comboBox.setRequestFocusEnabled(false);
  45.             if (this.this$0.popupKeyListener != null) {
  46.                this.this$0.comboBox.removeKeyListener(this.this$0.popupKeyListener);
  47.             }
  48.  
  49.             this.this$0.addEditor();
  50.             if (this.this$0.editor != null) {
  51.                this.this$0.configureEditor();
  52.             }
  53.  
  54.             this.this$0.editorFocusListener = new BasicComboBoxUI.EditorFocusListener(this.this$0);
  55.             this.this$0.editor.addFocusListener(this.this$0.editorFocusListener);
  56.          } else {
  57.             this.this$0.comboBox.setRequestFocusEnabled(true);
  58.             if (this.this$0.popupKeyListener != null) {
  59.                this.this$0.comboBox.addKeyListener(this.this$0.popupKeyListener);
  60.             }
  61.  
  62.             this.this$0.removeEditor();
  63.             this.this$0.editor.removeFocusListener(this.this$0.editorFocusListener);
  64.             this.this$0.editorFocusListener = null;
  65.          }
  66.  
  67.          this.this$0.updateToolTipTextForChildren();
  68.          this.this$0.comboBox.revalidate();
  69.          this.this$0.comboBox.validate();
  70.          this.this$0.comboBox.revalidate();
  71.          this.this$0.comboBox.repaint();
  72.       } else if (var2.equals("enabled")) {
  73.          boolean var5 = this.this$0.comboBox.isEnabled();
  74.          if (var5) {
  75.             if (this.this$0.editor != null) {
  76.                this.this$0.editor.setEnabled(true);
  77.             }
  78.  
  79.             if (this.this$0.arrowButton != null) {
  80.                this.this$0.arrowButton.setEnabled(true);
  81.             }
  82.          } else {
  83.             if (this.this$0.editor != null) {
  84.                this.this$0.editor.setEnabled(false);
  85.             }
  86.  
  87.             if (this.this$0.arrowButton != null) {
  88.                this.this$0.arrowButton.setEnabled(false);
  89.             }
  90.          }
  91.  
  92.          this.this$0.comboBox.repaint();
  93.       } else if (var2.equals("maximumRowCount")) {
  94.          if (this.this$0.isPopupVisible(this.this$0.comboBox)) {
  95.             this.this$0.setPopupVisible(this.this$0.comboBox, false);
  96.             this.this$0.setPopupVisible(this.this$0.comboBox, true);
  97.          }
  98.       } else if (var2.equals("font")) {
  99.          this.this$0.listBox.setFont(this.this$0.comboBox.getFont());
  100.          if (this.this$0.editor != null) {
  101.             this.this$0.editor.setFont(this.this$0.comboBox.getFont());
  102.          }
  103.  
  104.          this.this$0.isMinimumSizeDirty = true;
  105.          this.this$0.comboBox.validate();
  106.       } else if (var2.equals("ToolTipText")) {
  107.          this.this$0.updateToolTipTextForChildren();
  108.       } else if (var2.equals("JComboBox.lightweightKeyboardNavigation")) {
  109.          Object var6 = var1.getNewValue();
  110.          if (var6.equals("Lightweight")) {
  111.             BasicComboBoxUI.access$002(this.this$0, true);
  112.          } else if (var6.equals("Heavyweight")) {
  113.             BasicComboBoxUI.access$002(this.this$0, false);
  114.          }
  115.       } else if (var2.equals("background")) {
  116.          Color var7 = (Color)var1.getNewValue();
  117.          this.this$0.arrowButton.setBackground(var7);
  118.          this.this$0.listBox.setBackground(var7);
  119.       } else if (var2.equals("foreground")) {
  120.          Color var8 = (Color)var1.getNewValue();
  121.          this.this$0.arrowButton.setForeground(var8);
  122.          this.this$0.listBox.setForeground(var8);
  123.       }
  124.  
  125.    }
  126. }
  127.