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 />

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

TheinterfaceLayoutManager is used to define the interface for classes that know<br />

how to lay out the Containers.<br />

Class Declaration<br />

Following is the declaration for java.awt.LayoutManager interface:<br />

public interface LayoutManager<br />

Interface Methods<br />

S.N.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

Method & Description<br />

void addLayoutComponent(String name, Component comp)<br />

If the layout manager uses a per-component string, adds the<br />

component to the layout, associating it with the string specified by<br />

name.<br />

void layoutContainer(Container parent)<br />

Lays out the specified container.<br />

Dimension minimumLayoutSize(Container parent)<br />

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

given the components that it contains.<br />

Dimension preferredLayoutSize(Container parent)<br />

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

given the components that it contains.<br />

void removeLayoutComponent(Component comp)<br />

Removes the specified component from the layout.<br />

<strong>AWT</strong> LayoutManager2 Interface<br />

The Layout Manger2 Interface is used to define the interface for classes, which<br />

know how to lay out Containers based on a layout constraints object.<br />

Class Declaration<br />

Following is the declaration for java.awt.LayoutManager2 interface:<br />

public interface LayoutManger2<br />

extends LayoutManager<br />

185

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

Saved successfully!

Ooh no, something went wrong!