com.threerings.opengl.gui.layout
Class TableLayout

java.lang.Object
  extended by com.threerings.opengl.gui.layout.LayoutManager
      extended by com.threerings.opengl.gui.layout.TableLayout

public class TableLayout
extends LayoutManager

Lays out components in a simple grid arrangement, wherein the width and height of each column and row is defined by the widest preferred width and height of any component in that column and row.

The table layout defaults to left horizontal alignment and top vertical alignment.


Nested Class Summary
static class TableLayout.Alignment
          An enumeration class representing alignments.
 
Field Summary
static TableLayout.Alignment BOTTOM
          Bottom justifies the table contents within the container.
static TableLayout.Alignment CENTER
          Centers the table contents within the container.
static TableLayout.Alignment LEFT
          Left justifies the table contents within the container.
static TableLayout.Alignment RIGHT
          Right justifies the table contents within the container.
static TableLayout.Alignment STRETCH
          Divides the column space among the columns in proportion to their preferred size.
static TableLayout.Alignment TOP
          Top justifies the table contents within the container.
 
Constructor Summary
TableLayout(int columns)
          Creates a table layout with the specified number of columns and a zero pixel gap between rows and columns.
TableLayout(int columns, int rowgap, int colgap)
          Creates a table layout with the specified number of columns and the specifeid gap between rows and columns.
 
Method Summary
 Dimension computePreferredSize(Container target, int whint, int hhint)
          Computes the preferred size for the supplied container, based on the preferred sizes of its children and the layout policy implemented by this manager.
 void layoutContainer(Container target)
          Effects the layout policy of this manager on the supplied target, adjusting the size and position of its children based on the size and position of the target at the time of this call.
 TableLayout setEqualRows(boolean equalRows)
          Configures whether or not the table will force all rows to be a uniform size.
 TableLayout setFixedColumn(int column, boolean fixed)
          Configures a column as fixed or free.
 TableLayout setHorizontalAlignment(TableLayout.Alignment align)
          Configures the horizontal alignment (or stretching) of this table.
 TableLayout setVerticalAlignment(TableLayout.Alignment align)
          Configures the vertical alignment of this table.
 
Methods inherited from class com.threerings.opengl.gui.layout.LayoutManager
addLayoutComponent, getConstraints, removeLayoutComponent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final TableLayout.Alignment LEFT
Left justifies the table contents within the container.


CENTER

public static final TableLayout.Alignment CENTER
Centers the table contents within the container.


RIGHT

public static final TableLayout.Alignment RIGHT
Right justifies the table contents within the container.


TOP

public static final TableLayout.Alignment TOP
Top justifies the table contents within the container.


BOTTOM

public static final TableLayout.Alignment BOTTOM
Bottom justifies the table contents within the container.


STRETCH

public static final TableLayout.Alignment STRETCH
Divides the column space among the columns in proportion to their preferred size. This only works with setHorizontalAlignment(com.threerings.opengl.gui.layout.TableLayout.Alignment).

Constructor Detail

TableLayout

public TableLayout(int columns)
Creates a table layout with the specified number of columns and a zero pixel gap between rows and columns.


TableLayout

public TableLayout(int columns,
                   int rowgap,
                   int colgap)
Creates a table layout with the specified number of columns and the specifeid gap between rows and columns.

Method Detail

setHorizontalAlignment

public TableLayout setHorizontalAlignment(TableLayout.Alignment align)
Configures the horizontal alignment (or stretching) of this table. This must be called before the container using this layout is validated.


setVerticalAlignment

public TableLayout setVerticalAlignment(TableLayout.Alignment align)
Configures the vertical alignment of this table. This must be called before the container using this layout is validated.


setFixedColumn

public TableLayout setFixedColumn(int column,
                                  boolean fixed)
Configures a column as fixed or free. If a table layout is configured with STRETCH horizontal alignment, extra space is divided up among all of the non-fixed columns. All columns are non-fixed by default.


setEqualRows

public TableLayout setEqualRows(boolean equalRows)
Configures whether or not the table will force all rows to be a uniform size. This must be called before the container using this layout is validated.


computePreferredSize

public Dimension computePreferredSize(Container target,
                                      int whint,
                                      int hhint)
Description copied from class: LayoutManager
Computes the preferred size for the supplied container, based on the preferred sizes of its children and the layout policy implemented by this manager. Note: it is not necessary to add the container's insets to the returned preferred size.

Specified by:
computePreferredSize in class LayoutManager

layoutContainer

public void layoutContainer(Container target)
Description copied from class: LayoutManager
Effects the layout policy of this manager on the supplied target, adjusting the size and position of its children based on the size and position of the target at the time of this call. Note: the target's insets must be accounted for when laying out the children.

Specified by:
layoutContainer in class LayoutManager


Copyright © 2011. All Rights Reserved.