Beruflich Dokumente
Kultur Dokumente
BITS Pilani
Hyderabad Campus
BITS Pilani
Hyderabad Campus
Todays Agenda
The Abstract Windowing Toolkit (AWT) AWT Class Hierarchy The Component class and its methods The GUI components
Components
GUI components: buttons, menus, frames (window), panel (w/o window), dialog (window)
Layout Managers
Container class contains components, layout managers Gives rule for graphical layout of components in a container Ex: layout components in a grid
Component
Component is an abstract class. All other classes are non-abstract (concrete). Component class is superclass of all the non-menu related user interface classes. It provides support for event handling, drawing of components etc. Some of the methods of Component class are void setForeground(Color c) void setBackground(Color c)
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
Containers
The AWT provides four container classes. Window Frame(MyFrame1.java, MyFrame2.java, MyFrame3.java, MyFrameClose.java, demo.java) Dialogue Panel
Button class
CLICK
button.java
lab_txt.java
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
GUI Components
Button Canvas
Roll your own GUI components
CLICK
Checkbox
Maintains boolean state
Checkboxgroup
Combines checkboxes into radio buttons
Label
Displays 1 line of text (read-only)
Enter name:
Scrollbar
You specify orientation (horz, vert, and min/max range) Event returned specifies
TextField
One line TextComponent setEchoCharacter() allows password entry
TextArea
Multiline TextComponent
Frame
A window with title, menubar, icon, cursor
Panel
Alternative to window e.g., for display of Applet in Web browser
Summary