public class GridBagUtils extends Object
JPanel
s with a GridBagLayout
layout manager.Constructor and Description |
---|
GridBagUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addHorizontalFiller(JPanel panel,
GridBagConstraints gbc) |
static void |
addToPanel(JPanel panel,
Component comp,
GridBagConstraints gbc)
Adds a component to a panel with a grid bag layout.
|
static void |
addToPanel(JPanel panel,
Component comp,
GridBagConstraints gbc,
String code)
Adds a component to a panel with a grid bag layout.
|
static void |
addVerticalFiller(JPanel panel,
GridBagConstraints gbc) |
static GridBagConstraints |
createConstraints(String code)
Creates a
GridBagConstraints instance with the attributes given as a comma separated key-value pairs
in a text string. |
static GridBagConstraints |
createDefaultConstraints()
Creates a
GridBagConstraints instance with the following attributes:
anchor =WEST
insets.top =0
insets.left =3
insets.bottom =0
insets.right =3
|
static JPanel |
createDefaultEmptyBorderPanel() |
static JPanel |
createPanel() |
static GridBagConstraints |
setAttributes(GridBagConstraints gbc,
String code)
Sets the attributes of a given
GridBagConstraints instance to the attribute values given as a comma
separated key-value pairs in a text string. |
public static JPanel createPanel()
public static JPanel createDefaultEmptyBorderPanel()
public static GridBagConstraints createConstraints(String code)
GridBagConstraints
instance with the attributes given as a comma separated key-value pairs
in a text string.
According to the public GridBagConstraints
attributes, the following key-value pairs are can
occur in the text string:
gridx
=RELATIVE|integer
gridy
=RELATIVE|integer
gridwidth
=REMAINDER|RELATIVE|integer
gridheight
=REMAINDER|RELATIVE|integer
weightx
=double
weighty
=double
anchor
=CENTER|NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|integer
fill
=NONE|HORIZONTAL|VERTICAL|BOTH|integer
insets.bottom
=integer
insets.left
=integer
insets.right
=integer
insets.top
=integer
ipadx
=integer
ipady
=integer
code
- a textual representation of the attributes to be setpublic static GridBagConstraints createDefaultConstraints()
GridBagConstraints
instance with the following attributes:
anchor
=WESTinsets.top
=0insets.left
=3insets.bottom
=0insets.right
=3public static void addToPanel(JPanel panel, Component comp, GridBagConstraints gbc)
panel
- the panel to which to add the componentcomp
- the component to be addedgbc
- the grid bag constraints to be used, can be null
if code
is not
null
public static void addToPanel(JPanel panel, Component comp, GridBagConstraints gbc, String code)
For the code
parameter, see also setAttributes(GridBagConstraints, String)
.
panel
- the panel to which to add the componentcomp
- the component to be addedgbc
- the grid bag constraints to be used, can be null
if code
is not
null
code
- the code containing the constraints, can be null
if gbc
is not
null
setAttributes(GridBagConstraints, String)
public static void addHorizontalFiller(JPanel panel, GridBagConstraints gbc)
public static void addVerticalFiller(JPanel panel, GridBagConstraints gbc)
public static GridBagConstraints setAttributes(GridBagConstraints gbc, String code)
GridBagConstraints
instance to the attribute values given as a comma
separated key-value pairs in a text string.
According to the public GridBagConstraints
attributes, the following key-value pairs are can
occur in the text string:
gridx
=RELATIVE|integer
gridy
=RELATIVE|integer
gridwidth
=REMAINDER|RELATIVE|integer
gridheight
=REMAINDER|RELATIVE|integer
weightx
=double
weighty
=double
anchor
=CENTER|NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|integer
fill
=NONE|HORIZONTAL|VERTICAL|BOTH|integer
insets.bottom
=integer
insets.left
=integer
insets.right
=integer
insets.top
=integer
ipadx
=integer
ipady
=integer
gbc
- the grid bag constraints whose attributes are to be set, must not be nullcode
- a textual representation of the attributes to be setCopyright © 2014–2015 European Space Agency (ESA). All rights reserved.