public class GBC extends GridBagConstraints
add(new JButton(action), new GBC(0, 0).both().right(4));
O código acima adiciona o botão com x = 0, y = 0, com fill = BOTH, e com um objeto 'insets' cujo 'right' tem valor = 4.
GBCSample,
Serialized FormABOVE_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 and Description |
|---|
GBC()
Construtor.
|
GBC(GBC other)
Cria um GBC a partir de outro.
|
GBC(int gridx,
int gridy)
Construtor.
|
GBC(int gridx,
int gridy,
Insets insets)
Construtor.
|
GBC(int gridx,
int gridy,
int anchor,
int fill,
Insets insets)
Construtor.
|
| Modifier and Type | Method and Description |
|---|---|
GBC |
both()
Define fill = BOTH, com pesos em X e em Y sendo '1.0'.
|
GBC |
both(double wx,
double wy)
Define fill = BOTH.
|
GBC |
bottom(int bottom)
Define insets.bottom = bottom.
|
GBC |
center()
Define anchor = CENTER.
|
GBC |
east()
Define anchor = EAST.
|
GBC |
fillx()
Faz com que o elemento aproveite espaço horizontal disponível mas não
compita com os demais na distribuição de espaço
(weightx == 0.0). |
GBC |
fillxy()
Faz com que o elemento aproveite espaço disponível em ambas as direções mas
não compita com os demais na distribuição de espaço.
|
GBC |
filly()
Faz com que o elemento aproveite espaço vertical disponível mas não compita
com os demais na distribuição de espaço
(weighty == 0.0). |
GBC |
gridheight(int gh)
Define quantas células o elemento ocupará na vertical.
|
GBC |
gridwidth(int gw)
Define quantas células o elemento ocupará na horizontal.
|
GBC |
gridx(int gx)
Define a coordenada X no grid.
|
GBC |
gridy(int gy)
Define a coordenada Y no grid.
|
GBC |
height(int height)
Define a altura (
gridheight). |
GBC |
horizontal()
Define fill = HORIZONTAL, com peso em X sendo '1.0'.
|
GBC |
horizontal(double wx)
Define fill = HORIZONTAL.
|
GBC |
insets(Insets _insets)
Define insets [margem entre o componente e sua 'célula' no grid].
|
GBC |
insets(int defaultValue)
Define insets [margem entre o componente e sua 'célula' no grid].
|
GBC |
insets(int top,
int left,
int bottom,
int right)
Define insets [margem entre o componente e sua 'célula' no grid].
|
GBC |
left(int left)
Define insets.left = left.
|
GBC |
none()
Define fill = NONE.
|
GBC |
north()
Define anchor = NORTH.
|
GBC |
northeast()
Define anchor = NORTHEAST.
|
GBC |
northwest()
Define anchor = NORTHWEST.
|
GBC |
pushx()
Associa o peso default (1.0) à direção X, anulando a expansão nesta
direção.
|
GBC |
pushx(double wx)
Associa um peso à direção X, anulando a expansão nesta direção.
|
GBC |
pushxy()
Associa o peso default (1.0) a ambas as direções, definindo
fill == NONE, |
GBC |
pushxy(double wx,
double wy)
Associa pesos a ambas as direções, definindo
fill == NONE. |
GBC |
pushy()
Associa o peso default (1.0) à direção Y, anulando a expansão nesta
direção.
|
GBC |
pushy(double wy)
Associa um peso à direção Y, anulando a expansão nesta direção.
|
GBC |
right(int right)
Define insets.right = right.
|
GBC |
south()
Define anchor = SOUTH.
|
GBC |
southeast()
Define anchor = SOUTHEAST.
|
GBC |
southwest()
Define anchor = SOUTHWEST.
|
GBC |
top(int top)
Define insets.top = top.
|
String |
toString()
Texto depurativo associado ao objeto
GBC com seus atributos
internos e parametrizações. |
GBC |
vertical()
Define fill = VERTICAL, com peso em Y sendo '1.0'.
|
GBC |
vertical(double wy)
Define fill = VERTICAL
|
GBC |
weights(double wx,
double wy)
Define os pesos nas direções horizontal e vertical.
|
GBC |
weightx(double wx)
Define o peso na direção horizontal.
|
GBC |
weighty(double wy)
Define o peso na direção vertical.
|
GBC |
west()
Define anchor = WEST.
|
GBC |
width(int width)
Define a largura (
gridwidth). |
clonepublic GBC(int gridx,
int gridy,
int anchor,
int fill,
Insets insets)
gridx - gridy - anchor - fill - insets - public GBC(int gridx,
int gridy,
Insets insets)
anchor = CENTER fill = NONE
gridx - gridy - insets - public GBC(int gridx,
int gridy)
anchor = CENTER fill = NONE insets = (0, 0, 0, 0)
gridx - gridy - public GBC()
gridx = 0 gridy = 0 anchor = CENTER fill = NONE insets = (0, 0, 0, 0)
public GBC(GBC other)
other - GBC de referênciapublic GBC none()
public GBC both()
public GBC both(double wx, double wy)
wx - - peso em X (deve ser maior ou igual a zero)wy - - peso em Y (deve ser maior ou igual a zero)public GBC vertical()
public GBC vertical(double wy)
wy - - peso em Y (deve ser maior ou igual a zero)public GBC horizontal()
public GBC horizontal(double wx)
wx - - peso em X (deve ser maior ou igual a zero)public GBC center()
public GBC north()
public GBC northeast()
public GBC east()
public GBC southeast()
public GBC south()
public GBC southwest()
public GBC west()
public GBC northwest()
public GBC pushxy()
fill == NONE,pushxy(double, double),
none()public GBC pushx()
pushx(double)public GBC pushy()
pushy()public GBC pushxy(double wx, double wy)
fill == NONE.public GBC pushx(double wx)
wx - - peso Xpublic GBC pushy(double wy)
wy - - peso Ypublic GBC fillx()
(weightx == 0.0).
O fill horizontal será adicionado ao fill existente da seguinte forma:
public GBC filly()
(weighty == 0.0).
O fill vertical será adicionado ao fill existente da seguinte forma:
public GBC fillxy()
both(0.0, 0.0).public GBC insets(Insets _insets)
_insets - - elemento do tipo Insetspublic GBC insets(int top, int left, int bottom, int right)
top - left - bottom - right - public GBC insets(int defaultValue)
defaultValue - - valor único aplicado em top, left, bottom e right.public GBC top(int top)
top - public GBC bottom(int bottom)
bottom - public GBC right(int right)
right - public GBC left(int left)
left - public GBC weightx(double wx)
wx - - pesopublic GBC weighty(double wy)
wy - - pesopublic GBC weights(double wx, double wy)
wx - - peso na direção horizontalwy - - peso na direção verticalpublic GBC width(int width)
gridwidth).width - public GBC height(int height)
gridheight).height - public GBC gridx(int gx)
gx - - coordenada X no gridpublic GBC gridy(int gy)
gy - - coordenada Y no gridpublic GBC gridwidth(int gw)
gw - - número de células ocupadas pelo componente na horizontalpublic GBC gridheight(int gh)
gh - - número de células ocupadas pelo componente na verticalCopyright © 2019 Tecgraf/PUC-Rio. All rights reserved.