Class TableLayout
- java.lang.Object
- 
- com.inductiveautomation.ignition.client.util.gui.tablelayout.TableLayout
 
- 
- All Implemented Interfaces:
- TableLayoutConstants,- java.awt.LayoutManager,- java.awt.LayoutManager2,- java.io.Serializable
 
 public class TableLayout extends java.lang.Object implements java.awt.LayoutManager2, java.io.Serializable, TableLayoutConstants TableLayout is a layout manager that is more powerful than GridBagLayout yet much easier to use. Background TableLayout is a layout manager that arranges components in rows and columns like a spreadsheet. TableLayout allows each row or column to be a different size. A row or column can be given an absolute size in pixels, a percentage of the available space, or it can grow and shrink to fill the remaining space after other rows and columns have been resized. Using spreadsheet terminology, a cell is the intersection of a row and column. Cells have finite, non-negative sizes measured in pixels. The dimensions of a cell depend solely upon the dimensions of its row and column. A component occupies a rectangular group of one or more cells. The component can be aligned within those cells using four vertical and six horizontal justifications. The vertical justifications are left, center, right, and full. The horizontal justifications are left, center, right, full, leading, and trailing. With full justification the component is stretched either vertically or horizontally to fit the cell or group of cells. Justification Leading and trailing justification are used to support languages that are read from right to left. See the java.awt.ComponentOrientationclass for details and http://java.sun.com/products/jfc/tsc/articles/bidi for an introduction to component orientation and bidirectional text support. The leading justification will align the component along the leading edge of the container and the trailing justification will align the component along the trailing edge. There is no leading or trailing justification along the vertical axis since all modern languages are read from top to bottom and no bottom-to-top orientation is defined injava.awt.ComponentOrientation.For components using the ComponentOrientation.LEFT_TO_RIGHTorientation, the leading edge is the left edge and the trailing edge is the right one. For components using theComponentOrientation.RIGHT_TO_LEFTorientation, the opposite is true. For components that are usingComponentOrientation.UNKNOWNand for Java runtime environments that do not support component orientation, left-to-right orientation is assumed for backwards compatibility.Gaps Horizontal and vertical gaps can be placed between rows and columns in two ways. If uniformed gaps are desired, the setHGapandsetVGapmethods may be used. To vary the size of gaps, simply use empty rows and columns with absolute sizes. Similiarly, to make a border around a container that does not have insets, use empty rows and columns along the edges of the container.Constraints Using TableLayout is a simple two step process. First, create a grid for your container by specifying row and column sizes using either a TableLayout constructor or the insertRowandinsertColumnmethods. Second, add components to the cells formed by the rows and columns.When adding a component to a container that uses TableLayout, you specify the component's constraints that state which cells the component will occupy and how the component will be aligned. The constraints can be specified into two ways. The TableLayoutConstraintsclass can be used to systematically specify the constraints. This is useful to dynamic code, bean builders, and rapid application development software.For manual coding, a quicker and easier way to specify constraints is with a short string in the form "x1, y1, x2, y2, hAlign, vAlign" where (x1, y1) identifies the top left cell (column x1, row y1) for the component and (x2, y2) identfies the bottom right cell. x2 and y2 are optional. If they are not specified, the component will occupy only one cell, (x1, y1). hAlign and vAlign are also optional with default values of full justification. Alignments may be spelt fully as in "LEFT" or abbreviated as in "L". The text is not case sensitive, but it is recommended that uppercase is used for two reasons. First, these text values are in essence constants. Second, some fonts use the same glyphs for representing a lowercase L and the number one. Ex., "l" vs. "1". Even fonts that do not will often use similar glyphs so using uppercase avoids confusion. Dynamically altering the layout Rows and columns can be dynamically created, resized, and removed at any time, even if the container is visible. Components will be shifted appropriately as rows and columns are inserted or removed, just as cells are shifted in a spreadsheet. Rows and columns can be made "hidden" or effectively invisible by setting their size to zero. They can be shown again by setting their size back to a non-zero value. This is very useful for toggle form elements without having to remove individual components. Preferred sizes Often it is desireable to make a row or column just large enough to ensure that all components contained partially or wholly in that row or column are their preferred size. To make this easy, there is a constant called PREFERREDthat can be used to specify row or column sizes. There is another constant calledMINIMUMthat does a similar task using components' minimum sizes instead of their preferred sizes.There is no corresponding MAXIMUMconstant for several reasons. First, it is mathematically impossible to honor both the minimum and maximum sizes of more than one component when conflicts arise. For example, say components a and b are in the same row. If a's maximum height is less than b's minimum height, then one of these constraints must be violated. Since TableLayout is a complete, general Cartesian layout manager, it would be possible to specify conflicting constraints if aMAXIMUMconstant existed.Second, the ability to make a component grow up to a maximum size is primarily of interest to layout managers like SpringLayoutthat have to balance the sizes of components because the presence of one component affects the size of another. Other than the effect of preferred and minimum size rows/columns, which are essentially convenient ways of specifying absolute sizes, the existence and constraints of one component does not affect any other components when using TableLayout. This is accomplished because rows and columns are explicit in TableLayout.Third, the ability to constrain a component to its maximum size is subsumed by the ability to constrain it to its preferred size, which is precisely what happens when a component is aligned using anything but full justification. In the case of full justification, the component's maximum size is by definition unbounded. Example import java.awt.*; import javax.swing.*; import info.clearthought.layout.TableLayout; <spc> public class Preferred extends JFrame { <spc> public static void main (String args[]) { new Preferred(); } <spc> public Preferred () { super("The Power of Preferred Sizes"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container pane = getContentPane(); <spc> // b - border // f - FILL // p - PREFERRED // vs - vertical space between labels and text fields // vg - vertical gap between form elements // hg - horizontal gap between form elements <spc> double b = 10; double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double vs = 5; double vg = 10; double hg = 10; <spc> double size[][] = {{b, f, hg, p, hg, p, b}, {b, p, vs, p, vg, p, vs, p, vg, p, vs, p, vg, p, b}}; <spc> TableLayout layout = new TableLayout(size); pane.setLayout (layout); <spc> // Create all controls JLabel labelName = new JLabel("Name"); JLabel labelAddress = new JLabel("Address"); JLabel labelCity = new JLabel("City"); JLabel labelState = new JLabel("State"); JLabel labelZip = new JLabel("Zip"); <spc> JTextField textfieldName = new JTextField(10); JTextField textfieldAddress = new JTextField(20); JTextField textfieldCity = new JTextField(10); JTextField textfieldState = new JTextField(2); JTextField textfieldZip = new JTextField(5); <spc> JButton buttonOk = new JButton("OK"); JButton buttonCancel = new JButton("Cancel"); JPanel panelButton = new JPanel(); panelButton.add(buttonOk); panelButton.add(buttonCancel); <spc> // Add all controls pane.add(labelName, "1, 1, 5, 1"); pane.add(textfieldName, "1, 3, 5, 3"); pane.add(labelAddress, "1, 5, 5, 5"); pane.add(textfieldAddress, "1, 7, 5, 7"); pane.add(labelCity, "1, 9"); pane.add(textfieldCity, "1, 11"); pane.add(labelState, "3, 9"); pane.add(textfieldState, "3, 11"); pane.add(labelZip, "5, 9"); pane.add(textfieldZip, "5, 11"); pane.add(panelButton, "1, 13, 5, 13"); <spc> pack(); setResizable(false); show(); } }- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classTableLayout.Entry
 - 
