2362N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A component that combines a button or editable field and a drop-down list. 0N/A * The user can select a value from the drop-down list, which appears at the 0N/A * user's request. If you make the combo box editable, then the combo box 0N/A * includes an editable field into which the user can type a value. 0N/A * <strong>Warning:</strong> Swing is not thread safe. For more 0N/A * information see <a 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * for further information. 0N/A * @see ComboBoxModel 0N/A * @see DefaultComboBoxModel 4202N/A * @param <E> the type of the elements of this combo box 0N/A * attribute: isContainer false 0N/A * description: A combination of a text field and a drop-down list. 0N/A * @author Arnaud Weber 0N/A * @author Mark Davidson 0N/A * @see #getUIClassID 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * @see #getMaximumRowCount 0N/A * @see #setMaximumRowCount 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * @see #setKeySelectionManager 0N/A * @see #getKeySelectionManager 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * @see #setActionCommand 0N/A * @see #getActionCommand 0N/A * This protected field is implementation specific. Do not access directly 0N/A * or override. Use the accessor methods instead. 0N/A * @see #setLightWeightPopupEnabled 0N/A * @see #isLightWeightPopupEnabled 0N/A * This protected field is implementation specific. Do not access directly 0N/A // Flag to ensure that infinite loops do not occur with ActionEvents. 0N/A // Flag to ensure the we don't get multiple ActionEvents on item selection. 0N/A * Creates a <code>JComboBox</code> that takes its items from an 0N/A * existing <code>ComboBoxModel</code>. Since the 0N/A * <code>ComboBoxModel</code> is provided, a combo box created using 0N/A * this constructor does not create a default combo box model and 0N/A * may impact how the insert, remove and add methods behave. 0N/A * @param aModel the <code>ComboBoxModel</code> that provides the 0N/A * displayed list of items 0N/A * @see DefaultComboBoxModel 0N/A * Creates a <code>JComboBox</code> that contains the elements 0N/A * in the specified array. By default the first item in the array 0N/A * (and therefore the data model) becomes selected. 0N/A * @param items an array of objects to insert into the combo box 0N/A * @see DefaultComboBoxModel 0N/A * Creates a <code>JComboBox</code> that contains the elements 0N/A * in the specified Vector. By default the first item in the vector 0N/A * (and therefore the data model) becomes selected. 0N/A * @param items an array of vectors to insert into the combo box 0N/A * @see DefaultComboBoxModel 0N/A * Creates a <code>JComboBox</code> with a default data model. 0N/A * The default data model is an empty list of objects. 0N/A * Use <code>addItem</code> to add items. By default the first item 0N/A * in the data model becomes selected. 0N/A * @see DefaultComboBoxModel 0N/A * Sets the L&F object that renders this component. 0N/A * @param ui the <code>ComboBoxUI</code> L&F object 0N/A * @see UIDefaults#getUI 0N/A * attribute: visualUpdate true 0N/A * description: The UI object that implements the Component's LookAndFeel. 0N/A * Resets the UI property to a value from the current look and feel. 0N/A * @see JComponent#updateUI 0N/A * Returns the name of the L&F class that renders this component. 0N/A * @return the string "ComboBoxUI" 0N/A * @see JComponent#getUIClassID 0N/A * @see UIDefaults#getUI 0N/A * Returns the L&F object that renders this component. 0N/A * @return the ComboBoxUI object that renders this component 0N/A * Sets the data model that the <code>JComboBox</code> uses to obtain 0N/A * the list of items. 0N/A * @param aModel the <code>ComboBoxModel</code> that provides the 0N/A * displayed list of items 0N/A * description: Model that the combo box uses to get data to display. 0N/A // set the current selected item. 0N/A * Returns the data model currently used by the <code>JComboBox</code>. 0N/A * @return the <code>ComboBoxModel</code> that provides the displayed 0N/A * Sets the <code>lightWeightPopupEnabled</code> property, which 0N/A * provides a hint as to whether or not a lightweight 0N/A * <code>Component</code> should be used to contain the 0N/A * <code>JComboBox</code>, versus a heavyweight 0N/A * <code>Component</code> such as a <code>Panel</code> 0N/A * or a <code>Window</code>. The decision of lightweight 0N/A * versus heavyweight is ultimately up to the 0N/A * <code>JComboBox</code>. Lightweight windows are more 0N/A * efficient than heavyweight windows, but lightweight 0N/A * and heavyweight components do not mix well in a GUI. 0N/A * If your application mixes lightweight and heavyweight 0N/A * components, you should disable lightweight popups. 0N/A * The default value for the <code>lightWeightPopupEnabled</code> 0N/A * property is <code>true</code>, unless otherwise specified 0N/A * by the look and feel. Some look and feels always use 0N/A * heavyweight popups, no matter what the value of this property. 0N/A * <em>The Swing Connection</em></a> 0N/A * This method fires a property changed event. 0N/A * @param aFlag if <code>true</code>, lightweight popups are desired 0N/A * description: Set to <code>false</code> to require heavyweight popups. 0N/A * Gets the value of the <code>lightWeightPopupEnabled</code> 0N/A * @return the value of the <code>lightWeightPopupEnabled</code> 0N/A * @see #setLightWeightPopupEnabled 0N/A * Determines whether the <code>JComboBox</code> field is editable. 0N/A * An editable <code>JComboBox</code> allows the user to type into the 0N/A * field or selected an item from the list to initialize the field, 0N/A * after which it can be edited. (The editing affects only the field, 0N/A * the list item remains intact.) A non editable <code>JComboBox</code> 0N/A * displays the selected item in the field, 0N/A * but the selection cannot be modified. 0N/A * @param aFlag a boolean value, where true indicates that the 0N/A * description: If true, the user can type a new value in the combo box. 0N/A * Returns true if the <code>JComboBox</code> is editable. 0N/A * By default, a combo box is not editable. 0N/A * @return true if the <code>JComboBox</code> is editable, else false 0N/A * Sets the maximum number of rows the <code>JComboBox</code> displays. 0N/A * If the number of objects in the model is greater than count, 0N/A * the combo box uses a scrollbar. 0N/A * @param count an integer specifying the maximum number of items to 0N/A * display in the list before using a scrollbar 0N/A * description: The maximum number of rows the popup should have 0N/A * Returns the maximum number of items the combo box can display 0N/A * without a scrollbar 0N/A * @return an integer specifying the maximum number of items that are 0N/A * displayed in the list before using a scrollbar 0N/A * Sets the renderer that paints the list items and the item selected from the list in 0N/A * the JComboBox field. The renderer is used if the JComboBox is not 0N/A * editable. If it is editable, the editor is used to render and edit 0N/A * the selected item. 0N/A * The default renderer displays a string or an icon. 0N/A * Other renderers can handle graphic images and composite items. 0N/A * To display the selected item, 0N/A * <code>aRenderer.getListCellRendererComponent</code> 0N/A * is called, passing the list object and an index of -1. 0N/A * @param aRenderer the <code>ListCellRenderer</code> that 0N/A * displays the selected item 0N/A * description: The renderer that paints the item selected in the list. 0N/A * Returns the renderer used to display the selected item in the 0N/A * <code>JComboBox</code> field. 0N/A * @return the <code>ListCellRenderer</code> that displays 0N/A * the selected item. 0N/A * Sets the editor used to paint and edit the selected item in the 0N/A * <code>JComboBox</code> field. The editor is used only if the 0N/A * receiving <code>JComboBox</code> is editable. If not editable, 0N/A * the combo box uses the renderer to paint the selected item. 0N/A * @param anEditor the <code>ComboBoxEditor</code> that 0N/A * displays the selected item 0N/A * description: The editor that combo box uses to edit the current value 0N/A * Returns the editor used to paint and edit the selected item in the 0N/A * <code>JComboBox</code> field. 0N/A * @return the <code>ComboBoxEditor</code> that displays the selected item 0N/A * Sets the selected item in the combo box display area to the object in 0N/A * If <code>anObject</code> is in the list, the display area shows 0N/A * <code>anObject</code> selected. 0N/A * If <code>anObject</code> is <i>not</i> in the list and the combo box is 0N/A * uneditable, it will not change the current selection. For editable 0N/A * combo boxes, the selection will change to <code>anObject</code>. 0N/A * If this constitutes a change in the selected item, 0N/A * <code>ItemListener</code>s added to the combo box will be notified with 0N/A * one or two <code>ItemEvent</code>s. 0N/A * If there is a current selected item, an <code>ItemEvent</code> will be 0N/A * fired and the state change will be <code>ItemEvent.DESELECTED</code>. 0N/A * If <code>anObject</code> is in the list and is not currently selected 0N/A * then an <code>ItemEvent</code> will be fired and the state change will 0N/A * be <code>ItemEvent.SELECTED</code>. 0N/A * <code>ActionListener</code>s added to the combo box will be notified 0N/A * with an <code>ActionEvent</code> when this method is called. 0N/A * @param anObject the list object to select; use <code>null</code> to 0N/A * description: Sets the selected item in the JComboBox. 0N/A // For non editable combo boxes, an invalid selection 0N/A // will be rejected. 0N/A // Must toggle the state of this flag since this method 0N/A // call may result in ListDataEvents being fired. 0N/A // in case a users implementation of ComboBoxModel 0N/A // doesn't fire a ListDataEvent when the selection 0N/A * Returns the current selected item. 0N/A * If the combo box is editable, then this value may not have been added 0N/A * to the combo box with <code>addItem</code>, <code>insertItemAt</code> 0N/A * or the data constructors. 0N/A * @return the current selected Object 0N/A * @see #setSelectedItem 0N/A * Selects the item at index <code>anIndex</code>. 0N/A * @param anIndex an integer specifying the list item to select, 0N/A * where 0 specifies the first item in the list and -1 indicates no selection 0N/A * @exception IllegalArgumentException if <code>anIndex</code> < -1 or 0N/A * <code>anIndex</code> is greater than or equal to size 0N/A * description: The item at index is selected. 0N/A * Returns the first item in the list that matches the given item. 0N/A * The result is not always defined if the <code>JComboBox</code> 0N/A * allows selected items that are not in the list. 0N/A * Returns -1 if there is no selected item or if the user specified 0N/A * an item which is not in the list. 0N/A * @return an integer specifying the currently selected list item, 0N/A * the first item in the list; 0N/A * or -1 if no item is selected or if 0N/A * the currently selected item is not in the list 0N/A * Returns the "prototypical display" value - an Object used 0N/A * for the calculation of the display height and width. 0N/A * @return the value of the <code>prototypeDisplayValue</code> property 0N/A * @see #setPrototypeDisplayValue 0N/A * Sets the prototype display value used to calculate the size of the display 0N/A * for the UI portion. 0N/A * If a prototype display value is specified, the preferred size of 0N/A * the combo box is calculated by configuring the renderer with the 0N/A * prototype display value and obtaining its preferred size. Specifying 0N/A * the preferred display value is often useful when the combo box will be 0N/A * displaying large amounts of data. If no prototype display value has 0N/A * been specified, the renderer must be configured for each value from 0N/A * the model and its preferred size obtained, which can be 0N/A * relatively expensive. 0N/A * @param prototypeDisplayValue 0N/A * @see #getPrototypeDisplayValue 0N/A * attribute: visualUpdate true 0N/A * description: The display prototype value, used to compute display width and height. 0N/A * Adds an item to the item list. 0N/A * This method works only if the <code>JComboBox</code> uses a 0N/A * mutable data model. 0N/A * <strong>Warning:</strong> 0N/A * Focus and keyboard navigation problems may arise if you add duplicate 0N/A * String objects. A workaround is to add new objects instead of String 0N/A * objects and make sure that the toString() method is defined. 0N/A * comboBox.addItem(makeObj("Item 1")); 0N/A * comboBox.addItem(makeObj("Item 1")); 0N/A * private Object makeObj(final String item) { 0N/A * return new Object() { public String toString() { return item; } }; 4202N/A * @param item the item to add to the list 0N/A * @see MutableComboBoxModel 0N/A * Inserts an item into the item list at a given index. 0N/A * This method works only if the <code>JComboBox</code> uses a 0N/A * mutable data model. 4202N/A * @param item the item to add to the list 0N/A * @param index an integer specifying the position at which 0N/A * @see MutableComboBoxModel 0N/A * Removes an item from the item list. 0N/A * This method works only if the <code>JComboBox</code> uses a 0N/A * mutable data model. 0N/A * @param anObject the object to remove from the item list 0N/A * @see MutableComboBoxModel 0N/A * Removes the item at <code>anIndex</code> 0N/A * This method works only if the <code>JComboBox</code> uses a 0N/A * mutable data model. 0N/A * @param anIndex an int specifying the index of the item to remove, 0N/A * indicates the first item in the list 0N/A * @see MutableComboBoxModel 0N/A * Removes all items from the item list. 0N/A * Checks that the <code>dataModel</code> is an instance of 0N/A * <code>MutableComboBoxModel</code>. If not, it throws an exception. 0N/A * @exception RuntimeException if <code>dataModel</code> is not an 0N/A * instance of <code>MutableComboBoxModel</code>. 0N/A * Causes the combo box to display its popup window. 0N/A * @see #setPopupVisible 0N/A * Causes the combo box to close its popup window. 0N/A * @see #setPopupVisible 0N/A * Sets the visibility of the popup. 0N/A * Determines the visibility of the popup. 0N/A * @return true if the popup is visible, otherwise returns false 0N/A * Adds an <code>ItemListener</code>. 0N/A * <code>aListener</code> will receive one or two <code>ItemEvent</code>s when 0N/A * the selected item changes. 0N/A * @param aListener the <code>ItemListener</code> that is to be notified 0N/A * @see #setSelectedItem 0N/A /** Removes an <code>ItemListener</code>. 0N/A * @param aListener the <code>ItemListener</code> to remove 0N/A * Returns an array of all the <code>ItemListener</code>s added 0N/A * to this JComboBox with addItemListener(). 0N/A * @return all of the <code>ItemListener</code>s added or an empty 0N/A * array if no listeners have been added 0N/A * Adds an <code>ActionListener</code>. 0N/A * The <code>ActionListener</code> will receive an <code>ActionEvent</code> 0N/A * when a selection has been made. If the combo box is editable, then 0N/A * an <code>ActionEvent</code> will be fired when editing has stopped. 0N/A * @param l the <code>ActionListener</code> that is to be notified 0N/A * @see #setSelectedItem 0N/A /** Removes an <code>ActionListener</code>. 0N/A * @param l the <code>ActionListener</code> to remove 0N/A * Returns an array of all the <code>ActionListener</code>s added 0N/A * to this JComboBox with addActionListener(). 0N/A * @return all of the <code>ActionListener</code>s added or an empty 0N/A * array if no listeners have been added 0N/A * Adds a <code>PopupMenu</code> listener which will listen to notification 0N/A * messages from the popup portion of the combo box. 0N/A * For all standard look and feels shipped with Java, the popup list 0N/A * portion of combo box is implemented as a <code>JPopupMenu</code>. 0N/A * A custom look and feel may not implement it this way and will 0N/A * therefore not receive the notification. 0N/A * @param l the <code>PopupMenuListener</code> to add 0N/A * Removes a <code>PopupMenuListener</code>. 0N/A * @param l the <code>PopupMenuListener</code> to remove 0N/A * @see #addPopupMenuListener 0N/A * Returns an array of all the <code>PopupMenuListener</code>s added 0N/A * to this JComboBox with addPopupMenuListener(). 0N/A * @return all of the <code>PopupMenuListener</code>s added or an empty 0N/A * array if no listeners have been added 0N/A * Notifies <code>PopupMenuListener</code>s that the popup portion of the 0N/A * combo box will become visible. 0N/A * This method is public but should not be called by anything other than 0N/A * @see #addPopupMenuListener 0N/A * Notifies <code>PopupMenuListener</code>s that the popup portion of the 0N/A * combo box has become invisible. 0N/A * This method is public but should not be called by anything other than 0N/A * @see #addPopupMenuListener 0N/A * Notifies <code>PopupMenuListener</code>s that the popup portion of the 0N/A * combo box has been canceled. 0N/A * This method is public but should not be called by anything other than 0N/A * @see #addPopupMenuListener 0N/A * Sets the action command that should be included in the event 0N/A * sent to action listeners. 0N/A * @param aCommand a string containing the "command" that is sent 0N/A * to action listeners; the same listener can then 0N/A * do different things depending on the command it 0N/A * Returns the action command that is included in the event sent to 0N/A * @return the string containing the "command" that is sent 0N/A * to action listeners. 0N/A * Sets the <code>Action</code> for the <code>ActionEvent</code> source. 0N/A * The new <code>Action</code> replaces any previously set 0N/A * <code>Action</code> but does not affect <code>ActionListeners</code> 0N/A * independently added with <code>addActionListener</code>. 0N/A * If the <code>Action</code> is already a registered 0N/A * <code>ActionListener</code> for the <code>ActionEvent</code> source, 0N/A * it is not re-registered. 0N/A * Setting the <code>Action</code> results in immediately changing 0N/A * all the properties described in <a href="Action.html#buttonActions"> 0N/A * Swing Components Supporting <code>Action</code></a>. 0N/A * Subsequently, the combobox's properties are automatically updated 0N/A * as the <code>Action</code>'s properties change. 0N/A * This method uses three other methods to set 0N/A * and help track the <code>Action</code>'s property values. 0N/A * It uses the <code>configurePropertiesFromAction</code> method 0N/A * to immediately change the combobox's properties. 0N/A * To track changes in the <code>Action</code>'s property values, 0N/A * this method registers the <code>PropertyChangeListener</code> 0N/A * returned by <code>createActionPropertyChangeListener</code>. The 0N/A * default {@code PropertyChangeListener} invokes the 0N/A * {@code actionPropertyChanged} method when a property in the 0N/A * {@code Action} changes. 0N/A * @param a the <code>Action</code> for the <code>JComboBox</code>, 0N/A * or <code>null</code>. 0N/A * @see #configurePropertiesFromAction 0N/A * @see #createActionPropertyChangeListener 0N/A * @see #actionPropertyChanged 0N/A * attribute: visualUpdate true 0N/A * description: the Action instance connected with this ActionEvent source 0N/A // Don't add if it is already a listener 0N/A * Returns the currently set <code>Action</code> for this 0N/A * <code>ActionEvent</code> source, or <code>null</code> if no 0N/A * <code>Action</code> is set. 0N/A * @return the <code>Action</code> for this <code>ActionEvent</code> 0N/A * source; or <code>null</code> 0N/A * Sets the properties on this combobox to match those in the specified 0N/A * Swing Components Supporting <code>Action</code></a> for more 0N/A * details as to which properties this sets. 0N/A * @param a the <code>Action</code> from which to get the properties, 0N/A * or <code>null</code> 0N/A * Creates and returns a <code>PropertyChangeListener</code> that is 0N/A * responsible for listening for changes from the specified 0N/A * <code>Action</code> and updating the appropriate properties. 0N/A * <b>Warning:</b> If you subclass this do not create an anonymous 0N/A * inner class. If you do the lifetime of the combobox will be tied to 0N/A * that of the <code>Action</code>. 0N/A * @param a the combobox's action 0N/A * Updates the combobox's state in response to property changes in 0N/A * associated action. This method is invoked from the 0N/A * {@code PropertyChangeListener} returned from 0N/A * {@code createActionPropertyChangeListener}. Subclasses do not normally 0N/A * need to invoke this. Subclasses that support additional {@code Action} 0N/A * properties should override this and 0N/A * {@code configurePropertiesFromAction}. 0N/A * Swing Components Supporting <code>Action</code></a> for a list of 0N/A * the properties this method sets. 0N/A * @param action the <code>Action</code> associated with this combobox 0N/A * @param propertyName the name of the property that changed 0N/A * @see #configurePropertiesFromAction 0N/A * Notifies all listeners that have registered interest for 0N/A * notification on this event type. 0N/A * @param e the event of interest 0N/A * @see EventListenerList 0N/A // Guaranteed to return a non-null array 0N/A // Process the listeners last to first, notifying 0N/A // those that are interested in this event 0N/A // Lazily create the event: 0N/A // if (changeEvent == null) 0N/A // changeEvent = new ChangeEvent(this); 0N/A * Notifies all listeners that have registered interest for 0N/A * notification on this event type. 0N/A * @see EventListenerList 0N/A // Set flag to ensure that an infinite loop is not created 0N/A // Guaranteed to return a non-null array 0N/A // Process the listeners last to first, notifying 0N/A // those that are interested in this event 0N/A // Lazily create the event: 0N/A * This protected method is implementation specific. Do not access directly 0N/A // set the new selected item. 0N/A * Returns an array containing the selected item. 0N/A * This method is implemented for compatibility with 0N/A * <code>ItemSelectable</code>. 0N/A * @return an array of <code>Objects</code> containing one 0N/A * element -- the selected item 0N/A * This method is public as an implementation side effect. 0N/A * do not call or override. 0N/A * This method is public as an implementation side effect. 0N/A * do not call or override. 0N/A * This method is public as an implementation side effect. 0N/A * do not call or override. 0N/A * This method is public as an implementation side effect. 0N/A * do not call or override. 0N/A * Selects the list item that corresponds to the specified keyboard 0N/A * character and returns true, if there is an item corresponding 0N/A * to that character. Otherwise, returns false. 0N/A * @param keyChar a char, typically this is a keyboard key 0N/A * Enables the combo box so that items can be selected. When the 0N/A * combo box is disabled, items cannot be selected and values 0N/A * cannot be typed into its field (if it is editable). 0N/A * @param b a boolean value, where true enables the component and 0N/A * description: Whether the combo box is enabled. 0N/A * Initializes the editor with the specified item. 0N/A * @param anEditor the <code>ComboBoxEditor</code> that displays 0N/A * the list item in the 0N/A * combo box field and allows it to be edited 0N/A * @param anItem the object to display and edit in the field 0N/A * Handles <code>KeyEvent</code>s, looking for the Tab key. 0N/A * If the Tab key is found, the popup window is closed. 0N/A * @param e the <code>KeyEvent</code> containing the keyboard 0N/A * key that was pressed 0N/A * Sets the object that translates a keyboard character into a list 0N/A * selection. Typically, the first selection with a matching first 0N/A * character becomes the selected item. 0N/A * description: The objects that changes the selection when a key is pressed. 0N/A * Returns the list's key-selection manager. 0N/A * @return the <code>KeySelectionManager</code> currently in use 0N/A /* Accessing the model */ 0N/A * Returns the number of items in the list. 0N/A * @return an integer equal to the number of items in the list 0N/A * Returns the list item at the specified index. If <code>index</code> 0N/A * is out of range (less than zero or greater than or equal to size) 0N/A * it will return <code>null</code>. 0N/A * @param index an integer indicating the list position, where the first 0N/A * item starts at zero 4202N/A * @return the item at that list position; or 0N/A * <code>null</code> if out of range 0N/A * Returns an instance of the default key-selection manager. 0N/A * @return the <code>KeySelectionManager</code> currently used by the list 0N/A * @see #setKeySelectionManager 0N/A * The interface that defines a <code>KeySelectionManager</code>. 0N/A * To qualify as a <code>KeySelectionManager</code>, 0N/A * the class needs to implement the method 0N/A * that identifies the list index given a character and the 0N/A * combo box data model. 0N/A /** Given <code>aKey</code> and the model, returns the row 0N/A * that should become selected. Return -1 if no match was 0N/A * @param aKey a char value, usually indicating a keyboard key that 0N/A * @param aModel a ComboBoxModel -- the component's data model, containing 0N/A * the list of selectable items 0N/A * @return an int equal to the selected row, where 0 is the 0N/A * first item and -1 is none. 0N/A * See <code>readObject</code> and <code>writeObject</code> in 0N/A * <code>JComponent</code> for more 0N/A * information about serialization in Swing. 0N/A * Returns a string representation of this <code>JComboBox</code>. 0N/A * This method is intended to be used only for debugging purposes, 0N/A * and the content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not 0N/A * be <code>null</code>. 0N/A * @return a string representation of this <code>JComboBox</code> 0N/A// Accessibility support 0N/A * Gets the AccessibleContext associated with this JComboBox. 0N/A * For combo boxes, the AccessibleContext takes the form of an 0N/A * AccessibleJComboBox. 0N/A * A new AccessibleJComboBox instance is created if necessary. 0N/A * @return an AccessibleJComboBox that serves as the 0N/A * AccessibleContext of this JComboBox 0N/A * This class implements accessibility support for the 0N/A * <code>JComboBox</code> class. It provides an implementation of the 0N/A * Java Accessibility API appropriate to Combo Box user-interface elements. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * Returns an AccessibleJComboBox instance 0N/A // set the combo box editor's accessible name and description 0N/A // Get the popup list 0N/A // Listen for changes to the popup menu selection. 0N/A * JComboBox PropertyChangeListener 0N/A // set the combo box editor's accessible name 0N/A * Sets the combo box editor's accessible name and descripton 0N/A * Listener for combo box popup menu 0N/A * TIGER - 4669379 4894434 0N/A * This method is called before the popup menu becomes visible 0N/A // save the initial selection 0N/A * This method is called before the popup menu becomes invisible 0N/A * Note that a JPopupMenu can become invisible any time 0N/A * This method is called when the popup menu is canceled 0N/A * Handles changes to the popup list selection. 0N/A * TIGER - 4669379 4894434 4933143 0N/A // Get the selected popup list item. 0N/A // Fire a FOCUSED lost PropertyChangeEvent for the 0N/A // previously selected list item. 0N/A // Fire a FOCUSED gained PropertyChangeEvent for the 0N/A // currently selected list item. 0N/A // Fire the ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY event 0N/A // for the combo box. 0N/A // Save the previous selection. 0N/A * Returns the number of accessible children in the object. If all 0N/A * of the children of this object implement Accessible, than this 0N/A * method should return the number of children of this object. 0N/A * @return the number of accessible children in the object. 0N/A // Always delegate to the UI if it exists 0N/A * Returns the nth Accessible child of the object. 0N/A * The child at index zero represents the popup. 0N/A * If the combo box is editable, the child at index one 0N/A * represents the editor. 0N/A * @param i zero-based index of child 0N/A * @return the nth Accessible child of the object 0N/A // Always delegate to the UI if it exists 0N/A * Get the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the 0N/A * @see AccessibleRole 0N/A * Gets the state set of this object. The AccessibleStateSet of 0N/A * an object is composed of a set of unique AccessibleStates. 0N/A * A change in the AccessibleStateSet of an object will cause a 0N/A * PropertyChangeEvent to be fired for the ACCESSIBLE_STATE_PROPERTY 0N/A * @return an instance of AccessibleStateSet containing the 0N/A * current state set of the object 0N/A * @see AccessibleStateSet 0N/A * @see AccessibleState 0N/A * @see #addPropertyChangeListener 0N/A * Get the AccessibleAction associated with this object. In the 0N/A * implementation of the Java Accessibility API for this class, 0N/A * return this object, which is responsible for implementing the 0N/A * AccessibleAction interface on behalf of itself. 0N/A * @return this object 0N/A * Return a description of the specified action of the object. 0N/A * @param i zero-based index of the actions 0N/A * Returns the number of Actions available in this object. The 0N/A * default behavior of a combo box is to have one action. 0N/A * @return 1, the number of Actions in this object 0N/A * Perform the specified Action on the object 0N/A * @param i zero-based index of actions 0N/A * @return true if the the action was performed; else false. 0N/A * Get the AccessibleSelection associated with this object. In the 0N/A * implementation of the Java Accessibility API for this class, 0N/A * return this object, which is responsible for implementing the 0N/A * AccessibleSelection interface on behalf of itself. 0N/A * @return this object 0N/A * Returns the number of Accessible children currently selected. 0N/A * If no children are selected, the return value will be 0. 0N/A * @return the number of items currently selected. 0N/A * Returns an Accessible representing the specified selected child 0N/A * in the popup. If there isn't a selection, or there are 0N/A * fewer children selected than the integer passed in, the return 0N/A * value will be null. 0N/A * <p>Note that the index represents the i-th selected child, which 0N/A * is different from the i-th child. 0N/A * @param i the zero-based index of selected children 0N/A * @return the i-th selected child 0N/A * @see #getAccessibleSelectionCount 0N/A // get the popup list 0N/A // return the i-th selection in the popup list 0N/A * Determines if the current child of this object is selected. 0N/A * @return true if the current child of this object is selected; 0N/A * @param i the zero-based index of the child in this Accessible 0N/A * @see AccessibleContext#getAccessibleChild 0N/A * Adds the specified Accessible child of the object to the object's 0N/A * selection. If the object supports multiple selections, 0N/A * the specified child is added to any existing selection, otherwise 0N/A * it replaces any existing selection in the object. If the 0N/A * specified child is already selected, this method has no effect. 0N/A * @param i the zero-based index of the child 0N/A * @see AccessibleContext#getAccessibleChild 0N/A * Removes the specified child of the object from the object's 0N/A * selection. If the specified item isn't currently selected, this 0N/A * method has no effect. 0N/A * @param i the zero-based index of the child 0N/A * @see AccessibleContext#getAccessibleChild 0N/A * Clears the selection in the object, so that no children in the 0N/A * object are selected. 0N/A * Causes every child of the object to be selected 0N/A * if the object supports multiple selections. 0N/A // do nothing since multiple selection is not supported 0N/A// public Accessible getAccessibleAt(Point p) { 0N/A// Accessible a = getAccessibleChild(1); 0N/A// if ( a != null ) { 0N/A// return a; // the editor 0N/A// return getAccessibleChild(0); // the list 0N/A * Wrapper class for the AccessibleContext implemented by the 0N/A * combo box editor. Delegates all method calls except 0N/A * getAccessibleIndexInParent to the editor. The 0N/A * getAccessibleIndexInParent method returns the selected 0N/A * index in the combo box. 0N/A * @param a the AccessibleContext implemented by the 0N/A * Gets the accessibleName property of this object. The accessibleName 0N/A * property of an object is a localized String that designates the purpose 0N/A * of the object. For example, the accessibleName property of a label 0N/A * or button might be the text of the label or button itself. In the 0N/A * case of an object that doesn't display its name, the accessibleName 0N/A * should still be set. For example, in the case of a text field used 0N/A * to enter the name of a city, the accessibleName for the en_US locale 0N/A * @return the localized name of the object; null if this 0N/A * object does not have a name 0N/A * @see #setAccessibleName 0N/A * Sets the localized accessible name of this object. Changing the 0N/A * name will cause a PropertyChangeEvent to be fired for the 0N/A * ACCESSIBLE_NAME_PROPERTY property. 0N/A * @param s the new localized name of the object. 0N/A * @see #getAccessibleName 0N/A * @see #addPropertyChangeListener 0N/A * description: Sets the accessible name for the component. 0N/A * Gets the accessibleDescription property of this object. The 0N/A * accessibleDescription property of this object is a short localized 0N/A * phrase describing the purpose of the object. For example, in the 0N/A * case of a 'Cancel' button, the accessibleDescription could be 0N/A * 'Ignore changes and close dialog box.' 0N/A * @return the localized description of the object; null if 0N/A * this object does not have a description 0N/A * @see #setAccessibleDescription 0N/A * Sets the accessible description of this object. Changing the 0N/A * name will cause a PropertyChangeEvent to be fired for the 0N/A * ACCESSIBLE_DESCRIPTION_PROPERTY property. 0N/A * @param s the new localized description of the object 0N/A * @see #setAccessibleName 0N/A * @see #addPropertyChangeListener 0N/A * description: Sets the accessible description for the component. 0N/A * Gets the role of this object. The role of the object is the generic 0N/A * purpose or use of the class of this object. For example, the role 0N/A * of a push button is AccessibleRole.PUSH_BUTTON. The roles in 0N/A * AccessibleRole are provided so component developers can pick from 0N/A * a set of predefined roles. This enables assistive technologies to 0N/A * provide a consistent interface to various tweaked subclasses of 0N/A * components (e.g., use AccessibleRole.PUSH_BUTTON for all components 0N/A * that act like a push button) as well as distinguish between sublasses 0N/A * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes 0N/A * and AccessibleRole.RADIO_BUTTON for radio buttons). 0N/A * <p>Note that the AccessibleRole class is also extensible, so 0N/A * custom component developers can define their own AccessibleRole's 0N/A * if the set of predefined roles is inadequate. 0N/A * @return an instance of AccessibleRole describing the role of the object 0N/A * @see AccessibleRole 0N/A * Gets the state set of this object. The AccessibleStateSet of an object 0N/A * is composed of a set of unique AccessibleStates. A change in the 0N/A * AccessibleStateSet of an object will cause a PropertyChangeEvent to 0N/A * be fired for the ACCESSIBLE_STATE_PROPERTY property. 0N/A * @return an instance of AccessibleStateSet containing the 0N/A * current state set of the object 0N/A * @see AccessibleStateSet 0N/A * @see AccessibleState 0N/A * @see #addPropertyChangeListener 0N/A * Gets the Accessible parent of this object. 0N/A * @return the Accessible parent of this object; null if this 0N/A * object does not have an Accessible parent 0N/A * Sets the Accessible parent of this object. This is meant to be used 0N/A * only in the situations where the actual component's parent should 0N/A * not be treated as the component's accessible parent and is a method 0N/A * that should only be called by the parent of the accessible child. 0N/A * @param a - Accessible to be set as the parent 0N/A * Gets the 0-based index of this object in its accessible parent. 0N/A * @return the 0-based index of this object in its parent; -1 if this 0N/A * object does not have an accessible parent. 0N/A * @see #getAccessibleParent 0N/A * @see #getAccessibleChildrenCount 0N/A * @see #getAccessibleChild 0N/A * Returns the number of accessible children of the object. 0N/A * @return the number of accessible children of the object. 0N/A * Returns the specified Accessible child of the object. The Accessible 0N/A * children of an Accessible object are zero-based, so the first child 0N/A * of an Accessible child is at index 0, the second child is at index 1, 0N/A * @param i zero-based index of child 0N/A * @return the Accessible child of the object 0N/A * @see #getAccessibleChildrenCount 0N/A * Gets the locale of the component. If the component does not have a 0N/A * locale, then the locale of its parent is returned. 0N/A * @return this component's locale. If this component does not have 0N/A * a locale, the locale of its parent is returned. 0N/A * @exception IllegalComponentStateException 0N/A * If the Component does not have its own locale and has not yet been 0N/A * added to a containment hierarchy such that the locale can be 0N/A * determined from the containing parent. 0N/A * Adds a PropertyChangeListener to the listener list. 0N/A * The listener is registered for all Accessible properties and will 0N/A * be called when those properties change. 0N/A * @see #ACCESSIBLE_NAME_PROPERTY 0N/A * @see #ACCESSIBLE_DESCRIPTION_PROPERTY 0N/A * @see #ACCESSIBLE_STATE_PROPERTY 0N/A * @see #ACCESSIBLE_VALUE_PROPERTY 0N/A * @see #ACCESSIBLE_SELECTION_PROPERTY 0N/A * @see #ACCESSIBLE_TEXT_PROPERTY 0N/A * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY 0N/A * @param listener The PropertyChangeListener to be added 0N/A * Removes a PropertyChangeListener from the listener list. 0N/A * This removes a PropertyChangeListener that was registered 0N/A * for all properties. 0N/A * @param listener The PropertyChangeListener to be removed 0N/A * Gets the AccessibleAction associated with this object that supports 0N/A * one or more actions. 0N/A * @return AccessibleAction if supported by object; else return null 0N/A * @see AccessibleAction 0N/A * Gets the AccessibleComponent associated with this object that has a 0N/A * graphical representation. 0N/A * @return AccessibleComponent if supported by object; else return null 0N/A * @see AccessibleComponent 0N/A * Gets the AccessibleSelection associated with this object which allows its 0N/A * Accessible children to be selected. 0N/A * @return AccessibleSelection if supported by object; else return null 0N/A * @see AccessibleSelection 0N/A * Gets the AccessibleText associated with this object presenting 0N/A * text on the display. 0N/A * @return AccessibleText if supported by object; else return null 0N/A * @see AccessibleText 0N/A * Gets the AccessibleEditableText associated with this object 0N/A * presenting editable text on the display. 0N/A * @return AccessibleEditableText if supported by object; else return null 0N/A * @see AccessibleEditableText 0N/A * Gets the AccessibleValue associated with this object that supports a 0N/A * @return AccessibleValue if supported by object; else return null 0N/A * @see AccessibleValue 0N/A * Gets the AccessibleIcons associated with an object that has 0N/A * one or more associated icons 0N/A * @return an array of AccessibleIcon if supported by object; 0N/A * otherwise return null 0N/A * @see AccessibleIcon 0N/A * Gets the AccessibleRelationSet associated with an object 0N/A * @return an AccessibleRelationSet if supported by object; 0N/A * otherwise return null 0N/A * @see AccessibleRelationSet 0N/A * Gets the AccessibleTable associated with an object 0N/A * @return an AccessibleTable if supported by object; 0N/A * otherwise return null 0N/A * @see AccessibleTable 0N/A * Support for reporting bound property changes. If oldValue and 0N/A * newValue are not equal and the PropertyChangeEvent listener list 0N/A * is not empty, then fire a PropertyChange event to each listener. 0N/A * In general, this is for use by the Accessible objects themselves 0N/A * and should not be called by an application program. 0N/A * @param propertyName The programmatic name of the property that 0N/A * @param oldValue The old value of the property. 0N/A * @param newValue The new value of the property. 0N/A * @see java.beans.PropertyChangeSupport 0N/A * @see #addPropertyChangeListener 0N/A * @see #removePropertyChangeListener 0N/A * @see #ACCESSIBLE_NAME_PROPERTY 0N/A * @see #ACCESSIBLE_DESCRIPTION_PROPERTY 0N/A * @see #ACCESSIBLE_STATE_PROPERTY 0N/A * @see #ACCESSIBLE_VALUE_PROPERTY 0N/A * @see #ACCESSIBLE_SELECTION_PROPERTY 0N/A * @see #ACCESSIBLE_TEXT_PROPERTY 0N/A * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY 0N/A }
// innerclass AccessibleJComboBox