public class GridBagLayout extends Layout
Codename One port of the infamous GridBagLayout based on the Apache Harmony code. For new applications
we generally recommend a "native" Codename One layout such as TableLayout
and recommend avoiding this layout. Its here for developers who are accustomed to it and need to port existing code.
Modifier and Type | Field and Description |
---|---|
double[] |
columnWeights |
int[] |
columnWidths |
protected Hashtable<Component,GridBagConstraints> |
comptable |
protected GridBagConstraints |
defaultConstraints |
protected com.codename1.ui.layouts.GridBagLayoutInfo |
layoutInfo |
protected static int |
MAXGRIDSIZE |
protected static int |
MINSIZE |
protected static int |
PREFERREDSIZE |
int[] |
rowHeights |
double[] |
rowWeights |
Constructor and Description |
---|
GridBagLayout() |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Object constraints,
Component comp,
Container c)
Some layouts can optionally track the addition of elements with meta-data
that allows the user to "hint" on object positioning.
|
protected void |
adjustForGravity(GridBagConstraints constraints,
Rectangle r) |
protected void |
AdjustForGravity(GridBagConstraints constraints,
Rectangle r) |
protected void |
arrangeGrid(Container parent) |
protected void |
ArrangeGrid(Container parent) |
Object |
getComponentConstraint(Component comp)
Returns the optional component constraint
|
int[][] |
getLayoutDimensions() |
double[][] |
getLayoutWeights() |
Dimension |
getPreferredSize(Container parent)
Returns the container preferred size
|
void |
invalidateLayout(Container target) |
void |
layoutContainer(Container parent)
Layout the given parent container children
|
protected GridBagConstraints |
lookupConstraints(Component comp) |
void |
removeLayoutComponent(Component comp)
Removes the component from the layout this operation is only useful if the
layout maintains references to components within it
|
void |
setConstraints(Component comp,
GridBagConstraints constraints) |
cloneConstraint, equals, getChildrenInTraversalOrder, hashCode, isConstraintTracking, isOverlapSupported, obscuresPotential, overridesTabIndices, updateTabIndices
protected static final int MAXGRIDSIZE
protected static final int MINSIZE
protected static final int PREFERREDSIZE
protected volatile Hashtable<Component,GridBagConstraints> comptable
protected volatile GridBagConstraints defaultConstraints
protected volatile com.codename1.ui.layouts.GridBagLayoutInfo layoutInfo
public volatile double[] columnWeights
public volatile double[] rowWeights
public volatile int[] columnWidths
public volatile int[] rowHeights
public void addLayoutComponent(Object constraints, Component comp, Container c)
Layout
addLayoutComponent
in class Layout
constraints
- optional meta data information, like alignment orientationcomp
- the added component to the layoutc
- the parent containerpublic void removeLayoutComponent(Component comp)
Layout
removeLayoutComponent
in class Layout
comp
- the removed component from layoutpublic Object getComponentConstraint(Component comp)
Layout
getComponentConstraint
in class Layout
comp
- the component whose constraint should be returnedpublic void setConstraints(Component comp, GridBagConstraints constraints)
public void invalidateLayout(Container target)
public Dimension getPreferredSize(Container parent)
Layout
getPreferredSize
in class Layout
parent
- the parent containerpublic void layoutContainer(Container parent)
Layout
layoutContainer
in class Layout
parent
- the given parent containerpublic int[][] getLayoutDimensions()
public double[][] getLayoutWeights()
protected void ArrangeGrid(Container parent)
protected GridBagConstraints lookupConstraints(Component comp)
protected void adjustForGravity(GridBagConstraints constraints, Rectangle r)
protected void arrangeGrid(Container parent)
protected void AdjustForGravity(GridBagConstraints constraints, Rectangle r)