Field SummaryFields Modifier and Type Field Description protected static intCIndicates a columnprotected static booleancheckForComponentOrientationSupportUsed to minimize reflection callsprotected int[][]crOffsetOffsets of crs in pixels.protected int[][]crSizeSizes of crs in pixelsprotected double[][]crSpecSizes of crs expressed in absolute and relative termsprotected static double[][]defaultSizeDefault row/column sizeprotected booleandirtyIndicates whether or not the size of the cells are known for the last known size of the container.protected inthGapHorizontal gap between columnsprotected java.util.LinkedListlistList of components and their sizesprotected static java.lang.reflect.MethodmethodGetComponentOrientationMethod used to get component orientation while preserving compatability with earlier versions of java.awt.Container.protected intoldHeightPrevious known height of the containerprotected intoldWidthPrevious known width of the containerprotected static intRIndicates a rowprotected intvGapVertical gap between rows
 - 
Constructor SummaryConstructors Constructor Description TableLayout()Constructs an instance of TableLayout.TableLayout(double[][] size)Constructs an instance of TableLayout.TableLayout(double[] col, double[] row)Constructs an instance of TableLayout.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLayoutComponent(java.awt.Component component, java.lang.Object constraint)Adds the specified component with the specified name to the layout.voidaddLayoutComponent(java.lang.String name, java.awt.Component component)Adds the specified component with the specified name to the layout.protected intassignAbsoluteSize(int z, int availableSize)Assigns absolute sizes.protected voidassignFillSize(int z, int availableSize)Assigns FILL sizes.protected intassignPrefMinSize(int z, int availableSize, double typeOfSize)Assigned sizes to preferred and minimum size columns and rows.protected intassignRelativeSize(int z, int availableSize)Assigns relative sizes.protected java.awt.DimensioncalculateLayoutSize(java.awt.Container container, double typeOfSize)Calculates the preferred or minimum size for the methods preferredLayoutSize and minimumLayoutSize.protected intcalculateLayoutSize(java.awt.Container container, int z, double typeOfSize, TableLayout.Entry[] entryList, java.awt.Dimension[] prefMinSize)Calculates the preferred or minimum size for the method calculateLayoutSize(Container container, double typeOfSize).protected voidcalculateOffset(int z, java.awt.Insets inset)Calculates the offset of each cr.protected voidcalculateSize(java.awt.Container container)Calculates the sizes of the rows and columns based on the absolute and relative sizes specified incrSpec[R]andcrSpec[C]and the size of the container.protected int[]calculateSizeAndOffset(TableLayout.Entry entry, int preferredSize, boolean isColumn)Calculates the vertical/horizontal offset and size of a component.voiddeleteColumn(int i)Deletes a column in this layout.protected voiddeleteCr(int z, int i)Deletes a cr for the methods deleteRow or deleteColumn.voiddeleteRow(int i)Deletes a row in this layout.double[]getColumn()Gets the sizes of columns in this layout.doublegetColumn(int i)Gets the width of a single column in this layout.protected java.awt.ComponentOrientationgetComponentOrientation(java.awt.Container container)Gets the container's component orientation.TableLayoutConstraintsgetConstraints(java.awt.Component component)Gets the constraints of a given component.intgetHGap()Gets the horizontal gap between colunns.java.util.ListgetInvalidEntry()Determines whether or not there are any components with invalid constraints.floatgetLayoutAlignmentX(java.awt.Container parent)Returns the alignment along the x axis.floatgetLayoutAlignmentY(java.awt.Container parent)Returns the alignment along the y axis.intgetNumColumn()Gets the number of columns in this layout.intgetNumRow()Gets the number of rows in this layout.java.util.ListgetOverlappingEntry()Gets a list of overlapping components and their constraints.double[]getRow()Gets the height of a single row in this layout.doublegetRow(int i)Gets the sizes of a row in this layout.intgetVGap()Gets the vertical gap between rows.protected voidinit(double[] col, double[] row)Initializes the TableLayout for all constructors.voidinsertColumn(int i, double size)Inserts a column in this layout.voidinsertCr(int z, int i, double size)Inserts a cr for the methods insertRow or insertColumn.voidinsertRow(int i, double size)Inserts a row in this layout.voidinvalidateLayout(java.awt.Container target)Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.voidlayoutContainer(java.awt.Container container)To lay out the specified container using this layout.java.awt.DimensionmaximumLayoutSize(java.awt.Container target)Returns the maximum dimensions for this layout given the components in the specified target container.java.awt.DimensionminimumLayoutSize(java.awt.Container container)Determines the minimum size of the container argument using this layout.java.awt.DimensionpreferredLayoutSize(java.awt.Container container)Determines the preferred size of the container argument using this layout.voidremoveLayoutComponent(java.awt.Component component)Removes the specified component from the layout.voidsetColumn(double[] column)Adjusts the number and sizes of rows in this layout.voidsetColumn(int i, double size)Adjusts the width of a single column in this layout.voidsetConstraints(java.awt.Component component, TableLayoutConstraints constraint)Sets the constraints of a given component.protected voidsetCr(int z, double[] size)Sets the sizes of rows or columns for the methods setRow or setColumn.protected voidsetCr(int z, int i, double size)Sets the sizes of rows or columns for the methods setRow or setColumn.voidsetHGap(int hGap)Sets the horizontal gap between colunns.voidsetRow(double[] row)Adjusts the number and sizes of rows in this layout.voidsetRow(int i, double size)Adjusts the height of a single row in this layout.voidsetVGap(int vGap)Sets the vertical gap between rows.java.lang.StringtoString()Converts this TableLayout to a string.
 
- 
- 
- 
Field Detail- 
defaultSizeprotected static final double[][] defaultSize Default row/column size
 - 
Cprotected static final int C Indicates a column- See Also:
- Constant Field Values
 
 - 
Rprotected static final int R Indicates a row- See Also:
- Constant Field Values
 
 - 
checkForComponentOrientationSupportprotected static boolean checkForComponentOrientationSupport Used to minimize reflection calls
 - 
methodGetComponentOrientationprotected static java.lang.reflect.Method methodGetComponentOrientation Method used to get component orientation while preserving compatability with earlier versions of java.awt.Container. Necessary for supporting older JDKs and MicroEdition versions of Java.
 - 
crSpecprotected double[][] crSpec Sizes of crs expressed in absolute and relative terms
 - 
crSizeprotected int[][] crSize Sizes of crs in pixels
 - 
crOffsetprotected int[][] crOffset Offsets of crs in pixels. The left boarder of column n is at crOffset[C][n] and the right boarder is at cr[C][n + 1] for all columns including the last one. crOffset[C].length = crSize[C].length + 1
 - 
listprotected java.util.LinkedList list List of components and their sizes
 - 
dirtyprotected boolean dirty Indicates whether or not the size of the cells are known for the last known size of the container. If dirty is true or the container has been resized, the cell sizes must be recalculated using calculateSize.
 - 
