Java Doc for FormLayout.java in  » Swing-Library » jgoodies-forms » com » jgoodies » forms » layout » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jgoodies forms » com.jgoodies.forms.layout 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jgoodies.forms.layout.FormLayout

FormLayout
final public class FormLayout implements LayoutManager2,Serializable(Code)
FormLayout is a powerful, flexible and precise general purpose layout manager. It aligns components vertically and horizontally in a dynamic rectangular grid of cells, with each component occupying one or more cells. A whitepaper about the FormLayout ships with the product documentation and is available online.

To use FormLayout you first define the grid by specifying the columns and rows. In a second step you add components to the grid. You can specify columns and rows via human-readable String descriptions or via arrays of ColumnSpec and RowSpec instances.

Each component managed by a FormLayout is associated with an instance of CellConstraints . The constraints object specifies where a component should be located on the form's grid and how the component should be positioned. In addition to its constraints object the FormLayout also considers each component's minimum and preferred sizes in order to determine a component's size.

FormLayout has been designed to work with non-visual builders that help you specify the layout and fill the grid. For example, the com.jgoodies.forms.builder.ButtonBarBuilder assists you in building button bars; it creates a standardized FormLayout and provides a minimal API that specializes in adding buttons. Other builders can create frequently used panel design, for example a form that consists of rows of label-component pairs.

FormLayout has been prepared to work with different types of sizes as defined by the Size interface.

Example 1 (Plain FormLayout):
The following example creates a panel with 3 data columns and 3 data rows; the columns and rows are specified before components are added to the form.

 FormLayout layout = new FormLayout(
 "right:pref, 6dlu, 50dlu, 4dlu, default",  // columns 
 "pref, 3dlu, pref, 3dlu, pref");           // rows
 CellConstraints cc = new CellConstraints();
 JPanel panel = new JPanel(layout);
 panel.add(new JLabel("Label1"),   cc.xy  (1, 1));
 panel.add(new JTextField(),       cc.xywh(3, 1, 3, 1));
 panel.add(new JLabel("Label2"),   cc.xy  (1, 3));
 panel.add(new JTextField(),       cc.xy  (3, 3));
 panel.add(new JLabel("Label3"),   cc.xy  (1, 5));
 panel.add(new JTextField(),       cc.xy  (3, 5));
 panel.add(new JButton("/u2026"),  cc.xy  (5, 5));
 return panel;
 

Example 2 (Using PanelBuilder):
This example creates the same panel as above using the com.jgoodies.forms.builder.PanelBuilder to add components to the form.

 FormLayout layout = new FormLayout(
 "right:pref, 6dlu, 50dlu, 4dlu, default",  // columns 
 "pref, 3dlu, pref, 3dlu, pref");           // rows
 PanelBuilder builder = new PanelBuilder(layout);
 CellConstraints cc = new CellConstraints();
 builder.addLabel("Label1",         cc.xy  (1, 1));
 builder.add(new JTextField(),      cc.xywh(3, 1, 3, 1));
 builder.addLabel("Label2",         cc.xy  (1, 3));
 builder.add(new JTextField(),      cc.xy  (3, 3));
 builder.addLabel("Label3",         cc.xy  (1, 5));
 builder.add(new JTextField(),      cc.xy  (3, 5));
 builder.add(new JButton("/u2026"), cc.xy  (5, 5));
 return builder.getPanel();
 

Example 3 (Using DefaultFormBuilder):
This example utilizes the com.jgoodies.forms.builder.DefaultFormBuilder that ships with the source distribution.

 FormLayout layout = new FormLayout(
 "right:pref, 6dlu, 50dlu, 4dlu, default"); // 5 columns; add rows later
 DefaultFormBuilder builder = new DefaultFormBuilder(layout);
 builder.append("Label1", new JTextField(), 3);
 builder.append("Label2", new JTextField());
 builder.append("Label3", new JTextField());
 builder.append(new JButton("/u2026"));
 return builder.getPanel();
 

