38
39 import sun.awt.AWTAccessor;
40 import sun.awt.AWTAccessor.MouseEventAccessor;
41
42 /**
43 * This is a basic implementation of the <code>ComboPopup</code> interface.
44 *
45 * This class represents the ui for the popup portion of the combo box.
46 * <p>
47 * All event handling is handled by listener classes created with the
48 * <code>createxxxListener()</code> methods and internal classes.
49 * You can change the behavior of this class by overriding the
50 * <code>createxxxListener()</code> methods and supplying your own
51 * event listeners or subclassing from the ones supplied in this class.
52 * <p>
53 * <strong>Warning:</strong>
54 * Serialized objects of this class will not be compatible with
55 * future Swing releases. The current serialization support is
56 * appropriate for short term storage or RMI between applications running
57 * the same version of Swing. As of 1.4, support for long term storage
58 * of all JavaBeans™
59 * has been added to the <code>java.beans</code> package.
60 * Please see {@link java.beans.XMLEncoder}.
61 *
62 * @author Tom Santos
63 * @author Mark Davidson
64 */
65 @SuppressWarnings("serial") // Same-version serialization only
66 public class BasicComboPopup extends JPopupMenu implements ComboPopup {
67 // An empty ListMode, this is used when the UI changes to allow
68 // the JList to be gc'ed.
69 private static class EmptyListModelClass implements ListModel<Object>, Serializable {
70 public int getSize() { return 0; }
71 public Object getElementAt(int index) { return null; }
72 public void addListDataListener(ListDataListener l) {}
73 public void removeListDataListener(ListDataListener l) {}
74 };
75
76 static final ListModel<Object> EmptyListModel = new EmptyListModelClass();
77
78 private static Border LIST_BORDER = new LineBorder(Color.BLACK, 1);
|
38
39 import sun.awt.AWTAccessor;
40 import sun.awt.AWTAccessor.MouseEventAccessor;
41
42 /**
43 * This is a basic implementation of the <code>ComboPopup</code> interface.
44 *
45 * This class represents the ui for the popup portion of the combo box.
46 * <p>
47 * All event handling is handled by listener classes created with the
48 * <code>createxxxListener()</code> methods and internal classes.
49 * You can change the behavior of this class by overriding the
50 * <code>createxxxListener()</code> methods and supplying your own
51 * event listeners or subclassing from the ones supplied in this class.
52 * <p>
53 * <strong>Warning:</strong>
54 * Serialized objects of this class will not be compatible with
55 * future Swing releases. The current serialization support is
56 * appropriate for short term storage or RMI between applications running
57 * the same version of Swing. As of 1.4, support for long term storage
58 * of all JavaBeans
59 * has been added to the <code>java.beans</code> package.
60 * Please see {@link java.beans.XMLEncoder}.
61 *
62 * @author Tom Santos
63 * @author Mark Davidson
64 */
65 @SuppressWarnings("serial") // Same-version serialization only
66 public class BasicComboPopup extends JPopupMenu implements ComboPopup {
67 // An empty ListMode, this is used when the UI changes to allow
68 // the JList to be gc'ed.
69 private static class EmptyListModelClass implements ListModel<Object>, Serializable {
70 public int getSize() { return 0; }
71 public Object getElementAt(int index) { return null; }
72 public void addListDataListener(ListDataListener l) {}
73 public void removeListDataListener(ListDataListener l) {}
74 };
75
76 static final ListModel<Object> EmptyListModel = new EmptyListModelClass();
77
78 private static Border LIST_BORDER = new LineBorder(Color.BLACK, 1);
|