Layout Manager in JAVA


layout Manager in JAVA

Layout Managers

java.awt and javax.swing packages contains Many Layout Manager classes.

Layout Manager determines the Way in Which That Component are arranged

in the container. All the JAVA Container Contains Their own Default Layout

Manager so in your JAVA Program if you not Specify any java Container,

JAVAcompiler Will use the Default layout manager. you can also Select

different layout Manager.

Why We Need To Define The Layout Manager

One Question may be coming in your mind Why we need to Specify the

Layout Manager ? We can use the JAVA Component by Specifying the

Location and Size also so Why We need Layout Manager..?? so the

reason is to ensure that JAVA GUI Elements are displayed properly in

every possible JAVA Environment. Layout manager Automatically Adjust

the size and Position of the components to fit According the Size of the

Screen. Suppose if your Windows Size is less and you Fixed the Size

and Location of Each Component, Then There is a Possibility of the

Overlapping of the Components.

Different Types of Layout Manager

JAVA defines different types of the Layout Manager, Some of them given

under the Following points..

1. FlowLayout

2. BorderLayout

3. CardLayout

4. GridLayout

5. GridBagLayout

6. BoxLayout

7. SpringLayout

Layout MangerDescriptionPackage
Flow LayoutIt Place the Components in the rows in a container,after filling the one row it will start to fill the next row.java.awt

Example of FlowLayout

Flowlayout Manager in JAVA



Layout MangerDescriptionPackage
BorderLayoutIt Place the component in four border of the container (left,right,top,down) and centerjava.awt

Example of BorderLayout

borderlayout Manager in JAVA


Layout MangerDescriptionPackage
CardLayoutIt place the component one on top of another, only the top component is visible at any one timejava.awt


Example of CardLayout

cardlayout Manager in JAVA



Layout MangerDescriptionPackage
GridLayoutIt Place the components in rectangular grid in the form of rows and columnsjava.awt


Example of GridLayout

Gridlayout Manager in JAVA



Layout MangerDescriptionPackage
GridBagLayoutIt Place the components in rectangular grid in the form of rows and columns but rows and columns can very in lengthjava.awt


Example of GridBagLayout

GridBaglayout Manager in JAVA



Layout MangerDescriptionPackage
BoxLayoutIt Place the components in either of rows or columns. the BoxLayout Manager is the default for the Box Container classjavax.swing


Example of BoxLayout

boxlayout Manager in JAVA



Layout MangerDescriptionPackage
SpringLayoutIt Allow a Components to have their positions defined by "spring" or "struts"javax.swing

Example of SpringLayout

Springlayout Manager in JAVA


Thank You To All My Reader
Deepak Gupta
www.i-world-tech.blogspot.in

Related Post

1. How To Install JDK on Windows

2. JDK 8

3. How we Install Apache Tomcat Server

4. Content Management System ( CMS )

5. JavaScript Form Validation

6. JavaScript Operator

7. HTML Marquee Tag

8. How We Enable JavaScript in Browser

9. Mini Project in C : Book Shop Inventory System

10. Interesting C++ Program

Comments