|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.GridBagConstraints
acm.gui.TableConstraints
public class TableConstraints
This class specifies a set of constraints appropriate to a
TableLayout or GridBagLayout. It has
the following advantages over the GridBagConstraints
class on which it is based:
width and height
fields that can be used with TableLayout to specify
minimum heights and widths for rows and columns.
getGridX
and so forth) so that clients can operate as if the fields
are private.
toString method that
displays nondefault values of the fields in a readable way.
To create a TableConstraints object, use the
constructor with a string argument to set the fields of the
underlying GridBagConstraints object. For example,
suppose you wanted to achieve the effect of the traditional code
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 3;
gbc.fill = GridBagConstraints.BOTH;
Using TableConstraints, you can do all of this
with the constructor, as follows:
new TableConstraints("gridx=2 gridy=3 fill=BOTH");
| Field Summary | |
|---|---|
int |
height
Specifies the desired height of this cell. |
protected static String[] |
LEGAL_KEYS
|
int |
width
Specifies the desired width of this cell. |
| Fields inherited from class java.awt.GridBagConstraints |
|---|
anchor, 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 | |
|---|---|
TableConstraints()
Creates a new TableConstraints object with default
values for each of the fields. |
|
TableConstraints(GridBagConstraints gbc)
Creates a new TableConstraints object whose fields match those
of the specified GridBagConstraints object. |
|
TableConstraints(Map<String,String> map)
Creates a new TableConstraints object whose components
are the key/value pairs in the map. |
|
TableConstraints(String str)
Creates a new TableConstraints object whose components
are initialized according from the specified string. |
|
| Method Summary | |
|---|---|
int |
getAnchor()
Returns the anchor field from the constraint. |
int |
getFill()
Returns the fill field from the constraint. |
int |
getGridHeight()
Returns the gridheight field from the constraint. |
int |
getGridWidth()
Returns the gridwidth field from the constraint. |
int |
getGridX()
Returns the gridx field from the constraint. |
int |
getGridY()
Returns the gridy field from the constraint. |
int |
getHeight()
Returns the height field from the constraint. |
Insets |
getInsets()
Returns the insets field from the constraint. |
int |
getIPadX()
Returns the ipadx field from the constraint. |
int |
getIPadY()
Returns the ipady field from the constraint. |
double |
getWeightX()
Returns the weightx field from the constraint. |
double |
getWeightY()
Returns the weighty field from the constraint. |
int |
getWidth()
Returns the width field from the constraint. |
String |
toString()
Converts the constraint into a readable string. |
| Methods inherited from class java.awt.GridBagConstraints |
|---|
clone |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public int height
protected static final String[] LEGAL_KEYS
public int width
| Constructor Detail |
|---|
public TableConstraints()
TableConstraints object with default
values for each of the fields.
public TableConstraints(GridBagConstraints gbc)
TableConstraints object whose fields match those
of the specified GridBagConstraints object. Clients will not
ordinarily need to call this version of the constructor.
gbc - The GridBagConstraints object to copypublic TableConstraints(Map<String,String> map)
TableConstraints object whose components
are the key/value pairs in the map.
map - A map containing the key/value pairspublic TableConstraints(String str)
TableConstraints object whose components
are initialized according from the specified string. Each field is
initialized by specifying a binding in the form
key=value
where key is the name of one of the public fields
in the TableConstraints class and value is the
corresponding value, which can be expressed either as an integer
or as one of the constant names appropriate to that field. For
example, the string
"width=20 fill=BOTH"
would create a TableConstraints object whose
width field was set to 20 and whose fill
field was set the the constant GridBagConstraints.BOTH.
As a special case, the four elements of the insets
field can be set using the key names left, right,
top, and bottom. Also, because the names
are more likely to indicate their purposes to novices, the HTML names
rowspan and colspan can be used in place
of gridwidth and gridheight.
str - The constraint string as a series of key/value pairs| Method Detail |
|---|
public int getAnchor()
anchor field from the constraint.
anchor field from the constraintpublic int getFill()
fill field from the constraint.
fill field from the constraintpublic int getGridHeight()
gridheight field from the constraint.
gridheight field from the constraintpublic int getGridWidth()
gridwidth field from the constraint.
gridwidth field from the constraintpublic int getGridX()
gridx field from the constraint.
gridx field from the constraintpublic int getGridY()
gridy field from the constraint.
gridy field from the constraintpublic int getHeight()
height field from the constraint.
height field from the constraintpublic Insets getInsets()
insets field from the constraint.
insets field from the constraintpublic int getIPadX()
ipadx field from the constraint.
ipadx field from the constraintpublic int getIPadY()
ipady field from the constraint.
ipady field from the constraintpublic double getWeightX()
weightx field from the constraint.
weightx field from the constraintpublic double getWeightY()
weighty field from the constraint.
weighty field from the constraintpublic int getWidth()
width field from the constraint.
width field from the constraintpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||