oldWidthprotected int oldWidth Previous known width of the container
 - 
oldHeightprotected int oldHeight Previous known height of the container
 - 
hGapprotected int hGap Horizontal gap between columns
 - 
vGapprotected int vGap Vertical gap between rows
 
- 
 - 
Constructor Detail- 
TableLayoutpublic TableLayout() Constructs an instance of TableLayout. This TableLayout will have no columns or rows. This constructor is most useful for bean-oriented programming and dynamically adding columns and rows.
 - 
TableLayoutpublic TableLayout(double[][] size) Constructs an instance of TableLayout.- Parameters:
- size- widths of columns and heights of rows in the format, {{col0, col1, col2, ..., colN}, {row0, row1, row2, ..., rowM}} If this parameter is invalid, the TableLayout will have exactly one row and one column.
 
 - 
TableLayoutpublic TableLayout(double[] col, double[] row)Constructs an instance of TableLayout.- Parameters:
- col- widths of columns in the format, {{col0, col1, col2, ..., colN}
- row- heights of rows in the format, {{row0, row1, row2, ..., rowN}
 
 
- 
 - 
Method Detail- 
initprotected void init(double[] col, double[] row)Initializes the TableLayout for all constructors.- Parameters:
- col- widths of columns in the format, {{col0, col1, col2, ..., colN}
- row- heights of rows in the format, {{row0, row1, row2, ..., rowN}
 
 - 
getConstraintspublic TableLayoutConstraints getConstraints(java.awt.Component component) Gets the constraints of a given component.- Parameters:
- component- desired component
- Returns:
- If the given component is found, the constraints associated with that component. If the given component is null or is not found, null is returned.
 
 - 
setConstraintspublic void setConstraints(java.awt.Component component, TableLayoutConstraints constraint)Sets the constraints of a given component.- Parameters:
- component- desired component. This parameter cannot be null.
- constraint- new set of constraints. This parameter cannot be null.
 
 - 
setColumnpublic void setColumn(double[] column) Adjusts the number and sizes of rows in this layout. After calling this method, the caller should request this layout manager to perform the layout. This can be done with the following code:layout.layoutContainer(container); container.repaint(); or window.pack() If this is not done, the changes in the layout will not be seen until the container is resized. - Parameters:
- column- widths of each of the columns
- See Also:
- getColumn()
 
 - 
setRowpublic void setRow(double[] row) Adjusts the number and sizes of rows in this layout. After calling this method, the caller should request this layout manager to perform the layout. This can be done with the following code:layout.layoutContainer(container); container.repaint();or window.pack() If this is not done, the changes in the layout will not be seen until the container is resized. - Parameters:
- row- heights of each of the rows. This parameter cannot be null.
- See Also:
- getRow()
 
 - 
setCrprotected void setCr(int z, double[] size)Sets the sizes of rows or columns for the methods setRow or setColumn.- Parameters:
- z- indicates row or column
- size- new cr size
 
 - 
setColumnpublic void setColumn(int i, double size)Adjusts the width of a single column in this layout. After calling this method, the caller should request this layout manager to perform the layout. This can be done with the following code:layout.layoutContainer(container); container.repaint();or window.pack() If this is not done, the changes in the layout will not be seen until the container is resized. - Parameters:
- i- zero-based index of column to set. If this parameter is not valid, an ArrayOutOfBoundsException will be thrown.
- size- width of the column. This parameter cannot be null.
- See Also:
- getColumn()
 
 - 
setRowpublic void setRow(int i, double size)Adjusts the height of a single row in this layout. After calling this method, the caller should request this layout manager to perform the layout. This can be done with the following code:layout.layoutContainer(container); container.repaint();or window.pack() If this is not done, the changes in the layout will not be seen until the container is resized. - Parameters:
- i- zero-based index of row to set. If this parameter is not valid, an ArrayOutOfBoundsException will be thrown.
- size- height of the row. This parameter cannot be null.
- See Also:
- getRow()
 
 - 
setCrprotected void setCr(int z, int i, double size)Sets the sizes of rows or columns for the methods setRow or setColumn.- Parameters:
- z- indicates row or column
- i- indicates which cr to resize
- size- new cr size
 
 - 
getColumnpublic double[] getColumn() Gets the sizes of columns in this layout.- Returns:
- widths of each of the columns
- See Also:
- setColumn(double[])
 
 - 
getRowpublic double[] getRow() Gets the height of a single row in this layout.- Returns:
- height of the requested row
- See Also:
- setRow(double[])
 
 - 
getColumnpublic double getColumn(int i) Gets the width of a single column in this layout.- Parameters:
- i- zero-based index of row to get. If this parameter is not valid, an ArrayOutOfBoundsException will be thrown.
- Returns:
- width of the requested column
- See Also:
- setRow(double[])
 
 - 
getRowpublic double getRow(int i) Gets the sizes of a row in this layout.- Parameters:
- i- zero-based index of row to get. If this parameter is not valid, an ArrayOutOfBoundsException will be thrown.
- Returns:
- height of each of the requested row
- See Also:
- setRow(double[])
 
 - 
getNumColumnpublic int getNumColumn() Gets the number of columns in this layout.- Returns:
- the number of columns
 
 - 
getNumRowpublic int getNumRow() Gets the number of rows in this layout.- Returns:
- the number of rows
 
 - 
getHGappublic int getHGap() Gets the horizontal gap between colunns.- Returns:
- the horizontal gap in pixels
 
 - 
getVGappublic int getVGap() Gets the vertical gap between rows.- Returns:
- the vertical gap in pixels
 
 - 
setHGappublic void setHGap(int hGap) Sets the horizontal gap between colunns.- Parameters:
- hGap- the horizontal gap in pixels
 
 - 
setVGappublic void setVGap(int vGap) Sets the vertical gap between rows.- Parameters:
- vGap- the horizontal gap in pixels
 
 - 
insertColumnpublic void insertColumn(int i, double size)Inserts a column in this layout. All components to the right of the insertion point are moved right one column. The container will need to be laid out after this method returns. SeesetColumn.- Parameters:
- i- zero-based index at which to insert the column
- size- size of the column to be inserted
- See Also:
- setColumn(double[]),- deleteColumn(int)
 
 - 
insertRowpublic void insertRow(int i, double size)Inserts a row in this layout. All components below the insertion point are moved down one row. The container will need to be laid out after this method returns. SeesetRow.- Parameters:
- i- zero-based index at which to insert the row
- size- size of the row to be inserted
- See Also:
- setRow(double[]),- deleteRow(int)
 
 - 
insertCrpublic void insertCr(int z, int i, double size)Inserts a cr for the methods insertRow or insertColumn.- Parameters:
- z- indicates row or column
- i- zero-based index at which to insert the cr
- size- size of cr being inserted
 
 - 
deleteColumnpublic void deleteColumn(int i) Deletes a column in this layout. All components to the right of the deletion point are moved left one column. The container will need to be laid out after this method returns. SeesetColumn.- Parameters:
- i- zero-based index of column to delete
- See Also:
- setColumn(double[]),- deleteColumn(int)
 
 - 
deleteRowpublic void deleteRow(int i) Deletes a row in this layout. All components below the deletion point are moved up one row. The container will need to be laid out after this method returns. SeesetRow. There must be at least two rows in order to delete a row.- Parameters:
- i- zero-based index of row to delete
- See Also:
- setRow(double[]),- deleteRow(int)
 
 - 
deleteCrprotected void deleteCr(int z, int i)Deletes a cr for the methods deleteRow or deleteColumn.- Parameters:
- z- indicates row or column
- i- zero-based index of cr to delete
 
 - 
toStringpublic java.lang.String toString() Converts this TableLayout to a string.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- a string representing the columns and row sizes in the form "{{col0, col1, col2, ..., colN}, {row0, row1, row2, ..., rowM}}"
 
 - 
getInvalidEntrypublic java.util.List getInvalidEntry() Determines whether or not there are any components with invalid constraints. An invalid constraint is one that references a non-existing row or column. For example, on a table with five rows, row -1 and row 5 are both invalid. Valid rows are 0 through 4, inclusively. This method is useful for debugging.- Returns:
- a list of TableLayout.Entry instances refering to the invalid constraints and corresponding components
- See Also:
- getOverlappingEntry()
 
 - 
getOverlappingEntrypublic java.util.List getOverlappingEntry() Gets a list of overlapping components and their constraints. Two components overlap if they cover at least one common cell. This method is useful for debugging.- Returns:
- a list of zero or more TableLayout.Entry instances
- See Also:
- getInvalidEntry()
 
 - 
calculateSizeprotected void calculateSize(java.awt.Container container) Calculates the sizes of the rows and columns based on the absolute and relative sizes specified incrSpec[R]andcrSpec[C]and the size of the container. The result is stored incrSize[R]andcrSize[C].- Parameters:
- container- container using this TableLayout
 
 - 
assignAbsoluteSizeprotected int assignAbsoluteSize(int z, int availableSize)Assigns absolute sizes.- Parameters:
- z- indicates row or column
- availableSize- amount of space available in the container
- Returns:
- the amount of space available after absolute crs have been assigned sizes
 
 - 
assignRelativeSizeprotected int assignRelativeSize(int z, int availableSize)Assigns relative sizes.- Parameters:
- z- indicates row or column
- availableSize- amount of space available in the container
- Returns:
- the amount of space available after relative crs have been assigned sizes
 
 - 
assignFillSizeprotected void assignFillSize(int z, int availableSize)Assigns FILL sizes.- Parameters:
- z- indicates row or column
- availableSize- amount of space available in the container
 
 - 
calculateOffsetprotected void calculateOffset(int z, java.awt.Insets inset)Calculates the offset of each cr.- Parameters:
- z- indicates row or column
 
 - 
assignPrefMinSizeprotected int assignPrefMinSize(int z, int availableSize, double typeOfSize)Assigned sizes to preferred and minimum size columns and rows. This reduces the available width and height. Minimum widths/heights must be calculated first because they affect preferred widths/heights, but not vice versa. The end result is that any component contained wholly or partly in a column/row of minimum/preferred width or height will get at least its minimum/preferred width or height, respectively.- Parameters:
- z- indicates row or column
- availableSize- amount of space available in the container
- typeOfSize- indicates preferred or minimum
- Returns:
- the amount of space available after absolute crs have been assigned sizes
 
 - 
layoutContainerpublic void layoutContainer(java.awt.Container container) To lay out the specified container using this layout. This method reshapes the components in the specified target container in order to satisfy the constraints of all components.User code should not have to call this method directly. - Specified by:
- layoutContainerin interface- java.awt.LayoutManager
- Parameters:
- container- container being served by this layout manager
 
 - 
getComponentOrientationprotected java.awt.ComponentOrientation getComponentOrientation(java.awt.Container container) Gets the container's component orientation. If a JDK that does not support component orientation is being used, then null is returned.- Parameters:
- container- Container whose orientation is being queried
- Returns:
- the container's orientation or null if no orientation is supported
 
 - 
calculateSizeAndOffsetprotected int[] calculateSizeAndOffset(TableLayout.Entry entry, int preferredSize, boolean isColumn) Calculates the vertical/horizontal offset and size of a component.- Parameters:
- entry- entry containing component and contraints
- preferredSize- previously calculated preferred width/height of component
- isColumn- if true, this method is being called to calculate the offset/size of a column. if false,... of a row.
- Returns:
- an array, a, of two integers such that a[0] is the offset and a[1] is the size
 
 - 
preferredLayoutSizepublic java.awt.Dimension preferredLayoutSize(java.awt.Container container) Determines the preferred size of the container argument using this layout. The preferred size is the smallest size that, if used for the container's size, will ensure that all components are at least as large as their preferred size. This method cannot guarantee that all components will be their preferred size. For example, if component A and component B are each allocated half of the container's width and component A wants to be 10 pixels wide while component B wants to be 100 pixels wide, they cannot both be accommodated. Since in general components would rather be larger than their preferred size instead of smaller, component B's request will be fulfilled. The preferred size of the container would be 200 pixels.- Specified by:
- preferredLayoutSizein interface- java.awt.LayoutManager
- Parameters:
- container- container being served by this layout manager
- Returns:
- a dimension indicating the container's preferred size
 
 - 
minimumLayoutSizepublic java.awt.Dimension minimumLayoutSize(java.awt.Container container) Determines the minimum size of the container argument using this layout. The minimum size is the smallest size that, if used for the container's size, will ensure that all components are at least as large as their minimum size. This method cannot guarantee that all components will be their minimum size. For example, if component A and component B are each allocated half of the container's width and component A wants to be 10 pixels wide while component B wants to be 100 pixels wide, they cannot both be accommodated. Since in general components rather be larger than their minimum size instead of smaller, component B's request will be fulfilled. The minimum size of the container would be 200 pixels.- Specified by:
- minimumLayoutSizein interface- java.awt.LayoutManager
- Parameters:
- container- container being served by this layout manager
- Returns:
- a dimension indicating the container's minimum size
 
 - 
calculateLayoutSizeprotected java.awt.Dimension calculateLayoutSize(java.awt.Container container, double typeOfSize)Calculates the preferred or minimum size for the methods preferredLayoutSize and minimumLayoutSize.- Parameters:
- container- container whose size is being calculated
- typeOfSize- indicates preferred or minimum
- Returns:
- a dimension indicating the container's preferred or minimum size
 
 - 
calculateLayoutSizeprotected int calculateLayoutSize(java.awt.Container container, int z, double typeOfSize, TableLayout.Entry[] entryList, java.awt.Dimension[] prefMinSize)Calculates the preferred or minimum size for the method calculateLayoutSize(Container container, double typeOfSize). This method is passed the preferred/minimum sizes of the components so that the potentially expensive methods getPreferredSize()/getMinimumSize() are not called twice for the same component.- Parameters:
- container- container whose size is being calculated
- z- indicates row or column
- typeOfSize- indicates preferred or minimum
- entryList- list of Entry objects
- prefMinSize- list of preferred or minimum sizes
- Returns:
- a dimension indicating the container's preferred or minimum size
 
 - 
addLayoutComponentpublic void addLayoutComponent(java.lang.String name, java.awt.Component component)Adds the specified component with the specified name to the layout.- Specified by:
- addLayoutComponentin interface- java.awt.LayoutManager
- Parameters:
- name- indicates entry's position and anchor
- component- component to add
 
 - 
addLayoutComponentpublic void addLayoutComponent(java.awt.Component component, java.lang.Object constraint)Adds the specified component with the specified name to the layout.- Specified by:
- addLayoutComponentin interface- java.awt.LayoutManager2
- Parameters:
- component- component to add
- constraint- indicates entry's position and alignment
 
 - 
removeLayoutComponentpublic void removeLayoutComponent(java.awt.Component component) Removes the specified component from the layout.- Specified by:
- removeLayoutComponentin interface- java.awt.LayoutManager
- Parameters:
- component- component being removed
 
 - 
maximumLayoutSizepublic java.awt.Dimension maximumLayoutSize(java.awt.Container target) Returns the maximum dimensions for this layout given the components in the specified target container.- Specified by:
- maximumLayoutSizein interface- java.awt.LayoutManager2
- Parameters:
- target- the component which needs to be laid out
- Returns:
- unconditionally, a Dimension of Integer.MAX_VALUE by Integer.MAX_VALUE since TableLayout does not limit the maximum size of a container
 
 - 
getLayoutAlignmentXpublic float getLayoutAlignmentX(java.awt.Container parent) Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.- Specified by:
- getLayoutAlignmentXin interface- java.awt.LayoutManager2
- Returns:
- unconditionally, 0.5
 
 - 
getLayoutAlignmentYpublic float getLayoutAlignmentY(java.awt.Container parent) Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.- Specified by:
- getLayoutAlignmentYin interface- java.awt.LayoutManager2
- Returns:
- unconditionally, 0.5
 
 - 
invalidateLayoutpublic void invalidateLayout(java.awt.Container target) Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.- Specified by:
- invalidateLayoutin interface- java.awt.LayoutManager2
 
 
- 
 
-