Sunday, 14 June 2020

Layout Manager in Java

Layout

Layout means the arrangement of components within the container. In other way we can say that placing the components at a particular position within the container. The task of layouting the controls is done automatically by the Layout Manager.

Layout Manager

The layout manager automatically positions all the components within the container. If we do not use layout manager then also the components are positioned by the default layout manager. It is possible to layout the controls by hand but it becomes very difficult because of the following two reasons.

It is very tedious to handle a large number of controls within the container.

Often the width and height information of a component is not given when we need to arrange them.

AWT Layout Manager Classes:

Following is the list of commonly used controls while designed GUI using AWT.

·         BorderLayout

The borderlayout arranges the components to fit in the five regions: east, west, north, south and center.

·         CardLayout

The CardLayout object treats each component in the container as a card. Only one card is visible at a time.

·         FlowLayout

The FlowLayout is the default layout.It layouts the components in a directional flow.

·         GridLayout

The GridLayout manages the components in form of a rectangular grid.

·         GridBagLayout

This is the most flexible layout manager class.The object of GridBagLayout aligns the component vertically,horizontally or along their baseline without requiring the components of same size.


No comments:

Post a comment

All about journals and research paper | What is impact factor? | how the impact factor is calculated? | who calculate the impact factor? Scopous journals

Figure 1: One of my Research Papers When the Scholars are in their Master or PhD or in any research field. They are supposed to writ...