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 Manger | Description | Package |
---|---|---|
Flow Layout | It 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
Layout Manger | Description | Package |
---|---|---|
BorderLayout | It Place the component in four border of the container (left,right,top,down) and center | java.awt |
Example of BorderLayout
Layout Manger | Description | Package |
---|---|---|
CardLayout | It place the component one on top of another, only the top component is visible at any one time | java.awt |
Example of CardLayout
Layout Manger | Description | Package |
---|---|---|
GridLayout | It Place the components in rectangular grid in the form of rows and columns | java.awt |
Example of GridLayout
Layout Manger | Description | Package |
---|---|---|
GridBagLayout | It Place the components in rectangular grid in the form of rows and columns but rows and columns can very in length | java.awt |
Example of GridBagLayout
Layout Manger | Description | Package |
---|---|---|
BoxLayout | It Place the components in either of rows or columns. the BoxLayout Manager is the default for the Box Container class | javax.swing |
Example of BoxLayout
Layout Manger | Description | Package |
---|---|---|
SpringLayout | It Allow a Components to have their positions defined by "spring" or "struts" | javax.swing |
Example of SpringLayout
Thank You To All My Reader
Aman Kapoor
www.CodeMon5ter.blogspot.in
No comments:
Post a Comment