

The class at the top of the awt hierarchy is mac#
In simple words, an application build on AWT would look more like a windows application when being run on Windows, however, that same application would look like a Mac application when being run on Mac Operating System. since these platforms have different look and feel for their respective native buttons and then AWT would directly call their native subroutine that is going to create the button. For example, an AWT GUI containing a button would be having varied look- and -feel in various platforms like Windows, Mac OS, and Unix, etc. Java Abstract Window Toolkit calls native platform I.e., Operating system’s subroutine in order to create components like text box, checkbox, button, etc. It can also have other components like text field, button, etc. Trim: The Frame is the container or class containing the title bar and might also have menu bars. We cannot create an instance of the Dialog class without an associated instance of the respective Frame class.Ĥ. Dialog: The Dialog is the container or class having a border and title. It has other components like buttons, text fields, etc.ģ. Panel: The Panel is the container/class that doesn’t contain the title bar and menu bars. In order to create a window, you can use frame, dialog or another window.Ģ. Window: The window is a container that does not have borders and menu bars. As shown in the hierarchy above, Frame and Dialog are subclasses of the Window class.ġ. There are in total, four types of containers available in AW, that is, Window, Frame, Dialog, and Panel. Frame is most widely used container while developing an AWT application.As demonstrated above, container refers to the location where components can be added like text field, button, checkbox, etc.

It can have other components like buttons, text field, scrollbar etc. The Frame is the container that contains title bar and border and can have menu bars. An instance of Panel class creates a container, in which we can add components. It can have other components like button, text field etc. It is generic container for holding the components. The Panel is the container that doesn't contain title bar, border or menu bar. We need to create an instance of the Window class to create this container. You must use frame, dialog, or another window for creating a window. The window is the container that has no borders and menu bars. There are four types of containers in Java AWT: Thus it contains and controls the layout of components. It is basically a screen where the components are placed at their specific locations. The classes that extend the Container class are known as containers such as Frame, Dialog, and Panel. The Container is a component in AWT that can contain other components like buttons, text fields, labels, etc. container which can be overridden using the setLayout method.ĭifferent AWT container are described below:. It does this through the use of various layout managers. A container is responsible for positioning any component placed on it. Thus, allowing a multileveled containment system. Other Container objects can also be stored inside of a Container since they are themselves instances of Component.

It has additional features that allow other Component objects to be placed within it. The Container class is a subclass of Component. The component object is responsible for remembering the current foreground and background colors, currently selected text font, and current text alignment. It defines over a hundred public methods that are responsible for managing events. 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 component. The difference between components and containers are :-Īt the top of the AWT, hierarchy is the Component class.
