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.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  15.2 KB  |  651 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Dimension;
  6. import java.awt.Graphics;
  7. import java.awt.Insets;
  8. import java.awt.LayoutManager;
  9. import java.awt.Rectangle;
  10. import java.awt.event.FocusListener;
  11. import java.awt.event.ItemListener;
  12. import java.awt.event.KeyListener;
  13. import java.awt.event.MouseListener;
  14. import java.awt.event.MouseMotionListener;
  15. import java.beans.PropertyChangeListener;
  16. import javax.accessibility.Accessible;
  17. import javax.accessibility.AccessibleContext;
  18. import javax.swing.ActionMap;
  19. import javax.swing.CellRendererPane;
  20. import javax.swing.ComboBoxEditor;
  21. import javax.swing.ComboBoxModel;
  22. import javax.swing.DefaultListCellRenderer;
  23. import javax.swing.InputMap;
  24. import javax.swing.JButton;
  25. import javax.swing.JComboBox;
  26. import javax.swing.JComponent;
  27. import javax.swing.JList;
  28. import javax.swing.JPopupMenu;
  29. import javax.swing.KeyStroke;
  30. import javax.swing.ListCellRenderer;
  31. import javax.swing.LookAndFeel;
  32. import javax.swing.SwingUtilities;
  33. import javax.swing.UIManager;
  34. import javax.swing.event.ListDataListener;
  35. import javax.swing.plaf.ActionMapUIResource;
  36. import javax.swing.plaf.ComboBoxUI;
  37. import javax.swing.plaf.ComponentUI;
  38. import javax.swing.plaf.UIResource;
  39.  
  40. public class BasicComboBoxUI extends ComboBoxUI {
  41.    protected JComboBox comboBox;
  42.    protected boolean hasFocus = false;
  43.    private boolean lightNav = false;
  44.    private static final String LIGHTWEIGHT_KEYBOARD_NAVIGATION = "JComboBox.lightweightKeyboardNavigation";
  45.    private static final String LIGHTWEIGHT_KEYBOARD_NAVIGATION_ON = "Lightweight";
  46.    private static final String LIGHTWEIGHT_KEYBOARD_NAVIGATION_OFF = "Heavyweight";
  47.    protected JList listBox;
  48.    protected CellRendererPane currentValuePane = new CellRendererPane();
  49.    protected ComboPopup popup;
  50.    protected Component editor;
  51.    protected JButton arrowButton;
  52.    protected KeyListener keyListener;
  53.    protected FocusListener focusListener;
  54.    FocusListener editorFocusListener;
  55.    protected ItemListener itemListener;
  56.    protected PropertyChangeListener propertyChangeListener;
  57.    protected MouseListener popupMouseListener;
  58.    protected MouseMotionListener popupMouseMotionListener;
  59.    protected KeyListener popupKeyListener;
  60.    protected ListDataListener listDataListener;
  61.    protected boolean isMinimumSizeDirty = true;
  62.    protected Dimension cachedMinimumSize = new Dimension(0, 0);
  63.    Dimension cachedDisplaySize = new Dimension(0, 0);
  64.    static DefaultListCellRenderer textRenderer = new DefaultListCellRenderer();
  65.  
  66.    public static ComponentUI createUI(JComponent var0) {
  67.       return new BasicComboBoxUI();
  68.    }
  69.  
  70.    public void installUI(JComponent var1) {
  71.       this.isMinimumSizeDirty = true;
  72.       this.comboBox = (JComboBox)var1;
  73.       this.installDefaults();
  74.       this.popup = this.createPopup();
  75.       this.listBox = this.popup.getList();
  76.       Object var2 = var1.getClientProperty("JComboBox.lightweightKeyboardNavigation");
  77.       if (var2 != null) {
  78.          if (var2.equals("Lightweight")) {
  79.             this.lightNav = true;
  80.          } else if (var2.equals("Heavyweight")) {
  81.             this.lightNav = false;
  82.          }
  83.       }
  84.  
  85.       if (this.comboBox.getRenderer() == null || this.comboBox.getRenderer() instanceof UIResource) {
  86.          this.comboBox.setRenderer(this.createRenderer());
  87.       }
  88.  
  89.       if (this.comboBox.getEditor() == null || this.comboBox.getEditor() instanceof UIResource) {
  90.          this.comboBox.setEditor(this.createEditor());
  91.       }
  92.  
  93.       this.installComponents();
  94.       this.installListeners();
  95.       if (this.arrowButton != null) {
  96.          this.configureArrowButton();
  97.       }
  98.  
  99.       if (this.editor != null) {
  100.          this.configureEditor();
  101.       }
  102.  
  103.       this.comboBox.setLayout(this.createLayoutManager());
  104.       this.comboBox.setRequestFocusEnabled(true);
  105.       1 var3 = new 1(this);
  106.       SwingUtilities.invokeLater(var3);
  107.    }
  108.  
  109.    public void uninstallUI(JComponent var1) {
  110.       this.setPopupVisible(this.comboBox, false);
  111.       this.popup.uninstallingUI();
  112.       this.uninstallKeyboardActions();
  113.       this.comboBox.setLayout((LayoutManager)null);
  114.       this.uninstallComponents();
  115.       this.uninstallListeners();
  116.       this.uninstallDefaults();
  117.       if (this.comboBox.getRenderer() == null || this.comboBox.getRenderer() instanceof UIResource) {
  118.          this.comboBox.setRenderer((ListCellRenderer)null);
  119.       }
  120.  
  121.       if (this.comboBox.getEditor() == null || this.comboBox.getEditor() instanceof UIResource) {
  122.          this.comboBox.setEditor((ComboBoxEditor)null);
  123.       }
  124.  
  125.       this.keyListener = null;
  126.       this.focusListener = null;
  127.       this.listDataListener = null;
  128.       this.popupKeyListener = null;
  129.       this.popupMouseListener = null;
  130.       this.popupMouseMotionListener = null;
  131.       this.propertyChangeListener = null;
  132.       this.editorFocusListener = null;
  133.       this.popup = null;
  134.       this.listBox = null;
  135.       this.comboBox = null;
  136.    }
  137.  
  138.    protected void installDefaults() {
  139.       LookAndFeel.installColorsAndFont(this.comboBox, "ComboBox.background", "ComboBox.foreground", "ComboBox.font");
  140.       LookAndFeel.installBorder(this.comboBox, "ComboBox.border");
  141.    }
  142.  
  143.    protected void installListeners() {
  144.       if ((this.itemListener = this.createItemListener()) != null) {
  145.          this.comboBox.addItemListener(this.itemListener);
  146.       }
  147.  
  148.       if ((this.propertyChangeListener = this.createPropertyChangeListener()) != null) {
  149.          this.comboBox.addPropertyChangeListener(this.propertyChangeListener);
  150.       }
  151.  
  152.       if ((this.keyListener = this.createKeyListener()) != null) {
  153.          this.comboBox.addKeyListener(this.keyListener);
  154.       }
  155.  
  156.       if ((this.focusListener = this.createFocusListener()) != null) {
  157.          this.comboBox.addFocusListener(this.focusListener);
  158.       }
  159.  
  160.       if ((this.popupMouseListener = this.popup.getMouseListener()) != null) {
  161.          this.comboBox.addMouseListener(this.popupMouseListener);
  162.       }
  163.  
  164.       if ((this.popupMouseMotionListener = this.popup.getMouseMotionListener()) != null) {
  165.          this.comboBox.addMouseMotionListener(this.popupMouseMotionListener);
  166.       }
  167.  
  168.       if ((this.popupKeyListener = this.popup.getKeyListener()) != null) {
  169.          this.comboBox.addKeyListener(this.popupKeyListener);
  170.       }
  171.  
  172.       if (this.comboBox.getModel() != null && (this.listDataListener = this.createListDataListener()) != null) {
  173.          this.comboBox.getModel().addListDataListener(this.listDataListener);
  174.       }
  175.  
  176.       if (this.comboBox.isEditable()) {
  177.          this.editorFocusListener = new EditorFocusListener(this);
  178.          this.editor.addFocusListener(this.editorFocusListener);
  179.       }
  180.  
  181.    }
  182.  
  183.    protected void uninstallDefaults() {
  184.       LookAndFeel.installColorsAndFont(this.comboBox, "ComboBox.background", "ComboBox.foreground", "ComboBox.font");
  185.       LookAndFeel.uninstallBorder(this.comboBox);
  186.    }
  187.  
  188.    protected void uninstallListeners() {
  189.       if (this.keyListener != null) {
  190.          this.comboBox.removeKeyListener(this.keyListener);
  191.       }
  192.  
  193.       if (this.itemListener != null) {
  194.          this.comboBox.removeItemListener(this.itemListener);
  195.       }
  196.  
  197.       if (this.propertyChangeListener != null) {
  198.          this.comboBox.removePropertyChangeListener(this.propertyChangeListener);
  199.       }
  200.  
  201.       if (this.focusListener != null) {
  202.          this.comboBox.removeFocusListener(this.focusListener);
  203.       }
  204.  
  205.       if (this.popupMouseListener != null) {
  206.          this.comboBox.removeMouseListener(this.popupMouseListener);
  207.       }
  208.  
  209.       if (this.popupMouseMotionListener != null) {
  210.          this.comboBox.removeMouseMotionListener(this.popupMouseMotionListener);
  211.       }
  212.  
  213.       if (this.popupKeyListener != null) {
  214.          this.comboBox.removeKeyListener(this.popupKeyListener);
  215.       }
  216.  
  217.       if (this.comboBox.getModel() != null && this.listDataListener != null) {
  218.          this.comboBox.getModel().removeListDataListener(this.listDataListener);
  219.       }
  220.  
  221.       if (this.editorFocusListener != null) {
  222.          this.comboBox.removeFocusListener(this.editorFocusListener);
  223.       }
  224.  
  225.    }
  226.  
  227.    protected ComboPopup createPopup() {
  228.       BasicComboPopup var1 = new BasicComboPopup(this.comboBox);
  229.       ((JPopupMenu)var1).getAccessibleContext().setAccessibleParent(this.comboBox);
  230.       return var1;
  231.    }
  232.  
  233.    protected KeyListener createKeyListener() {
  234.       return new KeyHandler(this);
  235.    }
  236.  
  237.    protected FocusListener createFocusListener() {
  238.       return new FocusHandler(this);
  239.    }
  240.  
  241.    protected ListDataListener createListDataListener() {
  242.       return new ListDataHandler(this);
  243.    }
  244.  
  245.    protected ItemListener createItemListener() {
  246.       return new ItemHandler(this);
  247.    }
  248.  
  249.    protected PropertyChangeListener createPropertyChangeListener() {
  250.       return new PropertyChangeHandler(this);
  251.    }
  252.  
  253.    protected LayoutManager createLayoutManager() {
  254.       return new ComboBoxLayoutManager(this);
  255.    }
  256.  
  257.    protected ListCellRenderer createRenderer() {
  258.       return new BasicComboBoxRenderer.UIResource();
  259.    }
  260.  
  261.    protected ComboBoxEditor createEditor() {
  262.       return new BasicComboBoxEditor.UIResource();
  263.    }
  264.  
  265.    void updateToolTipTextForChildren() {
  266.       Component[] var1 = this.comboBox.getComponents();
  267.  
  268.       for(int var2 = 0; var2 < var1.length; ++var2) {
  269.          if (var1[var2] instanceof JComponent) {
  270.             ((JComponent)var1[var2]).setToolTipText(this.comboBox.getToolTipText());
  271.          }
  272.       }
  273.  
  274.    }
  275.  
  276.    protected void installComponents() {
  277.       this.arrowButton = this.createArrowButton();
  278.       this.comboBox.add(this.arrowButton);
  279.       if (this.comboBox.isEditable()) {
  280.          this.addEditor();
  281.       }
  282.  
  283.       this.comboBox.add(this.currentValuePane);
  284.    }
  285.  
  286.    protected void uninstallComponents() {
  287.       if (this.arrowButton != null) {
  288.          this.unconfigureArrowButton();
  289.       }
  290.  
  291.       if (this.editor != null) {
  292.          this.unconfigureEditor();
  293.       }
  294.  
  295.       this.comboBox.removeAll();
  296.       this.arrowButton = null;
  297.    }
  298.  
  299.    public void addEditor() {
  300.       this.removeEditor();
  301.       this.editor = this.comboBox.getEditor().getEditorComponent();
  302.       this.comboBox.add(this.editor);
  303.    }
  304.  
  305.    public void removeEditor() {
  306.       if (this.editor != null) {
  307.          this.unconfigureEditor();
  308.          this.comboBox.remove(this.editor);
  309.       }
  310.  
  311.    }
  312.  
  313.    protected void configureEditor() {
  314.       this.editor.setFont(this.comboBox.getFont());
  315.       if (this.popupKeyListener != null) {
  316.          this.editor.addKeyListener(this.popupKeyListener);
  317.       }
  318.  
  319.       if (this.editor instanceof Accessible) {
  320.          AccessibleContext var1 = ((Accessible)this.editor).getAccessibleContext();
  321.          if (var1 != null) {
  322.             var1.setAccessibleParent(this.comboBox);
  323.          }
  324.       }
  325.  
  326.       this.comboBox.configureEditor(this.comboBox.getEditor(), this.comboBox.getSelectedItem());
  327.    }
  328.  
  329.    protected void unconfigureEditor() {
  330.       if (this.popupKeyListener != null) {
  331.          this.editor.removeKeyListener(this.popupKeyListener);
  332.       }
  333.  
  334.    }
  335.  
  336.    public void configureArrowButton() {
  337.       if (this.arrowButton != null) {
  338.          this.arrowButton.setEnabled(this.comboBox.isEnabled());
  339.          this.arrowButton.setRequestFocusEnabled(false);
  340.          if (this.popupMouseListener != null) {
  341.             this.arrowButton.addMouseListener(this.popupMouseListener);
  342.          }
  343.  
  344.          if (this.popupMouseMotionListener != null) {
  345.             this.arrowButton.addMouseMotionListener(this.popupMouseMotionListener);
  346.          }
  347.  
  348.          this.arrowButton.resetKeyboardActions();
  349.       }
  350.  
  351.    }
  352.  
  353.    public void unconfigureArrowButton() {
  354.       if (this.arrowButton != null) {
  355.          if (this.popupMouseListener != null) {
  356.             this.arrowButton.removeMouseListener(this.popupMouseListener);
  357.          }
  358.  
  359.          if (this.popupMouseMotionListener != null) {
  360.             this.arrowButton.removeMouseMotionListener(this.popupMouseMotionListener);
  361.          }
  362.       }
  363.  
  364.    }
  365.  
  366.    protected JButton createArrowButton() {
  367.       return new BasicArrowButton(5);
  368.    }
  369.  
  370.    public boolean isPopupVisible(JComboBox var1) {
  371.       return this.popup.isVisible();
  372.    }
  373.  
  374.    public void setPopupVisible(JComboBox var1, boolean var2) {
  375.       if (var2) {
  376.          this.popup.show();
  377.       } else {
  378.          this.popup.hide();
  379.       }
  380.  
  381.    }
  382.  
  383.    public boolean isFocusTraversable(JComboBox var1) {
  384.       return !this.comboBox.isEditable();
  385.    }
  386.  
  387.    public void paint(Graphics var1, JComponent var2) {
  388.       this.hasFocus = this.comboBox.hasFocus();
  389.       if (!this.comboBox.isEditable()) {
  390.          Rectangle var3 = this.rectangleForCurrentValue();
  391.          this.paintCurrentValueBackground(var1, var3, this.hasFocus);
  392.          this.paintCurrentValue(var1, var3, this.hasFocus);
  393.       }
  394.  
  395.    }
  396.  
  397.    public Dimension getPreferredSize(JComponent var1) {
  398.       Dimension var2 = this.getMinimumSize(var1);
  399.       var2.width += 4;
  400.       return var2;
  401.    }
  402.  
  403.    public Dimension getMinimumSize(JComponent var1) {
  404.       if (!this.isMinimumSizeDirty) {
  405.          return new Dimension(this.cachedMinimumSize);
  406.       } else {
  407.          Insets var3 = this.getInsets();
  408.          Dimension var2 = this.getDisplaySize();
  409.          var2.height += var3.top + var3.bottom;
  410.          int var4 = var2.height - (var3.top + var3.bottom);
  411.          var2.width += var3.left + var3.right + var4;
  412.          this.cachedMinimumSize.setSize(var2.width, var2.height);
  413.          this.isMinimumSizeDirty = false;
  414.          return var2;
  415.       }
  416.    }
  417.  
  418.    public Dimension getMaximumSize(JComponent var1) {
  419.       Dimension var2 = this.getPreferredSize(var1);
  420.       var2.width = 32767;
  421.       return var2;
  422.    }
  423.  
  424.    public int getAccessibleChildrenCount(JComponent var1) {
  425.       return this.comboBox.isEditable() ? 2 : 1;
  426.    }
  427.  
  428.    public Accessible getAccessibleChild(JComponent var1, int var2) {
  429.       switch (var2) {
  430.          case 0:
  431.             if (this.popup instanceof Accessible) {
  432.                AccessibleContext var4 = ((Accessible)this.popup).getAccessibleContext();
  433.                var4.setAccessibleParent(this.comboBox);
  434.                return (Accessible)this.popup;
  435.             }
  436.             break;
  437.          case 1:
  438.             if (this.comboBox.isEditable() && this.editor instanceof Accessible) {
  439.                AccessibleContext var3 = ((Accessible)this.editor).getAccessibleContext();
  440.                var3.setAccessibleParent(this.comboBox);
  441.                return (Accessible)this.editor;
  442.             }
  443.       }
  444.  
  445.       return null;
  446.    }
  447.  
  448.    protected boolean isNavigationKey(int var1) {
  449.       return var1 == 38 || var1 == 40 || var1 == KeyStroke.getKeyStroke("KP_UP").getKeyCode() || var1 == KeyStroke.getKeyStroke("KP_DOWN").getKeyCode();
  450.    }
  451.  
  452.    protected void selectNextPossibleValue() {
  453.       int var1;
  454.       if (this.lightNav) {
  455.          var1 = this.listBox.getSelectedIndex();
  456.       } else {
  457.          var1 = this.comboBox.getSelectedIndex();
  458.       }
  459.  
  460.       if (var1 < this.comboBox.getModel().getSize() - 1) {
  461.          if (this.lightNav) {
  462.             this.listBox.setSelectedIndex(var1 + 1);
  463.             this.listBox.ensureIndexIsVisible(var1 + 1);
  464.          } else {
  465.             this.comboBox.setSelectedIndex(var1 + 1);
  466.          }
  467.  
  468.          this.comboBox.repaint();
  469.       }
  470.  
  471.    }
  472.  
  473.    protected void selectPreviousPossibleValue() {
  474.       int var1;
  475.       if (this.lightNav) {
  476.          var1 = this.listBox.getSelectedIndex();
  477.       } else {
  478.          var1 = this.comboBox.getSelectedIndex();
  479.       }
  480.  
  481.       if (var1 > 0) {
  482.          if (this.lightNav) {
  483.             this.listBox.setSelectedIndex(var1 - 1);
  484.             this.listBox.ensureIndexIsVisible(var1 - 1);
  485.          } else {
  486.             this.comboBox.setSelectedIndex(var1 - 1);
  487.          }
  488.  
  489.          this.comboBox.repaint();
  490.       }
  491.  
  492.    }
  493.  
  494.    protected void toggleOpenClose() {
  495.       this.setPopupVisible(this.comboBox, !this.isPopupVisible(this.comboBox));
  496.    }
  497.  
  498.    protected Rectangle rectangleForCurrentValue() {
  499.       int var1 = this.comboBox.getWidth();
  500.       int var2 = this.comboBox.getHeight();
  501.       Insets var3 = this.getInsets();
  502.       int var4 = var2 - (var3.top + var3.bottom);
  503.       if (this.arrowButton != null) {
  504.          var4 = this.arrowButton.getWidth();
  505.       }
  506.  
  507.       return BasicGraphicsUtils.isLeftToRight(this.comboBox) ? new Rectangle(var3.left, var3.top, var1 - (var3.left + var3.right + var4), var2 - (var3.top + var3.bottom)) : new Rectangle(var3.left + var4, var3.top, var1 - (var3.left + var3.right + var4), var2 - (var3.top + var3.bottom));
  508.    }
  509.  
  510.    protected Insets getInsets() {
  511.       return this.comboBox.getInsets();
  512.    }
  513.  
  514.    public void paintCurrentValue(Graphics var1, Rectangle var2, boolean var3) {
  515.       ListCellRenderer var4 = this.comboBox.getRenderer();
  516.       if (this.comboBox.getSelectedIndex() != -1) {
  517.          Component var5;
  518.          if (var3 && !this.isPopupVisible(this.comboBox)) {
  519.             var5 = var4.getListCellRendererComponent(this.listBox, this.comboBox.getSelectedItem(), -1, true, false);
  520.          } else {
  521.             var5 = var4.getListCellRendererComponent(this.listBox, this.comboBox.getSelectedItem(), -1, false, false);
  522.             var5.setBackground(UIManager.getColor("ComboBox.background"));
  523.          }
  524.  
  525.          var5.setFont(this.comboBox.getFont());
  526.          if (var3 && !this.isPopupVisible(this.comboBox)) {
  527.             var5.setForeground(this.listBox.getSelectionForeground());
  528.             var5.setBackground(this.listBox.getSelectionBackground());
  529.          } else if (this.comboBox.isEnabled()) {
  530.             var5.setForeground(this.comboBox.getForeground());
  531.             var5.setBackground(this.comboBox.getBackground());
  532.          } else {
  533.             var5.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
  534.             var5.setBackground(UIManager.getColor("ComboBox.disabledBackground"));
  535.          }
  536.  
  537.          this.currentValuePane.paintComponent(var1, var5, this.comboBox, var2.x, var2.y, var2.width, var2.height);
  538.       }
  539.    }
  540.  
  541.    public void paintCurrentValueBackground(Graphics var1, Rectangle var2, boolean var3) {
  542.       Color var4 = var1.getColor();
  543.       if (this.comboBox.isEnabled()) {
  544.          var1.setColor(UIManager.getColor("ComboBox.background"));
  545.       } else {
  546.          var1.setColor(UIManager.getColor("ComboBox.disabledBackground"));
  547.       }
  548.  
  549.       var1.fillRect(var2.x, var2.y, var2.width, var2.height);
  550.       var1.setColor(var4);
  551.    }
  552.  
  553.    void repaintCurrentValue() {
  554.       Rectangle var1 = this.rectangleForCurrentValue();
  555.       this.comboBox.repaint(var1.x, var1.y, var1.width, var1.height);
  556.    }
  557.  
  558.    protected Dimension getDefaultSize() {
  559.       ListCellRenderer var1 = this.comboBox.getRenderer();
  560.       Component var2 = textRenderer.getListCellRendererComponent(this.listBox, " ", -1, false, false);
  561.       this.currentValuePane.add(var2);
  562.       var2.setFont(this.comboBox.getFont());
  563.       int var3 = var2.getPreferredSize().height;
  564.       this.currentValuePane.remove(var2);
  565.       return new Dimension(100, var3);
  566.    }
  567.  
  568.    protected Dimension getDisplaySize() {
  569.       if (this.comboBox.isEditable() && this.comboBox.getModel().getSize() == 0) {
  570.          return new Dimension(100, this.editor.getPreferredSize().height);
  571.       } else {
  572.          Dimension var3 = new Dimension();
  573.          ListCellRenderer var4 = this.comboBox.getRenderer();
  574.          ComboBoxModel var5 = this.comboBox.getModel();
  575.          if (var4 != null && var5.getSize() > 0) {
  576.             int var1 = 0;
  577.  
  578.             for(int var2 = var5.getSize(); var1 < var2; ++var1) {
  579.                Component var6 = var4.getListCellRendererComponent(this.listBox, var5.getElementAt(var1), -1, false, false);
  580.                this.currentValuePane.add(var6);
  581.                var6.setFont(this.comboBox.getFont());
  582.                Dimension var7 = var6.getPreferredSize();
  583.                this.currentValuePane.remove(var6);
  584.                var3.width = Math.max(var3.width, var7.width);
  585.                var3.height = Math.max(var3.height, var7.height);
  586.             }
  587.  
  588.             if (this.comboBox.isEditable()) {
  589.                Dimension var8 = this.editor.getPreferredSize();
  590.                var3.width = Math.max(var3.width, var8.width);
  591.                var3.height = Math.max(var3.height, var8.height);
  592.             }
  593.  
  594.             this.cachedDisplaySize.setSize(var3.width, var3.height);
  595.             return var3;
  596.          } else {
  597.             return this.getDefaultSize();
  598.          }
  599.       }
  600.    }
  601.  
  602.    protected void installKeyboardActions() {
  603.       InputMap var1 = this.getInputMap(1);
  604.       SwingUtilities.replaceUIInputMap(this.comboBox, 1, var1);
  605.       ActionMap var2 = this.getActionMap();
  606.       if (var2 != null) {
  607.          SwingUtilities.replaceUIActionMap(this.comboBox, var2);
  608.       }
  609.  
  610.    }
  611.  
  612.    InputMap getInputMap(int var1) {
  613.       return var1 == 1 ? (InputMap)UIManager.get("ComboBox.ancestorInputMap") : null;
  614.    }
  615.  
  616.    ActionMap getActionMap() {
  617.       ActionMap var1 = (ActionMap)UIManager.get("ComboBox.actionMap");
  618.       if (var1 == null) {
  619.          var1 = this.createActionMap();
  620.          if (var1 != null) {
  621.             UIManager.put("ComboBox.actionMap", var1);
  622.          }
  623.       }
  624.  
  625.       return var1;
  626.    }
  627.  
  628.    ActionMap createActionMap() {
  629.       ActionMapUIResource var1 = new ActionMapUIResource();
  630.       ((ActionMap)var1).put("hidePopup", new HidePopupAction());
  631.       ((ActionMap)var1).put("pageDownPassThrough", new KeyToListDispatcher(34));
  632.       ((ActionMap)var1).put("pageUpPassThrough", new KeyToListDispatcher(33));
  633.       ((ActionMap)var1).put("homePassThrough", new KeyToListDispatcher(36));
  634.       ((ActionMap)var1).put("endPassThrough", new KeyToListDispatcher(35));
  635.       ((ActionMap)var1).put("selectNext", new DownAction());
  636.       ((ActionMap)var1).put("togglePopup", new AltAction());
  637.       ((ActionMap)var1).put("selectPrevious", new UpAction());
  638.       return var1;
  639.    }
  640.  
  641.    protected void uninstallKeyboardActions() {
  642.       SwingUtilities.replaceUIInputMap(this.comboBox, 1, (InputMap)null);
  643.       SwingUtilities.replaceUIActionMap(this.comboBox, (ActionMap)null);
  644.    }
  645.  
  646.    // $FF: synthetic method
  647.    static boolean access$002(BasicComboBoxUI var0, boolean var1) {
  648.       return var0.lightNav = var1;
  649.    }
  650. }
  651.