|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.GridBagConstraints | +--acm.gui.TableConstraints
public class TableConstraints extends GridBagConstraints
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:
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
Using TableConstraints, you can do all of this with the constructor, as follows:
Field Summary | |
int | height |
int | width |
Constructor Summary | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TableConstraints()
|
Constructor Detail |
public TableConstraints()
Usage: | TableConstraints constraints = new TableConstraints(); |
public TableConstraints(String str)
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.
Usage: | TableConstraints constraints = new TableConstraints(str); | ||
Parameter: |
|
Method Detail |
public int getAnchor()
Usage: | int anchor = constraint.getAnchor(); |
Returns: | The anchor field from the constraint |
public int getFill()
Usage: | int fill = constraint.getFill(); |
Returns: | The fill field from the constraint |
public int getGridHeight()
Usage: | int gridheight = constraint.getGridHeight(); |
Returns: | The gridheight field from the constraint |
public int getGridWidth()
Usage: | int gridwidth = constraint.getGridWidth(); |
Returns: | The gridwidth field from the constraint |
public int getGridX()
Usage: | int gridx = constraint.getGridX(); |
Returns: | The gridx field from the constraint |
public int getGridY()
Usage: | int gridy = constraint.getGridY(); |
Returns: | The gridy field from the constraint |
public int getHeight()
Usage: | int height = constraint.getHeight(); |
Returns: | The height field from the constraint |
public Insets getInsets()
Usage: | Insets insets = constraint.getInsets(); |
Returns: | The insets field from the constraint |
public int getIPadX()
Usage: | int ipadx = constraint.getIPadX(); |
Returns: | The ipadx field from the constraint |
public int getIPadY()
Usage: | int ipady = constraint.getIPadY(); |
Returns: | The ipady field from the constraint |
public double getWeightX()
Usage: | double weightx = constraint.getWeightX(); |
Returns: | The weightx field from the constraint |
public double getWeightY()
Usage: | double weighty = constraint.getWeightY(); |
Returns: | The weighty field from the constraint |
public int getWidth()
Usage: | int width = constraint.getWidth(); |
Returns: | The width field from the constraint |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |