public class GBC
extends java.lang.Object
GridBagConstraints to make it easier to use.| Modifier and Type | Field and Description |
|---|---|
static int |
ABOVE_BASELINE |
static int |
ABOVE_BASELINE_LEADING |
static int |
ABOVE_BASELINE_TRAILING |
static int |
BASELINE |
static int |
BASELINE_LEADING |
static int |
BASELINE_TRAILING |
static int |
BELOW_BASELINE |
static int |
BELOW_BASELINE_LEADING |
static int |
BELOW_BASELINE_TRAILING |
static int |
BOTH |
static int |
CENTER |
static int |
EAST |
static int |
FIRST_LINE_END |
static int |
FIRST_LINE_START |
static int |
HORIZONTAL |
static int |
LAST_LINE_END |
static int |
LAST_LINE_START |
static int |
LINE_END |
static int |
LINE_START |
static int |
NONE |
static int |
NORTH |
static int |
NORTHEAST |
static int |
NORTHWEST |
static int |
PAGE_END |
static int |
PAGE_START |
static int |
RELATIVE |
static int |
REMAINDER |
static int |
SOUTH |
static int |
SOUTHEAST |
static int |
SOUTHWEST |
static int |
VERTICAL |
static int |
WEST |
| Modifier and Type | Method and Description |
|---|---|
<C extends java.awt.Component> |
add(C component,
java.util.function.Consumer<C> consumer)
Add the specified component to the parent container with the constraints.
|
GBC |
add(java.awt.Component component)
Add the specified component to the parent container with the constraints.
|
GBC |
add(java.awt.Component component,
java.lang.Runnable runnable)
Add the specified component to the parent container with the constraints.
|
GBC |
add(java.util.function.Supplier<java.awt.Component> supplier)
Add the component created by the supplier to the parent container with the constraints.
|
GBC |
anchor(int anchor)
Set the
anchor of the constraints. |
static GBC |
create()
Create a new GBC with the parent set to null.
|
static GBC |
create(java.awt.Container parent)
Create a new GBC with the parent set to the specified container.
|
static java.util.OptionalInt |
currentGridX(java.awt.Container container)
Get the current
gridx value for the specified container. |
static java.util.OptionalInt |
currentGridY(java.awt.Container container)
Get the current
gridy value for the specified container. |
GBC |
fill(int fill)
Set the
fill of the constraints. |
static int |
fillVerticalSpace(java.awt.Container parent)
Add a filler component that will fill the remaining horizontal space.
|
static void |
fillVerticalSpace(java.awt.Container parent,
int gridy)
Add a filler component that will fill the remaining horizontal space.
|
java.awt.GridBagConstraints |
get() |
GBC |
grid(int gridx,
int gridy)
Set the
gridx and gridy of the constraints. |
GBC |
gridx(int gridx)
Set the
gridx of the constraints. |
GBC |
gridy(int gridy)
Set the
gridy of the constraints. |
GBC |
height(int gridheight)
Set the
gridheight of the constraints. |
GBC |
insets(java.awt.Insets insets)
Set the
insets of the constraints. |
GBC |
insets(int all)
Set the
insets of the constraints to the same value for all sides. |
GBC |
insets(int topBottom,
int leftRight)
Set the
insets of the constraints to the same value for the top and bottom and the same value for the left and right. |
GBC |
insets(int top,
int left,
int bottom,
int right)
Set the
insets of the constraints. |
GBC |
ipad(int ipadx,
int ipady)
Set the
ipadx and ipady of the constraints. |
GBC |
ipadx(int ipadx)
Set the
ipadx of the constraints. |
GBC |
ipady(int ipady)
Set the
ipady of the constraints. |
GBC |
nextColumn()
Set the
gridx and gridy of the constraints to the next column. |
GBC |
nextRow()
Set the
gridx and gridy of the constraints to the next row. |
GBC |
size(int gridwidth,
int gridheight)
Set the
gridwidth and gridheight of the constraints. |
GBC |
weight(double weightx,
double weighty)
Set the
weightx and weighty of the constraints. |
GBC |
weightx(double weightx)
Set the
weightx of the constraints. |
GBC |
weighty(double weighty)
Set the
weighty of the constraints. |
GBC |
width(int gridwidth)
Set the
gridwidth of the constraints. |
public static final int RELATIVE
public static final int REMAINDER
public static final int HORIZONTAL
public static final int NONE
public static final int BOTH
public static final int VERTICAL
public static final int CENTER
public static final int NORTH
public static final int NORTHEAST
public static final int EAST
public static final int SOUTHEAST
public static final int SOUTH
public static final int SOUTHWEST
public static final int WEST
public static final int NORTHWEST
public static final int PAGE_START
public static final int PAGE_END
public static final int LINE_START
public static final int LINE_END
public static final int FIRST_LINE_START
public static final int FIRST_LINE_END
public static final int LAST_LINE_START
public static final int LAST_LINE_END
public static final int BASELINE
public static final int BASELINE_LEADING
public static final int BASELINE_TRAILING
public static final int ABOVE_BASELINE
public static final int ABOVE_BASELINE_LEADING
public static final int ABOVE_BASELINE_TRAILING
public static final int BELOW_BASELINE
public static final int BELOW_BASELINE_LEADING
public static final int BELOW_BASELINE_TRAILING
public static GBC create()
add methods will throw an IllegalStateException if used.public static GBC create(java.awt.Container parent)
parent - The parent containerpublic static java.util.OptionalInt currentGridX(java.awt.Container container)
gridx value for the specified container.gridx for the last gridy.container - The containergridx value or empty if there are no componentspublic static java.util.OptionalInt currentGridY(java.awt.Container container)
gridy value for the specified container.container - The containergridy value or empty if there are no componentspublic static int fillVerticalSpace(java.awt.Container parent)
gridy value.parent - The parent containergridy valuecurrentGridY(Container),
Box.createHorizontalGlue()public static void fillVerticalSpace(java.awt.Container parent,
int gridy)
parent - The parent containergridy - The gridy valuecurrentGridY(Container),
Box.createHorizontalGlue()public GBC nextColumn()
gridx and gridy of the constraints to the next column.public GBC nextRow()
gridx and gridy of the constraints to the next row.public GBC gridx(int gridx)
gridx of the constraints.gridx - The gridxGridBagConstraints.gridxpublic GBC gridy(int gridy)
gridy of the constraints.gridy - The gridyGridBagConstraints.gridypublic GBC grid(int gridx, int gridy)
gridx and gridy of the constraints.gridx - The gridxgridy - The gridyGridBagConstraints.gridx,
GridBagConstraints.gridypublic GBC width(int gridwidth)
gridwidth of the constraints.gridwidth - The gridwidthGridBagConstraints.gridwidthpublic GBC height(int gridheight)
gridheight of the constraints.gridheight - The gridheightGridBagConstraints.gridheightpublic GBC size(int gridwidth, int gridheight)
gridwidth and gridheight of the constraints.gridwidth - The gridwidthgridheight - The gridheightGridBagConstraints.gridwidth,
GridBagConstraints.gridheightpublic GBC weightx(double weightx)
weightx of the constraints.weightx - The weightxGridBagConstraints.weightxpublic GBC weighty(double weighty)
weighty of the constraints.weighty - The weightyGridBagConstraints.weightypublic GBC weight(double weightx, double weighty)
weightx and weighty of the constraints.weightx - The weightxweighty - The weightyGridBagConstraints.weightx,
GridBagConstraints.weightypublic GBC anchor(int anchor)
anchor of the constraints.anchor - The anchorGridBagConstraints.anchorpublic GBC fill(int fill)
fill of the constraints.fill - The fillGridBagConstraints.fillpublic GBC insets(java.awt.Insets insets)
insets of the constraints.insets - The insetsGridBagConstraints.insetspublic GBC insets(int all)
insets of the constraints to the same value for all sides.all - The value for all sidesGridBagConstraints.insetspublic GBC insets(int topBottom, int leftRight)
insets of the constraints to the same value for the top and bottom and the same value for the left and right.topBottom - The value for the top and bottomleftRight - The value for the left and rightGridBagConstraints.insetspublic GBC insets(int top, int left, int bottom, int right)
insets of the constraints.top - The value for the topleft - The value for the leftbottom - The value for the bottomright - The value for the rightGridBagConstraints.insetspublic GBC ipadx(int ipadx)
ipadx of the constraints.ipadx - The ipadxGridBagConstraints.ipadxpublic GBC ipady(int ipady)
ipady of the constraints.ipady - The ipadyGridBagConstraints.ipadypublic GBC ipad(int ipadx, int ipady)
ipadx and ipady of the constraints.ipadx - The ipadxipady - The ipadyGridBagConstraints.ipadx,
GridBagConstraints.ipadypublic GBC add(java.awt.Component component)
component - The component to addpublic GBC add(java.awt.Component component, java.lang.Runnable runnable)
component - The component to addrunnable - The runnable to configure the componentpublic <C extends java.awt.Component> GBC add(C component, java.util.function.Consumer<C> consumer)
C - The type of the componentcomponent - The component to addconsumer - The consumer to configure the componentpublic GBC add(java.util.function.Supplier<java.awt.Component> supplier)
supplier - The supplier to create the componentpublic java.awt.GridBagConstraints get()