< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java

Print this page

        

*** 45,61 **** * many simpler components. This class creates and manages the listeners * on the combo box and the combo box model. These listeners update the user * interface in response to changes in the properties and state of the combo box. * <p> * All event handling is handled by listener classes created with the ! * <code>createxxxListener()</code> methods and internal classes. * You can change the behavior of this class by overriding the ! * <code>createxxxListener()</code> methods and supplying your own * event listeners or subclassing from the ones supplied in this class. * <p> * For adding specific actions, ! * overide <code>installKeyboardActions</code> to add actions in response to * KeyStroke bindings. See the article <a href="http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html">How to Use Key Bindings</a> * * @author Arnaud Weber * @author Tom Santos * @author Mark Davidson --- 45,61 ---- * many simpler components. This class creates and manages the listeners * on the combo box and the combo box model. These listeners update the user * interface in response to changes in the properties and state of the combo box. * <p> * All event handling is handled by listener classes created with the ! * {@code createxxxListener()} methods and internal classes. * You can change the behavior of this class by overriding the ! * {@code createxxxListener()} methods and supplying your own * event listeners or subclassing from the ones supplied in this class. * <p> * For adding specific actions, ! * overide {@code installKeyboardActions} to add actions in response to * KeyStroke bindings. See the article <a href="http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html">How to Use Key Bindings</a> * * @author Arnaud Weber * @author Tom Santos * @author Mark Davidson
*** 434,444 **** } /** * Removes the installed listeners from the combo box and its model. * The number and types of listeners removed and in this method should be ! * the same that was added in <code>installListeners</code> */ protected void uninstallListeners() { if ( keyListener != null ) { comboBox.removeKeyListener( keyListener ); } --- 434,444 ---- } /** * Removes the installed listeners from the combo box and its model. * The number and types of listeners removed and in this method should be ! * the same that was added in {@code installListeners} */ protected void uninstallListeners() { if ( keyListener != null ) { comboBox.removeKeyListener( keyListener ); }
*** 471,539 **** } /** * Creates the popup portion of the combo box. * ! * @return an instance of <code>ComboPopup</code> * @see ComboPopup */ protected ComboPopup createPopup() { return new BasicComboPopup( comboBox ); } /** ! * Creates a <code>KeyListener</code> which will be added to the * combo box. If this method returns null then it will not be added * to the combo box. * ! * @return an instance <code>KeyListener</code> or null */ protected KeyListener createKeyListener() { return getHandler(); } /** ! * Creates a <code>FocusListener</code> which will be added to the combo box. * If this method returns null then it will not be added to the combo box. * ! * @return an instance of a <code>FocusListener</code> or null */ protected FocusListener createFocusListener() { return getHandler(); } /** * Creates a list data listener which will be added to the ! * <code>ComboBoxModel</code>. If this method returns null then * it will not be added to the combo box model. * ! * @return an instance of a <code>ListDataListener</code> or null */ protected ListDataListener createListDataListener() { return getHandler(); } /** ! * Creates an <code>ItemListener</code> which will be added to the * combo box. If this method returns null then it will not * be added to the combo box. * <p> * Subclasses may override this method to return instances of their own * ItemEvent handlers. * ! * @return an instance of an <code>ItemListener</code> or null */ protected ItemListener createItemListener() { return null; } /** ! * Creates a <code>PropertyChangeListener</code> which will be added to * the combo box. If this method returns null then it will not * be added to the combo box. * ! * @return an instance of a <code>PropertyChangeListener</code> or null */ protected PropertyChangeListener createPropertyChangeListener() { return getHandler(); } --- 471,539 ---- } /** * Creates the popup portion of the combo box. * ! * @return an instance of {@code ComboPopup} * @see ComboPopup */ protected ComboPopup createPopup() { return new BasicComboPopup( comboBox ); } /** ! * Creates a {@code KeyListener} which will be added to the * combo box. If this method returns null then it will not be added * to the combo box. * ! * @return an instance {@code KeyListener} or null */ protected KeyListener createKeyListener() { return getHandler(); } /** ! * Creates a {@code FocusListener} which will be added to the combo box. * If this method returns null then it will not be added to the combo box. * ! * @return an instance of a {@code FocusListener} or null */ protected FocusListener createFocusListener() { return getHandler(); } /** * Creates a list data listener which will be added to the ! * {@code ComboBoxModel}. If this method returns null then * it will not be added to the combo box model. * ! * @return an instance of a {@code ListDataListener} or null */ protected ListDataListener createListDataListener() { return getHandler(); } /** ! * Creates an {@code ItemListener} which will be added to the * combo box. If this method returns null then it will not * be added to the combo box. * <p> * Subclasses may override this method to return instances of their own * ItemEvent handlers. * ! * @return an instance of an {@code ItemListener} or null */ protected ItemListener createItemListener() { return null; } /** ! * Creates a {@code PropertyChangeListener} which will be added to * the combo box. If this method returns null then it will not * be added to the combo box. * ! * @return an instance of a {@code PropertyChangeListener} or null */ protected PropertyChangeListener createPropertyChangeListener() { return getHandler(); }
*** 548,572 **** } /** * Creates the default renderer that will be used in a non-editiable combo * box. A default renderer will used only if a renderer has not been ! * explicitly set with <code>setRenderer</code>. * ! * @return a <code>ListCellRender</code> used for the combo box * @see javax.swing.JComboBox#setRenderer */ protected ListCellRenderer<Object> createRenderer() { return new BasicComboBoxRenderer.UIResource(); } /** * Creates the default editor that will be used in editable combo boxes. * A default editor will be used only if an editor has not been ! * explicitly set with <code>setEditor</code>. * ! * @return a <code>ComboBoxEditor</code> used for the combo box * @see javax.swing.JComboBox#setEditor */ protected ComboBoxEditor createEditor() { return new BasicComboBoxEditor.UIResource(); } --- 548,572 ---- } /** * Creates the default renderer that will be used in a non-editiable combo * box. A default renderer will used only if a renderer has not been ! * explicitly set with {@code setRenderer}. * ! * @return a {@code ListCellRender} used for the combo box * @see javax.swing.JComboBox#setRenderer */ protected ListCellRenderer<Object> createRenderer() { return new BasicComboBoxRenderer.UIResource(); } /** * Creates the default editor that will be used in editable combo boxes. * A default editor will be used only if an editor has not been ! * explicitly set with {@code setEditor}. * ! * @return a {@code ComboBoxEditor} used for the combo box * @see javax.swing.JComboBox#setEditor */ protected ComboBoxEditor createEditor() { return new BasicComboBoxEditor.UIResource(); }
*** 599,609 **** * it finds a key event that wasn't a navigation key it dispatches it to * JComboBox.selectWithKeyChar() so that it can do type-ahead. * * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * <code>BasicComboBoxUI</code>. */ public class KeyHandler extends KeyAdapter { @Override public void keyPressed( KeyEvent e ) { getHandler().keyPressed(e); --- 599,609 ---- * it finds a key event that wasn't a navigation key it dispatches it to * JComboBox.selectWithKeyChar() so that it can do type-ahead. * * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * {@code BasicComboBoxUI}. */ public class KeyHandler extends KeyAdapter { @Override public void keyPressed( KeyEvent e ) { getHandler().keyPressed(e);
*** 614,624 **** * This listener hides the popup when the focus is lost. It also repaints * when focus is gained or lost. * * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * <code>BasicComboBoxUI</code>. */ public class FocusHandler implements FocusListener { public void focusGained( FocusEvent e ) { getHandler().focusGained(e); } --- 614,624 ---- * This listener hides the popup when the focus is lost. It also repaints * when focus is gained or lost. * * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * {@code BasicComboBoxUI}. */ public class FocusHandler implements FocusListener { public void focusGained( FocusEvent e ) { getHandler().focusGained(e); }
*** 628,642 **** } } /** * This listener watches for changes in the ! * <code>ComboBoxModel</code>. * <p> * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * <code>BasicComboBoxUI</code>. * * @see #createListDataListener */ public class ListDataHandler implements ListDataListener { public void contentsChanged( ListDataEvent e ) { --- 628,642 ---- } } /** * This listener watches for changes in the ! * {@code ComboBoxModel}. * <p> * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * {@code BasicComboBoxUI}. * * @see #createListDataListener */ public class ListDataHandler implements ListDataListener { public void contentsChanged( ListDataEvent e ) {
*** 656,666 **** * This listener watches for changes to the selection in the * combo box. * <p> * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * <code>BasicComboBoxUI</code>. * * @see #createItemListener */ public class ItemHandler implements ItemListener { // This class used to implement behavior which is now redundant. --- 656,666 ---- * This listener watches for changes to the selection in the * combo box. * <p> * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * {@code BasicComboBoxUI}. * * @see #createItemListener */ public class ItemHandler implements ItemListener { // This class used to implement behavior which is now redundant.
*** 675,685 **** * call the superclass methods to ensure that the combo box ui correctly * handles property changes. * <p> * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * <code>BasicComboBoxUI</code>. * * @see #createPropertyChangeListener */ public class PropertyChangeHandler implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { --- 675,685 ---- * call the superclass methods to ensure that the combo box ui correctly * handles property changes. * <p> * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * {@code BasicComboBoxUI}. * * @see #createPropertyChangeListener */ public class PropertyChangeHandler implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) {
*** 704,714 **** * the arrow button to the right and the editor to the left. If there is no * editor it still keeps the arrow button to the right. * * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * <code>BasicComboBoxUI</code>. */ public class ComboBoxLayoutManager implements LayoutManager { public void addLayoutComponent(String name, Component comp) {} public void removeLayoutComponent(Component comp) {} --- 704,714 ---- * the arrow button to the right and the editor to the left. If there is no * editor it still keeps the arrow button to the right. * * This public inner class should be treated as protected. * Instantiate it only within subclasses of ! * {@code BasicComboBoxUI}. */ public class ComboBoxLayoutManager implements LayoutManager { public void addLayoutComponent(String name, Component comp) {} public void removeLayoutComponent(Component comp) {}
*** 772,782 **** } /** * This public method is implementation specific and should be private. * do not call or override. To implement a specific editor create a ! * custom <code>ComboBoxEditor</code> * * @see #createEditor * @see javax.swing.JComboBox#setEditor * @see javax.swing.ComboBoxEditor */ --- 772,782 ---- } /** * This public method is implementation specific and should be private. * do not call or override. To implement a specific editor create a ! * custom {@code ComboBoxEditor} * * @see #createEditor * @see javax.swing.JComboBox#setEditor * @see javax.swing.ComboBoxEditor */
< prev index next >