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


Constructor Index

 o JChoice()
Constructs a new Choice.

Method Index

 o add(String)
Adds an item to this Choice.
 o addItem(String)
Adds an item to this Choice.
 o addItemListener(ItemListener)
Adds the specified item listener to recieve item events from this choice.
 o getItem(int)
Returns the String at the specified index in the Choice.
 o getItemCount()
Returns the number of items in this Choice.
 o getSelectedIndex()
Returns the index of the currently selected item.
 o getSelectedItem()
Returns a String representation of the current choice.
 o getSelectedObjects()
Returns an array (length 1) containing the currently selected item.
 o insert(String, int)
Inserts the item into this choice at the specified position.
 o paramString()
Returns the parameter String of this Choice.
 o remove(int)
Removes an item from the choice menu.
 o remove(String)
Remove the first occurrence of item from the choice menu.
 o removeAll()
Removes all items from the choice menu.
 o removeItemListener(ItemListener)
Removes the specified item listener so that it no longer receives item events from this choice.
 o select(int)
Selects the item with the specified postion.
 o select(String)
Selects the item with the specified String.

Constructors

 o JChoice
 public JChoice()
Constructs a new Choice.

Methods

 o getItemCount
 public int getItemCount()
Returns the number of items in this Choice.

See Also:
getItem
 o 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
 o 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.
 o 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.
 o 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.
 o 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.
 o remove
 public synchronized void remove(int position)
Removes an item from the choice menu.

Overrides:
remove in class Container
 o removeAll
 public synchronized void removeAll()
Removes all items from the choice menu.

Overrides:
removeAll in class Container
See Also:
remove
 o getSelectedItem
 public synchronized String getSelectedItem()
Returns a String representation of the current choice.

See Also:
getSelectedIndex
 o 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
 o getSelectedIndex
 public int getSelectedIndex()
Returns the index of the currently selected item.

See Also:
getSelectedItem
 o 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
 o select
 public synchronized void select(String str)
Selects the item with the specified String.

Parameters:
str - the specified String
See Also:
getSelectedItem, getSelectedIndex
 o 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
 o 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
 o 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