Monday 26 March 2012

User Interface Components

•Following are the various user interface components:
1.Labels
2.Buttons
3.Check Box
4.Checkbox Group (Radio Buttons)
5.Choice (Drop down box)
6.List Box
7.Scrollbars
8.TextField
9.TextArea

Label:
•A label is used to display static data.
•Labels are objects of the class “Label”.
•A label is a passive control which does not provide any interaction with the user.
•The “Label” class has the following constructors:
Label( ) throws HeadlessException
Label(String str) throws HeadlessException
Label(String str, int how) throws HeadlessException


Button:
•A button is a component that contains a label and generates an event when it is pressed.
•The buttons are objects of the class “Button”.
•Button class provides the following constructors:
Button( ) throws HeadlessException
Button(String str) throws HeadlessException


Check Box:

•A check box is a control that is used to provide a on or off option.
•It consists of a small box on which we can put a check mark or remove the check mark.
•All check boxes are the objects of the class “Checkbox”.
•Checkbox provides the following constructors:
1.Checkbox( ) throws HeadlessException
2.Checkbox(String str) throws HeadlessException
3.Checkbox(String str, boolean on) throws HeadlessException
4.Checkbox(String str, boolean on, CheckboxGroup cbGroup) throws HeadlessException
5.Checkbox(String str, CheckboxGroup cbGroup, boolean on) throws HeadlessException


Checkbox Group (Radio Buttons):

•Checkbox group is used to create mutually exclusive check boxes. These are often called as “radio buttons”.
•In a set of radio buttons, we can select only one option at a time.



Choice (Drop down box or Combo box):

•The choice control is used to display a pop-up list of items from which an user can select one item.
•All the items in the choice control are of string type.
•“Choice” class supports only a single constructor, which is used to create an empty list.
•To add items into the choice control, we use the add() method. The syntax of add() is as follows:
void add(String name)


List Box:

•The list box control is used to display a scrollable, multi-choice list of items. Unlike choice control in which we can only select a single item, in list box control we can select multiple items.
•All list box controls are the objects of the class “List”.
•“List” provides three constructors as shown below:
1.List( ) throws HeadlessException
2.List(int numRows) throws HeadlessException
3.List(int numRows, boolean multipleSelect) throws HeadlessException


Text Field:

•The text field control allows the user to enter input in a single line. The user will be able to modify the text in the text field control.
•This control is also called as “edit control”.
•The text field control is an object of “TextField” class.
•The “TextField” class provides four constructors as follows:
1.TextField( ) throws HeadlessException
2.TextField(int numChars) throws HeadlessException
3.TextField(String str) throws HeadlessException
4.TextField(String str, int numChars) throws HeadlessException


Text Area:

•The text area control allows the user to provide the input in multiple lines.
•The text area control is an object of “TextArea” class.
•The “TextArea” control provides five constructors as shown below:
1.TextArea( ) throws HeadlessException
2.TextArea(int numLines, int numChars) throws HeadlessException
3.TextArea(String str) throws HeadlessException
4.TextArea(String str, int numLines, int numChars) throws HeadlessException
5.TextArea(String str, int numLines, int numChars, int sBars) throws HeadlessException

No comments:

Post a Comment