Components that allow a user to interact with the application in various ways (Eg, a commonly used control is the push button)
The Layout manager automatically positions components within a container. The LayoutManager is set by the setLayout() method. If no call to setLayout( ) is made, then the default LayoutManager is used
AWT supports the following types of controls:
Labels, push buttons, check boxes, check box groups, lists, scroll bars, text fields etc.
Create an instance of the desired control and then add it to a window by calling add() method, defined by the Container class.
Component add(Component obj) // obj is the instance of the control to be added
- void remove(Component obj) // removes a control from a window when the control is no longer needed
- void removeAll() // removes all the controls
Almost all the AWT controls may throw a HeadlessException when an attempt is made to instantiate a GUI component, in a non-interactive environment. (such as one in which no display , mouse or keyboard is present)
Label is the only passive control (i.e., they do not generate events). All other controls generate events when they are accessed by the user. Example: When a pushbutton is clicked, an event is sent that identifies the pushbutton.