2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
41 import java
.awt
.ItemSelectable
;
42 import java
.awt
.event
.ActionEvent
;
43 import java
.awt
.event
.ActionListener
;
44 import java
.awt
.event
.ItemEvent
;
45 import java
.awt
.event
.ItemListener
;
46 import java
.awt
.event
.KeyEvent
;
47 import java
.beans
.PropertyChangeListener
;
48 import java
.io
.IOException
;
49 import java
.io
.ObjectOutputStream
;
50 import java
.util
.Vector
;
52 import javax
.accessibility
.Accessible
;
53 import javax
.accessibility
.AccessibleAction
;
54 import javax
.accessibility
.AccessibleContext
;
55 import javax
.accessibility
.AccessibleRole
;
56 import javax
.accessibility
.AccessibleSelection
;
57 import javax
.swing
.event
.ListDataEvent
;
58 import javax
.swing
.event
.ListDataListener
;
59 import javax
.swing
.event
.PopupMenuListener
;
60 import javax
.swing
.plaf
.ComboBoxUI
;
64 * @author Andrew Selkirk
67 public class JComboBox
extends JComponent
68 implements ItemSelectable
, ListDataListener
, ActionListener
, Accessible
70 private static final long serialVersionUID
= 5654585963292734470L;
75 protected class AccessibleJComboBox
extends AccessibleJComponent
76 implements AccessibleAction
, AccessibleSelection
78 private static final long serialVersionUID
= 8217828307256675666L;
81 * Constructor AccessibleJComboBox
82 * @param component TODO
84 protected AccessibleJComboBox()
89 * getAccessibleChildrenCount
92 public int getAccessibleChildrenCount() {
94 } // getAccessibleChildrenCount()
101 public Accessible
getAccessibleChild(int value0
) {
103 } // getAccessibleChild()
106 * getAccessibleSelection
107 * @returns AccessibleSelection
109 public AccessibleSelection
getAccessibleSelection() {
111 } // getAccessibleSelection()
114 * getAccessibleSelection
116 * @returns Accessible
118 public Accessible
getAccessibleSelection(int value0
) {
120 } // getAccessibleSelection()
123 * isAccessibleChildSelected
127 public boolean isAccessibleChildSelected(int value0
) {
128 return false; // TODO
129 } // isAccessibleChildSelected()
133 * @returns AccessibleRole
135 public AccessibleRole
getAccessibleRole() {
136 return AccessibleRole
.COMBO_BOX
;
137 } // getAccessibleRole()
140 * getAccessibleAction
141 * @returns AccessibleAction
143 public AccessibleAction
getAccessibleAction() {
145 } // getAccessibleAction()
148 * getAccessibleActionDescription
152 public String
getAccessibleActionDescription(int value0
) {
154 } // getAccessibleActionDescription()
157 * getAccessibleActionCount
160 public int getAccessibleActionCount() {
162 } // getAccessibleActionCount()
169 public boolean doAccessibleAction(int value0
) {
170 return false; // TODO
171 } // doAccessibleAction()
174 * getAccessibleSelectionCount
177 public int getAccessibleSelectionCount() {
179 } // getAccessibleSelectionCount()
182 * addAccessibleSelection
185 public void addAccessibleSelection(int value0
) {
187 } // addAccessibleSelection()
190 * removeAccessibleSelection
193 public void removeAccessibleSelection(int value0
) {
195 } // removeAccessibleSelection()
198 * clearAccessibleSelection
200 public void clearAccessibleSelection() {
202 } // clearAccessibleSelection()
205 * selectAllAccessibleSelection
207 public void selectAllAccessibleSelection() {
209 } // selectAllAccessibleSelection()
212 } // AccessibleJComboBox
215 * KeySelectionManager
217 public static interface KeySelectionManager
{
219 //-------------------------------------------------------------
220 // Methods ----------------------------------------------------
221 //-------------------------------------------------------------
229 int selectionForKey(char value0
, ComboBoxModel value1
);
232 } // KeySelectionManager
235 //-------------------------------------------------------------
236 // Variables --------------------------------------------------
237 //-------------------------------------------------------------
242 private static final String uiClassID
= "ComboBoxUI";
247 protected ComboBoxModel dataModel
;
252 protected ListCellRenderer renderer
;
257 protected ComboBoxEditor editor
;
262 protected int maximumRowCount
;
267 protected boolean isEditable
;
270 * selectedItemReminder
272 protected Object selectedItemReminder
;
275 * keySelectionManager
277 protected JComboBox
.KeySelectionManager keySelectionManager
;
282 protected String actionCommand
;
285 * lightWeightPopupEnabled
287 protected boolean lightWeightPopupEnabled
;
290 //-------------------------------------------------------------
291 // Initialization ---------------------------------------------
292 //-------------------------------------------------------------
295 * Constructor JComboBox
298 public JComboBox(ComboBoxModel value0
) {
303 * Constructor JComboBox
306 public JComboBox(Object
[] value0
) {
311 * Constructor JComboBox
314 public JComboBox(Vector value0
) {
319 * Constructor JComboBox
326 //-------------------------------------------------------------
327 // Methods ----------------------------------------------------
328 //-------------------------------------------------------------
333 * @exception IOException TODO
335 private void writeObject(ObjectOutputStream stream
) throws IOException
{
343 public boolean isEditable() {
344 return false; // TODO
348 * installAncestorListener
350 protected void installAncestorListener() {
352 } // installAncestorListener()
358 public void setUI(ComboBoxUI ui
) {
365 public void updateUI() {
366 setUI((ComboBoxUI
) UIManager
.get(this));
374 public String
getUIClassID() {
380 * @returns ComboBoxUI
382 public ComboBoxUI
getUI() {
383 return (ComboBoxUI
) ui
;
390 public void setModel(ComboBoxModel value0
) {
396 * @returns ComboBoxModel
398 public ComboBoxModel
getModel() {
403 * setLightWeightPopupEnabled
406 public void setLightWeightPopupEnabled(boolean value0
) {
408 } // setLightWeightPopupEnabled()
411 * isLightWeightPopupEnabled
414 public boolean isLightWeightPopupEnabled() {
415 return false; // TODO
416 } // isLightWeightPopupEnabled()
422 public void setEditable(boolean value0
) {
430 public void setMaximumRowCount(int value0
) {
432 } // setMaximumRowCount()
438 public int getMaximumRowCount() {
440 } // getMaximumRowCount()
446 public void setRenderer(ListCellRenderer value0
) {
452 * @returns ListCellRenderer
454 public ListCellRenderer
getRenderer() {
462 public void setEditor(ComboBoxEditor value0
) {
468 * @returns ComboBoxEditor
470 public ComboBoxEditor
getEditor() {
478 public void setSelectedItem(Object value0
) {
480 } // setSelectedItem()
486 public Object
getSelectedItem() {
488 } // getSelectedItem()
494 public void setSelectedIndex(int value0
) {
496 } // setSelectedIndex()
502 public int getSelectedIndex() {
504 } // getSelectedIndex()
510 public void addItem(Object value0
) {
519 public void insertItemAt(Object value0
, int value1
) {
527 public void removeItem(Object value0
) {
535 public void removeItemAt(int value0
) {
542 public void removeAllItems() {
544 } // removeAllItems()
549 public void showPopup() {
556 public void hidePopup() {
564 public void setPopupVisible(boolean value0
) {
566 } // setPopupVisible()
572 public boolean isPopupVisible() {
573 return false; // TODO
574 } // isPopupVisible()
580 public void setActionCommand(String value0
) {
582 } // setActionCommand()
588 public String
getActionCommand() {
590 } // getActionCommand()
596 public void setAction(Action value0
) {
606 private boolean isListener(Class value0
, ActionListener value1
) {
607 return false; // TODO
614 public Action
getAction() {
619 * configurePropertiesFromAction
622 protected void configurePropertiesFromAction(Action value0
) {
624 } // configurePropertiesFromAction()
627 * createActionPropertyChangeListener
629 * @returns PropertyChangeListener
631 protected PropertyChangeListener
createActionPropertyChangeListener(Action value0
) {
633 } // createActionPropertyChangeListener()
636 * fireItemStateChanged
639 protected void fireItemStateChanged(ItemEvent value0
) {
641 } // fireItemStateChanged()
646 protected void fireActionEvent() {
648 } // fireActionEvent()
651 * selectedItemChanged
653 protected void selectedItemChanged() {
655 } // selectedItemChanged()
661 public Object
[] getSelectedObjects() {
663 } // getSelectedObjects()
669 public void actionPerformed(ActionEvent value0
) {
671 } // actionPerformed()
677 public void contentsChanged(ListDataEvent value0
) {
679 } // contentsChanged()
686 public boolean selectWithKeyChar(char value0
) {
687 return false; // TODO
688 } // selectWithKeyChar()
694 public void intervalAdded(ListDataEvent value0
) {
702 public void intervalRemoved(ListDataEvent value0
) {
704 } // intervalRemoved()
710 public void setEnabled(boolean value0
) {
719 public void configureEditor(ComboBoxEditor value0
, Object value1
) {
721 } // configureEditor()
727 public void processKeyEvent(KeyEvent value0
) {
729 } // processKeyEvent()
736 public boolean isFocusTraversable() {
737 return false; // TODO
738 } // isFocusTraversable()
741 * setKeySelectionManager
744 public void setKeySelectionManager(KeySelectionManager value0
) {
746 } // setKeySelectionManager()
749 * getKeySelectionManager
750 * @returns JComboBox.KeySelectionManager
752 public JComboBox
.KeySelectionManager
getKeySelectionManager() {
754 } // getKeySelectionManager()
760 public int getItemCount() {
769 public Object
getItemAt(int value0
) {
774 * createDefaultKeySelectionManager
775 * @returns KeySelectionManager
777 protected KeySelectionManager
createDefaultKeySelectionManager() {
779 } // createDefaultKeySelectionManager()
785 protected String
paramString() {
790 * getAccessibleContext
791 * @returns AccessibleContext
793 public AccessibleContext
getAccessibleContext()
795 if (accessibleContext
== null)
796 accessibleContext
= new AccessibleJComboBox();
798 return accessibleContext
;
803 * @param listener TODO
805 public void addActionListener (ActionListener listener
)
807 listenerList
.add (ActionListener
.class, listener
);
811 * removeActionListener
812 * @param listener TODO
814 public void removeActionListener (ActionListener listener
)
816 listenerList
.remove (ActionListener
.class, listener
);
822 public ActionListener
[] getActionListeners()
824 return (ActionListener
[]) getListeners (ActionListener
.class);
829 * @param listener TODO
831 public void addItemListener(ItemListener listener
)
833 listenerList
.add (ItemListener
.class, listener
);
838 * @param listener TODO
840 public void removeItemListener(ItemListener listener
)
842 listenerList
.remove (ItemListener
.class, listener
);
848 public ItemListener
[] getItemListeners()
850 return (ItemListener
[]) getListeners (ItemListener
.class);
853 public void addPopupMenuListener (PopupMenuListener listener
)
855 listenerList
.add (PopupMenuListener
.class, listener
);
858 public void removePopupMenuListener (PopupMenuListener listener
)
860 listenerList
.remove (PopupMenuListener
.class, listener
);
866 public PopupMenuListener
[] getPopupMenuListeners()
868 return (PopupMenuListener
[]) getListeners (PopupMenuListener
.class);