Java AWT

Previous Chapter 19
java.awt Reference
Next
 

LayoutManager

Name

LayoutManager

[Graphic: Figure from the text]

Description

LayoutManager is an interface that defines the responsibilities of an object that wants to lay out Components to the display in a Container.

Interface Definition

public abstract interface java.awt.LayoutManager {
  
  // Interface Methods
  public abstract void addLayoutComponent (String name, 
      Component component); 
  public abstract void layoutContainer (Container target); 
  public abstract Dimension minimumLayoutSize (Container target); 
  public abstract Dimension preferredLayoutSize (Container target); 
  public abstract void removeLayoutComponent (Component component); 
}

Interface Methods

addLayoutComponent

public abstract void addLayoutComponent (String name, Component component)

Parameters

name

Name of component to add.

component

Actual component being added.

Description

Called when you call Container.add(String, Component) to add an object to a container.

layoutContainer

public abstract void layoutContainer (Container target)

Parameters

target

The container who needs to be redrawn.

Description

Called when target needs to be redrawn.

minimumLayoutSize

public abstract Dimension minimumLayoutSize (Container target)

Parameters

target

The container whose size needs to be calculated.

Returns

Minimum Dimension of the container target

Description

Called when the minimum size of the target container needs to be calculated.

preferredLayoutSize

public abstract Dimension preferredLayoutSize (Container target)

Parameters

target

The container whose size needs to be calculated.

Returns

Preferred Dimension of the container target

Description

Called when the preferred size of the target container needs to be calculated.

removeLayoutComponent

public abstract void removeLayoutComponent (Component component)

Parameters

component

Component to no longer track.

Description

Called when you call Container.remove(Component) to remove a component from the layout.

See Also

Component, Container, FlowLayout, GridLayout, Object, String


Previous Home Next
Label Book Index LayoutManager2 (New)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java