14.03.2018 Views

AWT Tutorialspoint Simply Esay Learning

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>AWT</strong><br />

Interface Methods<br />

S.N.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

Method & Description<br />

void addLayoutComponent(Component comp, Object<br />

constraints)<br />

Adds the specified component to the layout, using the specified<br />

constraint object.<br />

float getLayoutAlignmentX(Container target)<br />

Returns the alignment along the x axis.<br />

float getLayoutAlignmentY(Container target)<br />

Returns the alignment along the y axis.<br />

void invalidateLayout(Container target)<br />

Invalidates the layout, indicating that if the layout manager has cached<br />

the information that should be discarded.<br />

Dimension maximumLayoutSize(Container target)<br />

Calculates the maximum size dimensions for the specified container,<br />

given the components that it contains.<br />

<strong>AWT</strong> Layout Manager Classes<br />

Following is the list of commonly used controls while designed GUI using <strong>AWT</strong>.<br />

Sr.<br />

No.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

LayoutManager & Description<br />

BorderLayout<br />

The borderlayout arranges the components to fit in the five regions:<br />

east, west, north, south, and center.<br />

CardLayout<br />

The CardLayout object treats each component in the container as a<br />

card. Only one card is visible at a time.<br />

FlowLayout<br />

The FlowLayout is the default layout. It layouts the components in a<br />

directional flow.<br />

GridLayout<br />

The GridLayout manages the components in the form of a rectangular<br />

grid.<br />

GridBagLayout<br />

This is the most flexible layout manager class. The object of<br />

GridBagLayout aligns the component vertically, horizontally, or along<br />

their baseline without requiring the components of same size.<br />

<strong>AWT</strong> BorderLayout Class<br />

The class BorderLayout arranges the components to fit in the five regions: east,<br />

west, north, south and center. Each region contains only one component and each<br />

186

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!