AWT (Abstract Window Tool Kit) : Submit
AWT (Abstract Window Tool Kit) : Submit
Introduction
Java AWT (Abstract Window Toolkit) is an API (Application programming interface) to develop
Graphical User Interface (GUI) or windows-based applications in Java.
Java AWT contains components these components are platform-dependent i.e. components are
displayed according to the view of operating system these are heavy weight. The java.awt package
provides classes for AWT API.
AWT Components
Button
Label
Checkbox
Choice
List
TextField
All the elements like the button, text fields, label, etc. are called components. In Java AWT there are
classes for each component. In order to place every component in a particular position on a screen, we
need to add them to a container.
Button:
Button b1=new Button();
b1.setLabel(“Submit”);
Submit
Label:
Label L=new Label();
L.setText(“Name: ”);
L.setText(“Address: ”);
Name :
Address :
Checkbox:
Checkbox cb=new Checkbox(“Male”);
Male
Choice:
Choice ch=new Choice();
`1 Rakesh M.Sc.
ch.add(“BCOM”);
ch.add(“BSC”);
ch.add(“BA”);
ch.add(“BBA”);
List:
List Li=new List(number of items(numeric value) , Boolean value true / false);
TextField:
TextField T1=new TextField(size/ width );
Method Description
`2 Rakesh M.Sc.
// adding button into frame
add(b);
// main method
public static void main(String args[]) {
// creating instance of Frame class
AWTEx f = new AWTEx();
}
}
}
}
`3 Rakesh M.Sc.