TODO: In the Forms 1.0.x invisible components are not taken into account when the FormLayout lays out the container. Add an optional setting for this on both the container-level and component-level. So one can specify that invisible components shall be taken into account, but may exclude individual components. Or the other way round, exclude invisible components, and include individual components. The API of both the FormLayout and CellConstraints classes shall be extended to support this option. This feature is planned for the Forms version 1.1 and is described in issue #28 of the Forms' issue tracker where you can track the progress.
author:
   Karsten Lentzsch
version:
   $Revision: 1.6 $
See Also:   ColumnSpec
See Also:   RowSpec
See Also:   CellConstraints
See Also:   com.jgoodies.forms.builder.AbstractFormBuilder
See Also:   com.jgoodies.forms.builder.ButtonBarBuilder
See Also:   com.jgoodies.forms.builder.DefaultFormBuilder
See Also:   com.jgoodies.forms.factories.FormFactory
See Also:   Size
See Also:   Sizes


Inner Class :public static interface Measure
Inner Class :final public static class LayoutInfo


Constructor Summary
public  FormLayout()
     Constructs an empty FormLayout.
public  FormLayout(String encodedColumnSpecs)
     Constructs a FormLayout using the given encoded column specifications.
public  FormLayout(String encodedColumnSpecs, String encodedRowSpecs)
     Constructs a FormLayout using the given encoded column and row specifications.

This constructor is recommended for most hand-coded layouts.

Examples:

 FormLayout layout = new FormLayout(
 "pref, 4dlu, pref",               // columns 
 "p, 3dlu, p");                    // rows
 FormLayout layout = new FormLayout(
 "right:pref, 4dlu, pref",         // columns 
 "p, 3dlu, p, 3dlu, fill:p:grow"); // rows
 FormLayout layout = new FormLayout(
 "left:pref, 4dlu, 50dlu",         // columns 
 "p, 2px, p, 3dlu, p, 9dlu, p");   // rows
 FormLayout layout = new FormLayout(
 "max(75dlu;pref), 4dlu, default", // columns 
 "p, 3dlu, p, 3dlu, p, 3dlu, p");  // rows
 
See the class comment for more examples.
public  FormLayout(ColumnSpec[] colSpecs)
     Constructs a FormLayout using the given column specifications.
public  FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)
     Constructs a FormLayout using the given column and row specifications.

Method Summary
public  voidaddGroupedColumn(int columnIndex)
     Adds the specified column index to the last column group.
public  voidaddGroupedRow(int rowIndex)
     Adds the specified row index to the last row group.
public  voidaddLayoutComponent(String name, Component component)
     Throws an UnsupportedOperationException.
public  voidaddLayoutComponent(Component comp, Object constraints)
     Adds the specified component to the layout, using the specified constraints object.
public  voidappendColumn(ColumnSpec columnSpec)
     Appends the given column specification to the right hand side of all columns.
public  voidappendRow(RowSpec rowSpec)
     Appends the given row specification to the bottom of all rows.
public  intgetColumnCount()
     Returns the number of columns in this layout.
public  int[][]getColumnGroups()
     Returns a deep copy of the column groups.
public  ColumnSpecgetColumnSpec(int columnIndex)
     Returns the ColumnSpec at the specified column index.
public  CellConstraintsgetConstraints(Component component)
     Looks up and returns the constraints for the specified component.
public  floatgetLayoutAlignmentX(Container parent)
     Returns the alignment along the x axis.
public  floatgetLayoutAlignmentY(Container parent)
     Returns the alignment along the y axis.
public  LayoutInfogetLayoutInfo(Container parent)
     Computes and returns the horizontal and vertical grid origins. Performs the same layout process as #layoutContainer but does not layout the components.

This method has been added only to make it easier to debug the form layout.

public  intgetRowCount()
     Returns the number of rows in this layout.
public  int[][]getRowGroups()
     Returns a deep copy of the row groups.
public  RowSpecgetRowSpec(int rowIndex)
     Returns the RowSpec at the specified row index.
public  voidinsertColumn(int columnIndex, ColumnSpec columnSpec)
     Inserts the specified column at the specified position.
public  voidinsertRow(int rowIndex, RowSpec rowSpec)
     Inserts the specified column at the specified position.
public  voidinvalidateLayout(Container target)
     Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
public  voidlayoutContainer(Container parent)
     Lays out the specified container using this form layout.
public  DimensionmaximumLayoutSize(Container target)
     Returns the maximum dimensions for this layout given the components in the specified target container.
public  DimensionminimumLayoutSize(Container parent)
     Determines the minimum size of the parent container using this form layout.

Most applications do not call this method directly.

public  DimensionpreferredLayoutSize(Container parent)
     Determines the preferred size of the parent container using this form layout.

Most applications do not call this method directly.

public  voidremoveColumn(int columnIndex)
     Removes the column with the given column index from the layout. Components will be rearranged and column groups will be readjusted. Therefore, the column must not contain components and must not be part of a column group.

The component shift works as follows: components that were located on the right hand side of the removed column are moved one column to the left; component column span is decreased by one if it intersects the removed column.

Column group indices that are greater than the column index will be decreased by one.

Note: If one of the constraints mentioned above is violated, this layout's state becomes illegal and it is unsafe to work with this layout. A typical layout implementation can ensure that these constraints are not violated.

public  voidremoveLayoutComponent(Component comp)
     Removes the specified component from this layout.

Most applications do not call this method directly.

public  voidremoveRow(int rowIndex)
     Removes the row with the given row index from the layout.
public  voidsetColumnGroups(int[][] colGroupIndices)
     Sets the column groups, where each column in a group gets the same group wide width.
public  voidsetColumnSpec(int columnIndex, ColumnSpec columnSpec)
     Sets the ColumnSpec at the specified column index.
public  voidsetConstraints(Component component, CellConstraints constraints)
     Sets the constraints for the specified component in this layout.
public  voidsetRowGroups(int[][] rowGroupIndices)
     Sets the row groups, where each row in such a group gets the same group wide height.
public  voidsetRowSpec(int rowIndex, RowSpec rowSpec)
     Sets the RowSpec at the specified row index.


Constructor Detail
FormLayout
public FormLayout()(Code)
Constructs an empty FormLayout. Columns and rows must be added before components can be added to the layout container.

This constructor is intended to be used in environments that add columns and rows dynamically.




FormLayout
public FormLayout(String encodedColumnSpecs)(Code)
Constructs a FormLayout using the given encoded column specifications. The constructed layout has no rows; these must be added before components can be added to the layout container.

This constructor is primarily intended to be used with builder classes that add rows dynamically, such as the DefaultFormBuilder.

Examples:

 // Label, gap, component
 FormLayout layout = new FormLayout(
 "pref, 4dlu, pref");  
 // Right-aligned label, gap, component, gap, component                                         
 FormLayout layout = new FormLayout(
 "right:pref, 4dlu, 50dlu, 4dlu, 50dlu");  
 // Left-aligned labels, gap, components, gap, components                                         
 FormLayout layout = new FormLayout(
 "left:pref, 4dlu, pref, 4dlu, pref"); 
 
See the class comment for more examples.
Parameters:
  encodedColumnSpecs - comma separated encoded column specifications
throws:
  NullPointerException - if encodedColumnSpecs is null



FormLayout
public FormLayout(String encodedColumnSpecs, String encodedRowSpecs)(Code)
Constructs a FormLayout using the given encoded column and row specifications.

This constructor is recommended for most hand-coded layouts.

Examples:

 FormLayout layout = new FormLayout(
 "pref, 4dlu, pref",               // columns 
 "p, 3dlu, p");                    // rows
 FormLayout layout = new FormLayout(
 "right:pref, 4dlu, pref",         // columns 
 "p, 3dlu, p, 3dlu, fill:p:grow"); // rows
 FormLayout layout = new FormLayout(
 "left:pref, 4dlu, 50dlu",         // columns 
 "p, 2px, p, 3dlu, p, 9dlu, p");   // rows
 FormLayout layout = new FormLayout(
 "max(75dlu;pref), 4dlu, default", // columns 
 "p, 3dlu, p, 3dlu, p, 3dlu, p");  // rows
 
See the class comment for more examples.
Parameters:
  encodedColumnSpecs - comma separated encoded column specifications
