Layout Managers

Java AWT GridBagLayout Manager

This is the king of all layout managers because it can handle almost any type of layout arrangement. It is more flexible and at the same time more complex to use. This is an extension of GridLayout manager. Both grid layout and grid bag layout use the concept of grid…

Java AWT CardLayout Manager

After learning the basic layout managers (Flow, Border and Grid), let us study the advanced layout managers – CardLayout and GridBagLayout. These two managers are used in specific cases, but not often, where basic layout managers with panel combinations fail to fulfill the layout requirements. Layout management is the procedure…

Draw Smiley Face Java Nested Panels

1. Creating Smiley Face This tutorial, "Draw Smiley Face Java Nested Panels", gives command over graphics to a novice. Fill ovals and arc are arranged in such way it looks smiley face. For beautification, a background color of pink (predefined color) is given. Example on Smiley Face

Just change…

Java No Layout Manager setBounds()

We know earlier in "Java Layout Managers" that two styles of placing components in containers – pixel format and position format. Now let us discuss clearly what pixel format is and how to place a component in terms of pixels. We also know earlier, the default layout manager for Frame…

Java AWT Panels

Java AWT Panels play a very important role in layout management. Panels in combination with layout managers render the desired layout to the programmer. Following hierarchy gives the place of Panel in AWT API. java.lang.Object –> java.awt.Component –> java.awt.Container –> java.awt.Panel –> java.applet.Applet Properties of Java AWT Panels As you…

FlowLayout Manager Example

FlowLayout Manager Example: It is the mostly used along with panels and is the default manager for Applets and Panels. It arranges the components on the north (top) side of the container. The components, by default, centered on the north side. The alignment can be changed to left or right.…

Java AWT GridLayout Manager

After knowing the importance of layout managers, FlowLayout and BorderLayout, let us study the other layout manager – GridLayout. As the name indicates the container is divided into a grid of cells dictated by rows and columns. Each cell accommodates one component. Like with FlowLayout, in GridLayout also, the position…

BorderLayout Manager Example

BorderLayout Manager Example: After knowing the layout managers, FlowLayout and GridLayout functionality, let us go to the style of BorderLayout arrangement of components in a container. As the name indicates the container is divided into 5 regions – 4 borders (North, South, East, West) and 1 Center. Following are the…

Java Layout Managers

To display a component, it is inevitable to add it to a container. Container is an area on the monitor that can hold and display the components. The frequently used containers are Frame and Panel; the less used and restricted to browser applications is Applet. To place a component inside…