Choice Class in awt
Choice class: This class is used to draw a drop down list box. The
drop down list box contains a list of items and it shows or display only a
single item from the list.
1. add(): This
method is used to add an item to the drop down list box or the Choice classobject.
The
general form is ,void
add(String s) where
, s is the item which you want to add to the Choice control.
2. insert() This
method is used to insert the item in the choice list at the particular index
position.
The
general form is insert(String
s,int index) where
, s is
the string which we want to insert index
is the index position
3. getItem() This
method is used to return the string present at the particular index position.
The
general form is , String
getItem(int index) where
, index
specify the particular index position
4. getSelectedIndex() The
method will return the index of the selected item The
general form is int
getSelectectedIndex();
5. getSelectedItem() This method will return the selected item The
general form is ,
String
getSelectedItem();
6. remove() This
method is used to remove the item at the particular index position.
The
general form is , void
remove(int index)
where
,index
specify the index of the item which we want remove.
7. removeAll() This
method will remove all the items from the Choice control.
The
general form is ,
void
removeAll();
8. select(int i) The
method will select the item present at the particular index position.
The
general form is ,
void
select(int index)
where
, index
will specify the index of the item which we
want to select.
9. select(String) This
method will select the item which match with the specified string.
The
general form is , void
select(String s)
where
,s
specify the search or the match string
10. addItemListener() This
method is used to register the Choice control to receive the click events.
The
general form is ,void
addItemListener(ItemListener obj)
11.
removeItemListener() This method is
used to unregister the Choice control to
receive the click events. The general form is ,
void removeItemListener()
Comments
Post a Comment