Parameters:
  encodedRowSpecs - comma separated encoded row specifications
throws:
  NullPointerException - if encodedColumnSpecs or encodedRowSpecs is null



FormLayout
public FormLayout(ColumnSpec[] colSpecs)(Code)
Constructs a FormLayout using the given column specifications. The constructed layout has no rows; these must be added before components can be added to the layout container.
Parameters:
  colSpecs - an array of column specifications.
throws:
  NullPointerException - if colSpecs is null
since:
   1.1



FormLayout
public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)(Code)
Constructs a FormLayout using the given column and row specifications.
Parameters:
  colSpecs - an array of column specifications.
Parameters:
  rowSpecs - an array of row specifications.
throws:
  NullPointerException - if colSpecs or rowSpecs is null




Method Detail
addGroupedColumn
public void addGroupedColumn(int columnIndex)(Code)
Adds the specified column index to the last column group. In case there are no groups, a new group will be created.
Parameters:
  columnIndex - the column index to be set grouped



addGroupedRow
public void addGroupedRow(int rowIndex)(Code)
Adds the specified row index to the last row group. In case there are no groups, a new group will be created.
Parameters:
  rowIndex - the index of the row that should be grouped



addLayoutComponent
public void addLayoutComponent(String name, Component component)(Code)
Throws an UnsupportedOperationException. Does not add the specified component with the specified name to the layout.
Parameters:
  name - indicates entry's position and anchor
Parameters:
  component - component to add
throws:
  UnsupportedOperationException - always



addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)(Code)
Adds the specified component to the layout, using the specified constraints object. Note that constraints are mutable and are, therefore, cloned when cached.
Parameters:
  comp - the component to be added
Parameters:
  constraints - the component's cell constraints
throws:
  NullPointerException - if constraints is null
throws:
  IllegalArgumentException - if constraints is not aCellConstraints or a String that cannot be used to constructa CellConstraints



appendColumn
public void appendColumn(ColumnSpec columnSpec)(Code)
Appends the given column specification to the right hand side of all columns.
Parameters:
  columnSpec - the column specification to be added
throws:
  NullPointerException - if the column specification is null



appendRow
public void appendRow(RowSpec rowSpec)(Code)
Appends the given row specification to the bottom of all rows.
Parameters:
  rowSpec - the row specification to be added to the form layout
throws:
  NullPointerException - if the rowSpec is null



getColumnCount
public int getColumnCount()(Code)
Returns the number of columns in this layout. the number of columns



getColumnGroups
public int[][] getColumnGroups()(Code)
Returns a deep copy of the column groups. the column groups as two-dimensional int array



getColumnSpec
public ColumnSpec getColumnSpec(int columnIndex)(Code)
Returns the ColumnSpec at the specified column index.
Parameters:
  columnIndex - the column index of the requested ColumnSpec the ColumnSpec at the specified column
throws:
  IndexOutOfBoundsException - if the column index is out of range



getConstraints
public CellConstraints getConstraints(Component component)(Code)
Looks up and returns the constraints for the specified component. A copy of the actual CellConstraints object is returned.
Parameters:
  component - the component to be queried the CellConstraints for the specified component
throws:
  NullPointerException - if component is null or has not been added to the container



getLayoutAlignmentX
public float getLayoutAlignmentX(Container parent)(Code)
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.
Parameters:
  parent - the parent container the value 0.5f to indicate center alignment



getLayoutAlignmentY
public float getLayoutAlignmentY(Container parent)(Code)
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.
Parameters:
  parent - the parent container the value 0.5f to indicate center alignment



getLayoutInfo
public LayoutInfo getLayoutInfo(Container parent)(Code)
Computes and returns the horizontal and vertical grid origins. Performs the same layout process as #layoutContainer but does not layout the components.

This method has been added only to make it easier to debug the form layout. You must not call this method directly; It may be removed in a future release or the visibility may be reduced.
Parameters:
  parent - the Container to inspect an object that comprises the grid x and y origins




getRowCount
public int getRowCount()(Code)
Returns the number of rows in this layout. the number of rows



