Package org.openstreetmap.josm.tools
Class GBC
- java.lang.Object
-
- java.awt.GridBagConstraints
-
- org.openstreetmap.josm.tools.GBC
-
- All Implemented Interfaces:
Serializable
,Cloneable
public final class GBC extends GridBagConstraints
A wrapper for GridBagConstraints which has sane default static creators and member functions to chain calling.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.awt.GridBagConstraints
ABOVE_BASELINE, ABOVE_BASELINE_LEADING, ABOVE_BASELINE_TRAILING, anchor, BASELINE, BASELINE_LEADING, BASELINE_TRAILING, BELOW_BASELINE, BELOW_BASELINE_LEADING, BELOW_BASELINE_TRAILING, BOTH, CENTER, EAST, fill, FIRST_LINE_END, FIRST_LINE_START, gridheight, gridwidth, gridx, gridy, HORIZONTAL, insets, ipadx, ipady, LAST_LINE_END, LAST_LINE_START, LINE_END, LINE_START, NONE, NORTH, NORTHEAST, NORTHWEST, PAGE_END, PAGE_START, RELATIVE, REMAINDER, SOUTH, SOUTHEAST, SOUTHWEST, VERTICAL, weightx, weighty, WEST
-
-
Constructor Summary
Constructors Modifier Constructor Description private
GBC()
Use public static creator functions to create an GBC.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GBC
anchor(int a)
Set the anchor of this GBC to a.static GBC
eol()
Create the constraint for the last elements on a line.static GBC
eop()
Create the constraint for the last elements on a line and on a paragraph.GBC
fill()
Try to fill both, horizontal and verticalGBC
fill(int value)
Set fill to the given valuestatic Component
glue(int x, int y)
This is a helper to easily create a glue with a minimum default value.GBC
grid(int gridx, int gridy)
Sets the constraint'sgridx
,gridy
.GBC
insets(int insets)
Adds insets to this GBC.GBC
insets(int left, int top, int right, int bottom)
Adds insets to this GBC.GBC
span(int gridwidth)
Sets the constraint'sgridwidth
.GBC
span(int gridwidth, int gridheight)
Sets the constraint'sgridwidth
,gridheight
.static GBC
std()
Create a standard constraint (which is not the last).static GBC
std(int gridx, int gridy)
Create a standard constraint with thegridx
,gridy
set.GBC
weight(double weightx, double weighty)
Specifies how to distribute extra horizontal space.-
Methods inherited from class java.awt.GridBagConstraints
clone
-
-
-
-
Constructor Detail
-
GBC
private GBC()
Use public static creator functions to create an GBC.
-
-
Method Detail
-
std
public static GBC std()
Create a standard constraint (which is not the last).- Returns:
- A standard constraint with no filling.
-
eol
public static GBC eol()
Create the constraint for the last elements on a line.- Returns:
- A constraint which indicates the last item on a line.
-
eop
public static GBC eop()
Create the constraint for the last elements on a line and on a paragraph. This is merely a shortcut for eol().insets(0,0,0,10)- Returns:
- A constraint which indicates the last item on a line.
-
fill
public GBC fill()
Try to fill both, horizontal and vertical- Returns:
- This constraint for chaining.
-
fill
public GBC fill(int value)
Set fill to the given value- Parameters:
value
- The filling value, either NONE, HORIZONTAL, VERTICAL or BOTH- Returns:
- This constraint for chaining.
-
anchor
public GBC anchor(int a)
Set the anchor of this GBC to a.- Parameters:
a
- The new anchor, e.g. GBC.CENTER or GBC.EAST.- Returns:
- This constraint for chaining.
-
insets
public GBC insets(int left, int top, int right, int bottom)
Adds insets to this GBC.- Parameters:
left
- The left space of the insetstop
- The top space of the insetsright
- The right space of the insetsbottom
- The bottom space of the insets- Returns:
- This constraint for chaining.
-
insets
public GBC insets(int insets)
Adds insets to this GBC.- Parameters:
insets
- The insets in all directions.- Returns:
- This constraint for chaining.
- Since:
- 10649
-
weight
public GBC weight(double weightx, double weighty)
Specifies how to distribute extra horizontal space.- Parameters:
weightx
- Weight in horizontal directionweighty
- Weight in vertical direction- Returns:
- This constraint for chaining.
-
glue
public static Component glue(int x, int y)
This is a helper to easily create a glue with a minimum default value.- Parameters:
x
- If higher than 0, this will be a horizontal glue with x as minimum horizontal strut.y
- If higher than 0, this will be a vertical glue with y as minimum vertical strut.- Returns:
- the glue component
-
grid
public GBC grid(int gridx, int gridy)
Sets the constraint'sgridx
,gridy
.- Parameters:
gridx
- cell containing the leading edge of the component's display areagridy
- cell at the top of the component's display area- Returns:
- This constraint for chaining.
- See Also:
GridBagConstraints.gridx
,GridBagConstraints.gridy
-
span
public GBC span(int gridwidth, int gridheight)
Sets the constraint'sgridwidth
,gridheight
.- Parameters:
gridwidth
- number of cells in a row for the component's display areagridheight
- number of cells in a column for the component's display area- Returns:
- This constraint for chaining.
- See Also:
GridBagConstraints.gridwidth
,GridBagConstraints.gridheight
-
span
public GBC span(int gridwidth)
Sets the constraint'sgridwidth
.- Parameters:
gridwidth
- number of cells in a row for the component's display area- Returns:
- This constraint for chaining.
- See Also:
GridBagConstraints.gridwidth
-
std
public static GBC std(int gridx, int gridy)
Create a standard constraint with thegridx
,gridy
set. Is equivalent tostd().grid(gridx, gridy)
- Parameters:
gridx
- cell containing the leading edge of the component's display areagridy
- cell at the top of the component's display area- Returns:
- A standard constraint.
- See Also:
std()
,grid(int, int)
,GridBagConstraints.gridx
,GridBagConstraints.gridy
-
-