

Generally, we won’t create Window objects directly. A top-level window is not contained within any other object it sits directly on the desktop. The Window class creates a top-level window. Once these components have been added, we can position and resize them manually using the setLocation( ), setSize( ), or setBounds() methods defined by Component. Other components can be added to a Panel object by its add( ) method (inherited from Container).

When we run an applet using an applet viewer, the applet viewer provides the title and border.

This is why we don’t see these items when an applet is run inside a browser. In essence, a Panel is a window that does not contain a title bar, menu bar, or border. When screen output is directed to an applet, it is drawn on the surface of a Panel object. A Panel may be thought of as a recursively nestable, concrete screen component. It doesn’t add any new methods it simply implements Container. The Panel class is a concrete subclass of Container. It does this through the use of various layout managers. A container is responsible for laying out (that is, positioning) any components that it contains. This makes for a multileveled containment system. Other Container objects can be stored inside of a Container (since they are themselves instances of Component). It has additional methods that allow other Component objects to be nested within it. The Container class is a subclass of Component. A Component object is responsible for remembering the current foreground and background colors and the currently selected text font. It defines over a hundred public methods that are responsible for managing events, such as mouse and keyboard input, positioning and sizing the window, and repainting. All user interface elements that are displayed on the screen and that interact with the user are subclasses of Component. The component is an abstract class that encapsulates all of the attributes of a visual component. The figure below shows the class hierarchy for Panel and Frame.Īt the top of the AWT, hierarchy is the Component class. Thus, a description of the class hierarchies relating to these two classes is fundamental to their understanding.
#The class at the top of the awt hierarchy is windows#
Much of the functionality of these windows is derived from their parent classes. The two most common windows are those derived from Panel, which is used by applets and those derived from Frame, which creates a standard window. The AWT defines windows according to a class hierarchy that adds functionality and specificity to each level. Awt classes java.awt package are class Button, Canvas, Checkbox, Choice, Label, List, Scrollbar, TextArea, TextField. The AWT provides nine basic non-container component classes from which a user interface may be constructed.

It is heavy-weight in use because it is generated by the system’s host operating system. It was developed by Sun Microsystem In 1995. It is a platform-dependent API to develop GUI (Graphical User Interface) or window-based applications in Java. ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.