getRowGroups
public int[][] getRowGroups()(Code)
Returns a deep copy of the row groups. the row groups as two-dimensional int array



getRowSpec
public RowSpec getRowSpec(int rowIndex)(Code)
Returns the RowSpec at the specified row index.
Parameters:
  rowIndex - the row index of the requested RowSpec the RowSpec at the specified row
throws:
  IndexOutOfBoundsException - if the row index is out of range



insertColumn
public void insertColumn(int columnIndex, ColumnSpec columnSpec)(Code)
Inserts the specified column at the specified position. Shifts components that intersect the new column to the right hand side and readjusts column groups.

The component shift works as follows: components that were located on the right hand side of the inserted column are shifted one column to the right; component column span is increased by one if it intersects the new column.

Column group indices that are greater or equal than the given column index will be increased by one.
Parameters:
  columnIndex - index of the column to be inserted
Parameters:
  columnSpec - specification of the column to be inserted
throws:
  IndexOutOfBoundsException - if the column index is out of range




insertRow
public void insertRow(int rowIndex, RowSpec rowSpec)(Code)
Inserts the specified column at the specified position. Shifts components that intersect the new column to the right and readjusts column groups.

The component shift works as follows: components that were located on the right hand side of the inserted column are shifted one column to the right; component column span is increased by one if it intersects the new column.

Column group indices that are greater or equal than the given column index will be increased by one.
Parameters:
  rowIndex - index of the row to be inserted
Parameters:
  rowSpec - specification of the row to be inserted
throws:
  IndexOutOfBoundsException - if the row index is out of range




invalidateLayout
public void invalidateLayout(Container target)(Code)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Parameters:
  target - the container that holds the layout to be invalidated



layoutContainer
public void layoutContainer(Container parent)(Code)
Lays out the specified container using this form layout. This method reshapes components in the specified container in order to satisfy the contraints of this FormLayout object.

Most applications do not call this method directly.

The form layout performs the following steps:

  1. find components that occupy exactly one column or row
  2. compute minimum widths and heights
  3. compute preferred widths and heights
  4. give cols and row equal size if they share a group
  5. compress default columns and rows if total is less than pref size
  6. give cols and row equal size if they share a group
  7. distribute free space
  8. set components bounds

Parameters:
  parent - the container in which to do the layout
See Also:   Container
See Also:   Container.doLayout



maximumLayoutSize
public Dimension maximumLayoutSize(Container target)(Code)
Returns the maximum dimensions for this layout given the components in the specified target container.
Parameters:
  target - the container which needs to be laid out
See Also:   Container
See Also:   FormLayout.minimumLayoutSize(Container)
See Also:   FormLayout.preferredLayoutSize(Container) the maximum dimensions for this layout



minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)(Code)
Determines the minimum size of the parent container using this form layout.

Most applications do not call this method directly.
Parameters:
  parent - the container in which to do the layout the minimum size of the parent container
See Also:   Container.doLayout




preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)(Code)
Determines the preferred size of the parent container using this form layout.

Most applications do not call this method directly.
Parameters:
  parent - the container in which to do the layout the preferred size of the parent container
See Also:   Container.getPreferredSize




removeColumn
public void removeColumn(int columnIndex)(Code)
Removes the column with the given column index from the layout. Components will be rearranged and column groups will be readjusted. Therefore, the column must not contain components and must not be part of a column group.

The component shift works as follows: components that were located on the right hand side of the removed column are moved one column to the left; component column span is decreased by one if it intersects the removed column.

Column group indices that are greater than the column index will be decreased by one.

Note: If one of the constraints mentioned above is violated, this layout's state becomes illegal and it is unsafe to work with this layout. A typical layout implementation can ensure that these constraints are not violated. However, in some cases you may need to check these conditions before you invoke this method. The Forms extras contain source code for class FormLayoutUtils that provides the required test methods:
#columnContainsComponents(Container, int) and
#isGroupedColumn(FormLayout, int).
Parameters:
  columnIndex - index of the column to remove
throws:
  IndexOutOfBoundsException - if the column index is out of range
throws:
  IllegalStateException - if the column contains componentsor if the column is already grouped
