All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.JChoice
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----com.sun.java.swing.JComponent
|
+----com.sun.java.swing.JComboBox
|
+----com.sun.java.swing.JChoice
- public class JChoice
- extends JComboBox
JChoice. A class that provides backward compatibility with java.awt.Choice
-
JChoice()
-
Constructs a new Choice.
-
add(String)
- Adds an item to this Choice.
-
addItem(String)
- Adds an item to this Choice.
-
addItemListener(ItemListener)
- Adds the specified item listener to recieve item events from
this choice.
-
getItem(int)
- Returns the String at the specified index in the Choice.
-
getItemCount()
- Returns the number of items in this Choice.
-
getSelectedIndex()
- Returns the index of the currently selected item.
-
getSelectedItem()
- Returns a String representation of the current choice.
-
getSelectedObjects()
- Returns an array (length 1) containing the currently selected
item.
-
insert(String, int)
- Inserts the item into this choice at the specified position.
-
paramString()
- Returns the parameter String of this Choice.
-
remove(int)
- Removes an item from the choice menu.
-
remove(String)
- Remove the first occurrence of item from the choice menu.
-
removeAll()
- Removes all items from the choice menu.
-
removeItemListener(ItemListener)
- Removes the specified item listener so that it no longer
receives item events from this choice.
-
select(int)
- Selects the item with the specified postion.
-
select(String)
- Selects the item with the specified String.
JChoice
public JChoice()
- Constructs a new Choice.
getItemCount
public int getItemCount()
- Returns the number of items in this Choice.
- See Also:
- getItem
getItem
public String getItem(int index)
- Returns the String at the specified index in the Choice.
- Parameters:
- index - the index at which to begin
- See Also:
- getItemCount
add
public synchronized void add(String item)
- Adds an item to this Choice.
- Parameters:
- item - the item to be added
- Throws: NullPointerException
- If the item's value is equal to null.
addItem
public synchronized void addItem(String item)
- Adds an item to this Choice.
- Parameters:
- item - the item to be added
- Throws: NullPointerException
- If the item's value is equal to null.
insert
public synchronized void insert(String item,
int index)
- Inserts the item into this choice at the specified position.
- Parameters:
- item - the item to be inserted
- index - the position at which the item should be inserted
- Throws: IllegalArgumentException
- if index is less than 0.
remove
public synchronized void remove(String item)
- Remove the first occurrence of item from the choice menu.
- Parameters:
- item - the item to remove from the choice menu
- Throws: IllegalArgumentException
- If the item doesn't exist in the choice menu.
remove
public synchronized void remove(int position)
- Removes an item from the choice menu.
- Overrides:
- remove in class Container
removeAll
public synchronized void removeAll()
- Removes all items from the choice menu.
- Overrides:
- removeAll in class Container
- See Also:
- remove
getSelectedItem
public synchronized String getSelectedItem()
- Returns a String representation of the current choice.
- See Also:
- getSelectedIndex
getSelectedObjects
public synchronized Object[] getSelectedObjects()
- Returns an array (length 1) containing the currently selected
item. If this choice has no items, returns null.
- Overrides:
- getSelectedObjects in class JComboBox
- See Also:
- ItemSelectable
getSelectedIndex
public int getSelectedIndex()
- Returns the index of the currently selected item.
- See Also:
- getSelectedItem
select
public synchronized void select(int pos)
- Selects the item with the specified postion.
- Parameters:
- pos - the choice item position
- Throws: IllegalArgumentException
- If the choice item position is
invalid.
- See Also:
- getSelectedItem, getSelectedIndex
select
public synchronized void select(String str)
- Selects the item with the specified String.
- Parameters:
- str - the specified String
- See Also:
- getSelectedItem, getSelectedIndex
addItemListener
public synchronized void addItemListener(ItemListener l)
- Adds the specified item listener to recieve item events from
this choice.
- Parameters:
- l - the item listener
- Overrides:
- addItemListener in class JComboBox
removeItemListener
public synchronized void removeItemListener(ItemListener l)
- Removes the specified item listener so that it no longer
receives item events from this choice.
- Parameters:
- l - the item listener
- Overrides:
- removeItemListener in class JComboBox
paramString
protected String paramString()
- Returns the parameter String of this Choice.
- Overrides:
- paramString in class Container
All Packages Class Hierarchy This Package Previous Next Index