Control Fundamentals

Controls are components that allow a user to interact with your application in various ways—for example, a commonly used control is the push button.

1.     A layout manager automatically positions components within a container. Thus, the appearance of a window is determined by a combination of the controls that it contains and the layout manager used to position them.In addition to the controls, a frame window can also include a standard-style menu bar. 
2.     Each entry in a menu bar activates a drop-down menu of options from which the user can choose. A menu bar is always positioned at the top of a window. Although different in appearance, menu bars are handled in much the same way as are the other controls. While it is possible to manually position components within a window, doing so is quite tedious. The layout manager automates this task.


Control Fundamentals
The AWT supports the following types of controls:
Labels
Push buttons
Check boxes
Choice lists
Lists
Scroll bars
Text editing

·        They are the subclasses of ‘Component’

How to add or remove controls?

  • Syntax:-
  • Component add(Component obj)


  • We can also remove our control from window by calling remove() method.
    Syntax:-
Void remove(Component obj)

  • And also controls can be removed by calling removeAll(

No comments:

Post a Comment