See Also:   com.jgoodies.forms.extras.FormLayoutUtils.columnContainsComponent(Containerint)
See Also:   com.jgoodies.forms.extras.FormLayoutUtils.isGroupedColumn(FormLayoutint)




removeLayoutComponent
public void removeLayoutComponent(Component comp)(Code)
Removes the specified component from this layout.

Most applications do not call this method directly.
Parameters:
  comp - the component to be removed.
See Also:   Container.remove(java.awt.Component)
See Also:   Container.removeAll




removeRow
public void removeRow(int rowIndex)(Code)
Removes the row with the given row index from the layout. Components will be rearranged and row groups will be readjusted. Therefore, the row must not contain components and must not be part of a row group.

The component shift works as follows: components that were located below the removed row are moved up one row; component row span is decreased by one if it intersects the removed row.

Row group indices that are greater than the row index will be decreased by one.

Note: If one of the constraints mentioned above is violated, this layout's state becomes illegal and it is unsafe to work with this layout. A typical layout implementation can ensure that these constraints are not violated. However, in some cases you may need to check these conditions before you invoke this method. The Forms extras contain source code for class FormLayoutUtils that provides the required test methods:
#rowContainsComponents(Container, int) and
#isGroupedRow(FormLayout, int).
Parameters:
  rowIndex - index of the row to remove
throws:
  IndexOutOfBoundsException - if the row index is out of range
throws:
  IllegalStateException - if the row contains componentsor if the row is already grouped
See Also:   com.jgoodies.forms.extras.FormLayoutUtils.rowContainsComponent(Containerint)
See Also:   com.jgoodies.forms.extras.FormLayoutUtils.isGroupedRow(FormLayoutint)




setColumnGroups
public void setColumnGroups(int[][] colGroupIndices)(Code)
Sets the column groups, where each column in a group gets the same group wide width. Each group is described by an array of integers that are interpreted as column indices. The parameter is an array of such group descriptions.

Examples:

 // Group columns 1, 3 and 4. 
 setColumnGroups(new int[][]{ {1, 3, 4}});
 // Group columns 1, 3, 4, and group columns 7 and 9
 setColumnGroups(new int[][]{ {1, 3, 4}, {7, 9}});
 

Parameters:
  colGroupIndices - a two-dimensional array of column groups indices
throws:
  IndexOutOfBoundsException - if an index is outside the grid
throws:
  IllegalArgumentException - if a column index is used twice



setColumnSpec
public void setColumnSpec(int columnIndex, ColumnSpec columnSpec)(Code)
Sets the ColumnSpec at the specified column index.
Parameters:
  columnIndex - the index of the column to be changed
Parameters:
  columnSpec - the ColumnSpec to be set
throws:
  NullPointerException - if the column specification is null
throws:
  IndexOutOfBoundsException - if the column index is out of range



setConstraints
public void setConstraints(Component component, CellConstraints constraints)(Code)
Sets the constraints for the specified component in this layout.
Parameters:
  component - the component to be modified
Parameters:
  constraints - the constraints to be applied
throws:
  NullPointerException - if the component or constraints objectis null



setRowGroups
public void setRowGroups(int[][] rowGroupIndices)(Code)
Sets the row groups, where each row in such a group gets the same group wide height. Each group is described by an array of integers that are interpreted as row indices. The parameter is an array of such group descriptions.

Examples:

 // Group rows 1 and 2.
 setRowGroups(new int[][]{ {1, 2}});
 // Group rows 1 and 2, and group rows 5, 7, and 9.
 setRowGroups(new int[][]{ {1, 2}, {5, 7, 9}});
 

Parameters:
  rowGroupIndices - a two-dimensional array of row group indices.
throws:
  IndexOutOfBoundsException - if an index is outside the grid



setRowSpec
public void setRowSpec(int rowIndex, RowSpec rowSpec)(Code)
Sets the RowSpec at the specified row index.
Parameters:
  rowIndex - the index of the row to be changed
Parameters:
  rowSpec - the RowSpec to be set
throws:
  NullPointerException - if the row specification is null
throws:
  IndexOutOfBoundsException - if the row index is out of range



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.