Google Web Toolkit (Beta)
Search this site:

# Class HorizontalPanel

public class HorizontalPanel
extends CellPanel
implements HasAlignment
A panel that lays all of its widgets out in a single horizontal column.

## Constructors

HorizontalPanel() | Creates an empty horizontal panel.

## Methods

add(Widget) | Adds a child widget to the panel.
getHorizontalAlignment() | Gets the horizontal alignment.
getVerticalAlignment() | Gets the vertical alignment.
insert(Widget, int) | Inserts a widget before the specified index.
remove(Widget) |
setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant) | Sets the default horizontal alignment to be used for widgets added to this panel.
setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant) | Sets the default vertical alignment to be used for widgets added to this panel.

## Constructor Detail

### HorizontalPanel

public HorizontalPanel()
Creates an empty horizontal panel.

## Method Detail

### add

public void add(Widget w)
Adds a child widget to the panel. If the Widget is already attached to the HorizontalPanel, it will be moved to the end of the panel.

#### Parameters

w
  the widget to be added

### getHorizontalAlignment

public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
Gets the horizontal alignment.

#### Return Value

the current horizontal alignment.

### getVerticalAlignment

public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
Gets the vertical alignment.

#### Return Value

the current vertical alignment.

### insert

public void insert(Widget w, int beforeIndex)
Inserts a widget before the specified index. If the Widget is already attached to the HorizontalPanel, it will be moved to the specified index.

#### Parameters

w
  the widget to be inserted
beforeIndex
  the index before which it will be inserted

### remove

public boolean remove(Widget w)

#### Parameters

w

### setHorizontalAlignment

public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the default horizontal alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.

#### Parameters

align

#### See Also

HorizontalAlignmentConstant)

### setVerticalAlignment

public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the default vertical alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.

#### Parameters

align

#### See Also

VerticalAlignmentConstant)