< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java

Print this page




 144         rendererPane = pane;
 145         listBox = list;
 146         setEnabled( comboBox.isEnabled() );
 147     }
 148 
 149     /**
 150      * Constructs a new instance of {@code MetalComboBoxButton}.
 151      *
 152      * @param cb an instance of {@code JComboBox}
 153      * @param i an icon
 154      * @param onlyIcon if {@code true} only icon is painted
 155      * @param pane an instance of {@code CellRendererPane}
 156      * @param list an instance of {@code JList}
 157      */
 158     public MetalComboBoxButton( JComboBox<Object> cb, Icon i, boolean onlyIcon,
 159                                 CellRendererPane pane, JList<Object> list ) {
 160         this( cb, i, pane, list );
 161         iconOnly = onlyIcon;
 162     }
 163 

 164     public boolean isFocusTraversable() {
 165         return false;
 166     }
 167 
 168     public void setEnabled(boolean enabled) {
 169         super.setEnabled(enabled);
 170 
 171         // Set the background and foreground to the combobox colors.
 172         if (enabled) {
 173             setBackground(comboBox.getBackground());
 174             setForeground(comboBox.getForeground());
 175         } else {
 176             setBackground(UIManager.getColor("ComboBox.disabledBackground"));
 177             setForeground(UIManager.getColor("ComboBox.disabledForeground"));
 178         }
 179     }
 180 
 181     public void paintComponent( Graphics g ) {
 182         boolean leftToRight = MetalUtils.isLeftToRight(comboBox);
 183 




 144         rendererPane = pane;
 145         listBox = list;
 146         setEnabled( comboBox.isEnabled() );
 147     }
 148 
 149     /**
 150      * Constructs a new instance of {@code MetalComboBoxButton}.
 151      *
 152      * @param cb an instance of {@code JComboBox}
 153      * @param i an icon
 154      * @param onlyIcon if {@code true} only icon is painted
 155      * @param pane an instance of {@code CellRendererPane}
 156      * @param list an instance of {@code JList}
 157      */
 158     public MetalComboBoxButton( JComboBox<Object> cb, Icon i, boolean onlyIcon,
 159                                 CellRendererPane pane, JList<Object> list ) {
 160         this( cb, i, pane, list );
 161         iconOnly = onlyIcon;
 162     }
 163 
 164     @SuppressWarnings("deprecation")
 165     public boolean isFocusTraversable() {
 166         return false;
 167     }
 168 
 169     public void setEnabled(boolean enabled) {
 170         super.setEnabled(enabled);
 171 
 172         // Set the background and foreground to the combobox colors.
 173         if (enabled) {
 174             setBackground(comboBox.getBackground());
 175             setForeground(comboBox.getForeground());
 176         } else {
 177             setBackground(UIManager.getColor("ComboBox.disabledBackground"));
 178             setForeground(UIManager.getColor("ComboBox.disabledForeground"));
 179         }
 180     }
 181 
 182     public void paintComponent( Graphics g ) {
 183         boolean leftToRight = MetalUtils.isLeftToRight(comboBox);
 184 


< prev index next >