45 * A component that combines a button or editable field and a drop-down list.
46 * The user can select a value from the drop-down list, which appears at the
47 * user's request. If you make the combo box editable, then the combo box
48 * includes an editable field into which the user can type a value.
49 * <p>
50 * <strong>Warning:</strong> Swing is not thread safe. For more
51 * information see <a
52 * href="package-summary.html#threading">Swing's Threading
53 * Policy</a>.
54 * <p>
55 * <strong>Warning:</strong>
56 * Serialized objects of this class will not be compatible with
57 * future Swing releases. The current serialization support is
58 * appropriate for short term storage or RMI between applications running
59 * the same version of Swing. As of 1.4, support for long term storage
60 * of all JavaBeans<sup><font size="-2">TM</font></sup>
61 * has been added to the <code>java.beans</code> package.
62 * Please see {@link java.beans.XMLEncoder}.
63 *
64 * <p>
65 * See <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html">How to Use Combo Boxes</a>
66 * in <a href="http://java.sun.com/Series/Tutorial/index.html"><em>The Java Tutorial</em></a>
67 * for further information.
68 * <p>
69 * @see ComboBoxModel
70 * @see DefaultComboBoxModel
71 *
72 * @param <E> the type of the elements of this combo box
73 *
74 * @beaninfo
75 * attribute: isContainer false
76 * description: A combination of a text field and a drop-down list.
77 *
78 * @author Arnaud Weber
79 * @author Mark Davidson
80 */
81 public class JComboBox<E> extends JComponent
82 implements ItemSelectable,ListDataListener,ActionListener, Accessible {
83 /**
84 * @see #getUIClassID
85 * @see #readObject
86 */
333 */
334
335 /**
336 * Sets the <code>lightWeightPopupEnabled</code> property, which
337 * provides a hint as to whether or not a lightweight
338 * <code>Component</code> should be used to contain the
339 * <code>JComboBox</code>, versus a heavyweight
340 * <code>Component</code> such as a <code>Panel</code>
341 * or a <code>Window</code>. The decision of lightweight
342 * versus heavyweight is ultimately up to the
343 * <code>JComboBox</code>. Lightweight windows are more
344 * efficient than heavyweight windows, but lightweight
345 * and heavyweight components do not mix well in a GUI.
346 * If your application mixes lightweight and heavyweight
347 * components, you should disable lightweight popups.
348 * The default value for the <code>lightWeightPopupEnabled</code>
349 * property is <code>true</code>, unless otherwise specified
350 * by the look and feel. Some look and feels always use
351 * heavyweight popups, no matter what the value of this property.
352 * <p>
353 * See the article <a href="http://java.sun.com/products/jfc/tsc/articles/mixing/index.html">Mixing Heavy and Light Components</a>
354 * on <a href="http://java.sun.com/products/jfc/tsc">
355 * <em>The Swing Connection</em></a>
356 * This method fires a property changed event.
357 *
358 * @param aFlag if <code>true</code>, lightweight popups are desired
359 *
360 * @beaninfo
361 * bound: true
362 * expert: true
363 * description: Set to <code>false</code> to require heavyweight popups.
364 */
365 public void setLightWeightPopupEnabled(boolean aFlag) {
366 boolean oldFlag = lightWeightPopupEnabled;
367 lightWeightPopupEnabled = aFlag;
368 firePropertyChange("lightWeightPopupEnabled", oldFlag, lightWeightPopupEnabled);
369 }
370
371 /**
372 * Gets the value of the <code>lightWeightPopupEnabled</code>
373 * property.
374 *
375 * @return the value of the <code>lightWeightPopupEnabled</code>
|
45 * A component that combines a button or editable field and a drop-down list.
46 * The user can select a value from the drop-down list, which appears at the
47 * user's request. If you make the combo box editable, then the combo box
48 * includes an editable field into which the user can type a value.
49 * <p>
50 * <strong>Warning:</strong> Swing is not thread safe. For more
51 * information see <a
52 * href="package-summary.html#threading">Swing's Threading
53 * Policy</a>.
54 * <p>
55 * <strong>Warning:</strong>
56 * Serialized objects of this class will not be compatible with
57 * future Swing releases. The current serialization support is
58 * appropriate for short term storage or RMI between applications running
59 * the same version of Swing. As of 1.4, support for long term storage
60 * of all JavaBeans<sup><font size="-2">TM</font></sup>
61 * has been added to the <code>java.beans</code> package.
62 * Please see {@link java.beans.XMLEncoder}.
63 *
64 * <p>
65 * See <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html">How to Use Combo Boxes</a>
66 * in <a href="http://docs.oracle.com/javase/tutorial/"><em>The Java Tutorial</em></a>
67 * for further information.
68 * <p>
69 * @see ComboBoxModel
70 * @see DefaultComboBoxModel
71 *
72 * @param <E> the type of the elements of this combo box
73 *
74 * @beaninfo
75 * attribute: isContainer false
76 * description: A combination of a text field and a drop-down list.
77 *
78 * @author Arnaud Weber
79 * @author Mark Davidson
80 */
81 public class JComboBox<E> extends JComponent
82 implements ItemSelectable,ListDataListener,ActionListener, Accessible {
83 /**
84 * @see #getUIClassID
85 * @see #readObject
86 */
333 */
334
335 /**
336 * Sets the <code>lightWeightPopupEnabled</code> property, which
337 * provides a hint as to whether or not a lightweight
338 * <code>Component</code> should be used to contain the
339 * <code>JComboBox</code>, versus a heavyweight
340 * <code>Component</code> such as a <code>Panel</code>
341 * or a <code>Window</code>. The decision of lightweight
342 * versus heavyweight is ultimately up to the
343 * <code>JComboBox</code>. Lightweight windows are more
344 * efficient than heavyweight windows, but lightweight
345 * and heavyweight components do not mix well in a GUI.
346 * If your application mixes lightweight and heavyweight
347 * components, you should disable lightweight popups.
348 * The default value for the <code>lightWeightPopupEnabled</code>
349 * property is <code>true</code>, unless otherwise specified
350 * by the look and feel. Some look and feels always use
351 * heavyweight popups, no matter what the value of this property.
352 * <p>
353 * See the article <a href="http://www.oracle.com/technetwork/articles/java/mixing-components-433992.html">Mixing Heavy and Light Components</a>
354 * This method fires a property changed event.
355 *
356 * @param aFlag if <code>true</code>, lightweight popups are desired
357 *
358 * @beaninfo
359 * bound: true
360 * expert: true
361 * description: Set to <code>false</code> to require heavyweight popups.
362 */
363 public void setLightWeightPopupEnabled(boolean aFlag) {
364 boolean oldFlag = lightWeightPopupEnabled;
365 lightWeightPopupEnabled = aFlag;
366 firePropertyChange("lightWeightPopupEnabled", oldFlag, lightWeightPopupEnabled);
367 }
368
369 /**
370 * Gets the value of the <code>lightWeightPopupEnabled</code>
371 * property.
372 *
373 * @return the value of the <code>lightWeightPopupEnabled</code>
|