![]() ![]() You can view AWT and Swing versions of the source code for the demonstrationapplication in the Conclusion section at the end of this article. The demonstration application uses AWT components. The best way to see how the AWT layout managers behave is to try them out. The Java Development Kit (JDK) 1.2 introduces BoxLayout for placing components from left to right or top to bottom in an AWT or Swing container. This article describes the predefined AWT layout managers in this list. It is easy to use the tLayout method to change the layout manager, and you can define your own layout manager by implementing the interface. Every Abstract Window Toolkit (AWT) and Swing container has a predefined layout manager as its default. The java.awt package provides the following predefined layout managers that implement the interface. As you can see in the figure, the layout manager in effect for the window determines how the two panels are sized and positioned inside the window, and the layout manager in effect for each panel determines how components are sized and positioned inside the panels. For example, a window can contain a panel, which is itself a container. The layout manager in effect for the window determines how the components are sized and positioned inside the window.Ī container can contain another container. For example, a window is a container that contains components such as buttons and labels. What is a Layout Manager?Ī layout manager is an object that controls the size and position (layout) of components inside a Container object. As you read about the different layout managers, you can play with the application to see for yourself how each AWT layout manager arranges components and behaves when the window resizes. ![]() This interactive article describes the Abstract Window Toolkit (AWT) predefined layout managers with text and a demonstration application.
0 Comments
Leave a Reply. |