0% found this document useful (0 votes)
126 views2 pages

AWT Controls: Constructors & Methods

1) The AWT Controls constructors create instances of the controls with default or specified parameters like text, number of characters etc. 2) The AWT Controls methods allow modifying properties of the controls like text, alignment, state and retrieving properties like text, selected item etc. 3) Common methods across controls include setText to set label/text, getText to retrieve text, and controls specific methods to set/get other properties according to their functionality.

Uploaded by

Tejas Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views2 pages

AWT Controls: Constructors & Methods

1) The AWT Controls constructors create instances of the controls with default or specified parameters like text, number of characters etc. 2) The AWT Controls methods allow modifying properties of the controls like text, alignment, state and retrieving properties like text, selected item etc. 3) Common methods across controls include setText to set label/text, getText to retrieve text, and controls specific methods to set/get other properties according to their functionality.

Uploaded by

Tejas Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

AWT Controls with their constructors and some methods

Sr. Name of Constructors Methods


No. Control
1 Label 1)Label() 1)void setText(String str)
2)Label(String str) 2) String getText()
3)Label(String str, int how) 3)void setAlignment(int how)
Where str represent the actual text of label 4)int getAlignment()
how is having 3 values
[Link],[Link],[Link]
2 Button 1)Button() 1)void setLabel(String str)
2)Button(String str) 2)String getLabel();
3 TextField 1)TextField() 1) void setText(String str)
2)TextField(int numchar) 2)String getText()
3)TextField(String str) 3)void setEchoChar(char ch)
4)TextField(String str,int numchar) 4)char getEchoChar()
5)void setEditable(boolean b)
4 TextArea 1)TextArea() 1)void append(String str)
2)TextArea(int num, int numchar) 2)void insert(String str, int
3)TextArea(String str) index)
4)TextArea(String str,int num,int nc) 3) void setText(String str)
5)TextArea(String s,int n,int c,int bars) 4)String getText()
Where bars is
SCROLLBARS_BOTH=0,SCROLLBARS
_NONE=3,SCROLLBARS_HORIZONTA
L_ONLY=2,SCROLLBARS_VERTICAL
_ONLY=1
5 Checkbox 1)Chechbox() 1)void setLabel(String str)
2)Checkbox(String str) 2)String getLabel()
3)Checkbox(String str,boolean b) 3)boolean getState()
4)Checkbox(String str,boolean 4) void setState(Boolean on)
b,CheckboxGroup cbg)
6 Choice Choice() 1)void add(String n)
2)int getSelectedIndex()
3)String getSelectedItem()
4)int getItemCount()
7 List 1)List() 1)void add(String str)
2)List(int row) 2)void add(String s,int i)
3)List(int row,boolean multipleselect) 3)int getSelectedIndex()
4)String getSelectedItem()
5)int getItemCount()
8 Scrollbar 1)Scrollbar() 1)int getValue()
2)Scrollbar(int style) 2)void setValue(int new)
Where style has values 3)int getMinimum()
[Link],[Link] 4)int getMaximum()
CAL
9 MenuBar MenuBar() 1)setMenuBar(MenuBar obj)
2)void add(Menu object)
10 Menu 1)Menu() 1)void add(MenuItem obj)
2)Menu(String s) 2)void setLabel(String s)
3)Menu(String s, boolean re) 3)String getLabel()
11 MenuItem 1)MenuItem() 1)void setEnabled(boolean f)
2)MenuItem(String s) 2)boolean isEnabled()
3)MenuItem(String s, MenuShortcut 3)void setLabel(String s)
AccessKey) 4)String getLabel()
12 Checkbox 1)CheckboxMenuItem() 1)void setEnabled(boolean f)
MenuItem 2)CheckboxMenuItem(String n) 2)boolean isEnabled()
3)CheckboxMenuItem(String s, boolean 3)void setLabel(String s)
on) 4)String getLabel()
13 Dialogbox 1)Dialog(Frame pw,boolean mode)
2) Dialog(Frame pw, String s,boolean
mode)
14 FileDialog 1)FileDialog(Frame pw,String n) 1)String getFile()
2)FileDialog(Frame pw) 2) String getDirectory()
3)FileDialog(Frame pw, String n, int how)
Where how has values
[Link],[Link]

You might also like