Monday, June 15, 2015

DEVOLOPING CHOICE COMPONENT IN APPLETS IN JAVA

DEVOLOPING CHOICE COMPONENT IN APPLETS

CHOICE:

Choice is the GUI component which allows us to add ‘n’ number of items. This component  allows selecting a single item at a time. Creating a choice component is nothing but creating an object of Choice class.

Choice API:

Constructors:
choice ();
Instance methods:
public void add (String); 1
public void addItem (String); 2
public void add (int pos, String); 3
public void addItem (int pos, String); 4
public String getSelectedItem (); 5
public int getSelectedIndex (); 6
public void remove (String); 7
public void remove (int); 8
public void removeAll (); 9
public void addItemListener (ItemListener); 10
public void removeItemListener (ItemListener); 11

• Methods 1 and 2 are used for adding items to the choice component at end.
• Methods 3 and 4 are used for adding the items at the specified position.
Methods 5 and 6 are used for obtaining the items either based on its name or on its index.
• Methods 7 and 8 are used for removing the item of the choice component either based on its
name or on its index (position).
• Method 9 is used for removing all the items of choice components.
• Methods 10 and 11 are used for registering and unregistering the events of choice components

My Blog List

Powered by Blogger.

 

© 2013 Java Tutorials. All rights resevered. Designed by Templateism

Back To Top