< prev index next >

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

Print this page

        

*** 36,62 **** import java.beans.PropertyChangeEvent; import java.io.Serializable; /** ! * This is a basic implementation of the <code>ComboPopup</code> interface. * * This class represents the ui for the popup portion 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> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Tom Santos * @author Mark Davidson */ --- 36,62 ---- import java.beans.PropertyChangeEvent; import java.io.Serializable; /** ! * This is a basic implementation of the {@code ComboPopup} interface. * * This class represents the ui for the popup portion 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> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @author Tom Santos * @author Mark Davidson */
*** 260,270 **** } /** * Implementation of ComboPopup.getMouseListener(). * ! * @return a <code>MouseListener</code> or null * @see ComboPopup#getMouseListener */ public MouseListener getMouseListener() { if (mouseListener == null) { mouseListener = createMouseListener(); --- 260,270 ---- } /** * Implementation of ComboPopup.getMouseListener(). * ! * @return a {@code MouseListener} or null * @see ComboPopup#getMouseListener */ public MouseListener getMouseListener() { if (mouseListener == null) { mouseListener = createMouseListener();
*** 273,283 **** } /** * Implementation of ComboPopup.getMouseMotionListener(). * ! * @return a <code>MouseMotionListener</code> or null * @see ComboPopup#getMouseMotionListener */ public MouseMotionListener getMouseMotionListener() { if (mouseMotionListener == null) { mouseMotionListener = createMouseMotionListener(); --- 273,283 ---- } /** * Implementation of ComboPopup.getMouseMotionListener(). * ! * @return a {@code MouseMotionListener} or null * @see ComboPopup#getMouseMotionListener */ public MouseMotionListener getMouseMotionListener() { if (mouseMotionListener == null) { mouseMotionListener = createMouseMotionListener();
*** 286,296 **** } /** * Implementation of ComboPopup.getKeyListener(). * ! * @return a <code>KeyListener</code> or null * @see ComboPopup#getKeyListener */ public KeyListener getKeyListener() { if (keyListener == null) { keyListener = createKeyListener(); --- 286,296 ---- } /** * Implementation of ComboPopup.getKeyListener(). * ! * @return a {@code KeyListener} or null * @see ComboPopup#getKeyListener */ public KeyListener getKeyListener() { if (keyListener == null) { keyListener = createKeyListener();
*** 400,410 **** * * <strong>Warning:</strong> * When overriding this method, make sure to maintain the existing * behavior. * ! * @return a <code>MouseListener</code> which will be added to * the combo box or null */ protected MouseListener createMouseListener() { return getHandler(); } --- 400,410 ---- * * <strong>Warning:</strong> * When overriding this method, make sure to maintain the existing * behavior. * ! * @return a {@code MouseListener} which will be added to * the combo box or null */ protected MouseListener createMouseListener() { return getHandler(); }
*** 415,505 **** * * <strong>Warning:</strong> * When overriding this method, make sure to maintain the existing * behavior. * ! * @return a <code>MouseMotionListener</code> which will be added to * the combo box or null */ protected MouseMotionListener createMouseMotionListener() { return getHandler(); } /** * Creates the key listener that will be added to the combo box. If * this method returns null then it will not be added to the combo box. * ! * @return a <code>KeyListener</code> or null */ protected KeyListener createKeyListener() { return null; } /** * Creates a list selection listener that watches for selection changes in * the popup's list. If this method returns null then it will not * be added to the popup list. * ! * @return an instance of a <code>ListSelectionListener</code> or null */ protected ListSelectionListener createListSelectionListener() { return null; } /** * 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 null; } /** * Creates a mouse listener that watches for mouse events in * the popup's list. If this method returns null then it will * not be added to the combo box. * ! * @return an instance of a <code>MouseListener</code> or null */ protected MouseListener createListMouseListener() { return getHandler(); } /** * Creates a mouse motion listener that watches for mouse motion * events in the popup's list. If this method returns null then it will * not be added to the combo box. * ! * @return an instance of a <code>MouseMotionListener</code> or null */ protected MouseMotionListener createListMouseMotionListener() { return getHandler(); } /** ! * 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(); } /** ! * 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 getHandler(); } --- 415,505 ---- * * <strong>Warning:</strong> * When overriding this method, make sure to maintain the existing * behavior. * ! * @return a {@code MouseMotionListener} which will be added to * the combo box or null */ protected MouseMotionListener createMouseMotionListener() { return getHandler(); } /** * Creates the key listener that will be added to the combo box. If * this method returns null then it will not be added to the combo box. * ! * @return a {@code KeyListener} or null */ protected KeyListener createKeyListener() { return null; } /** * Creates a list selection listener that watches for selection changes in * the popup's list. If this method returns null then it will not * be added to the popup list. * ! * @return an instance of a {@code ListSelectionListener} or null */ protected ListSelectionListener createListSelectionListener() { return null; } /** * 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 null; } /** * Creates a mouse listener that watches for mouse events in * the popup's list. If this method returns null then it will * not be added to the combo box. * ! * @return an instance of a {@code MouseListener} or null */ protected MouseListener createListMouseListener() { return getHandler(); } /** * Creates a mouse motion listener that watches for mouse motion * events in the popup's list. If this method returns null then it will * not be added to the combo box. * ! * @return an instance of a {@code MouseMotionListener} or null */ protected MouseMotionListener createListMouseMotionListener() { return getHandler(); } /** ! * 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(); } /** ! * 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 getHandler(); }
*** 513,523 **** /** * Creates the JList used in the popup to display * the items in the combo box model. This method is called when the UI class * is created. * ! * @return a <code>JList</code> used to display the combo box items */ protected JList<Object> createList() { return new JList<Object>( comboBox.getModel() ) { public void processMouseEvent(MouseEvent e) { if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { --- 513,523 ---- /** * Creates the JList used in the popup to display * the items in the combo box model. This method is called when the UI class * is created. * ! * @return a {@code JList} used to display the combo box items */ protected JList<Object> createList() { return new JList<Object>( comboBox.getModel() ) { public void processMouseEvent(MouseEvent e) { if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) {
*** 656,666 **** } /** * Installs the listeners on the combo box model. Any listeners installed * on the combo box model should be removed in ! * <code>uninstallComboBoxModelListeners</code>. * * @param model The combo box model to install listeners * @see #uninstallComboBoxModelListeners */ protected void installComboBoxModelListeners( ComboBoxModel<?> model ) { --- 656,666 ---- } /** * Installs the listeners on the combo box model. Any listeners installed * on the combo box model should be removed in ! * {@code uninstallComboBoxModelListeners}. * * @param model The combo box model to install listeners * @see #uninstallComboBoxModelListeners */ protected void installComboBoxModelListeners( ComboBoxModel<?> model ) {
*** 770,780 **** /** * As of 1.4, this class is now obsolete, doesn't do anything, and * is only included for backwards API compatibility. Do not call or * override. * <p> ! * The functionality has been migrated into <code>ItemHandler</code>. * * @see #createItemListener */ public class ListDataHandler implements ListDataListener { public void contentsChanged( ListDataEvent e ) {} --- 770,780 ---- /** * As of 1.4, this class is now obsolete, doesn't do anything, and * is only included for backwards API compatibility. Do not call or * override. * <p> ! * The functionality has been migrated into {@code ItemHandler}. * * @see #createItemListener */ public class ListDataHandler implements ListDataListener { public void contentsChanged( ListDataEvent e ) {}
< prev index next >