Module 6 - Graphical User Interface in JAVA
Module 6 - Graphical User Interface in JAVA
Interface in JAVA
GUI design in Java
1. BorderLayout
2. BoxLayout
3. CardLayout
4. FlowLayout
5. GridBagLayout
6. GridLayout
7. GroupLayout
8. SpringLayout
Here are 5 of the layout managers.
BorderLayout
The class BorderLayout arranges the components to fit in the five regions: east,
west, north, south and center.
Each region is can contain only one component and each component in each region is
identified by the corresponding constant NORTH, SOUTH, EAST, WEST, and
CENTER.
Class declaration
Following is the declaration
for java.awt.BorderLayout class:
public class BorderLayout extends Object implements LayoutManager2,
Serializable
Here are the constructors defined by BorderLayout:
1. BorderLayout()
the first form creates a default border layout. The second allows you to specify the
horizontal and vertical space left between components in horz and vert, respectively.
BorderLayout.CENTER, BorderLayout.SOUTH,
BorderLayout.EAST, BorderLayout.WEST,
BorderLayout.NORTH
CardLayou t
The class CardLayout arranges each component in the container as a card. Only
one card is visible at a time, and the container acts as a stack of cards.
Class declaration
Following is the declaration
for java.awt.CardLayout class:
public class CardLayout extends Object implements LayoutManager2,
Serializable
CardLayout provides these two constructors:
1. CardLayout()
1. FlowLayout()
2. FlowLayout(int how)
The first form creates the default layout, which centers components and
leaves five pixels of space between each component. The second form lets
you specify how each line is aligned. Valid values of how are as follows:
FlowLayout.LEFT
FlowLayout.CENTER
FlowLayout.RIGHT
GridLayou t
Introduction
The class GridLayout arranges components in a rectangular
grid.
Class declaration
Following is the declaration
for java.awt.GridLayout class:
public class GridLayout extends Object implements
LayoutManager, Serializable
GridLayout are shown here:
1. GridLayout()
Class declaration