Java Doc for TableLayout.java in  » Content-Management-System » contelligent » de » finix » contelligent » client » util » 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 » Content Management System » contelligent » de.finix.contelligent.client.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   de.finix.contelligent.client.util.TableLayout

TableLayout
public class TableLayout implements java.awt.LayoutManager2,java.io.Serializable,TableLayoutConstants(Code)
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. If the component occupies more than one cell, the component is resized to fit perfectly in the rectangular region of cells. If the component occupies a single cell, it can be aligned in four ways within that cell.

A single cell component can be stretched horizontally to fit the cell (full justification), or it can be placed in the center of the cell. The component could also be left justified or right justified. Similarly, the component can be full, center, top, or bottom justified in the vertical.

 public static void main (String args[])
 {
 // Create a frame
 Frame frame = new Frame("Example of TableLayout");
 frame.setBounds (100, 100, 300, 300);
 <spc>
 // Create a TableLayout for the frame
 double border = 10;
 double size[][] =
 {{border, 0.10, 20, TableLayout.FILL, 20, 0.20, border},  // Columns
 {border, 0.20, 20, TableLayout.FILL, 20, 0.20, border}}; // Rows
 <spc>
 frame.setLayout (new TableLayout(size));
 <spc>
 // Create some buttons
 String label[] = {"Top", "Bottom", "Left", "Right", "Center", "Overlap"};
 Button button[] = new Button[label.length];
 <spc>
 for (int i = 0; i < label.length; i++)
 button[i] = new Button(label[i]);
 <spc>
 // Add buttons
 frame.add (button[0], "1, 1, 5, 1"); // Top
 frame.add (button[1], "1, 5, 5, 5"); // Bottom
 frame.add (button[2], "1, 3      "); // Left
 frame.add (button[3], "5, 3      "); // Right
 frame.add (button[4], "3, 3, c, c"); // Center
 frame.add (button[5], "3, 3, 3, 5"); // Overlap
 <spc>
 // Allow user to close the window to terminate the program
 frame.addWindowListener
 (new WindowListener()
 {
 public void windowClosing (WindowEvent e)
 {
 System.exit (0);
 }
 <spc>
 public void windowOpened (WindowEvent e) {}
 public void windowClosed (WindowEvent e) {}
 public void windowIconified (WindowEvent e) {}
 public void windowDeiconified (WindowEvent e) {}
 public void windowActivated (WindowEvent e) {}
 public void windowDeactivated (WindowEvent e) {}
 }
 );
 <spc>
 // Show frame
 frame.show();
 }
 

Inner Class :protected static class Entry extends TableLayoutConstraints

Field Summary
protected  intcolumnOffset
     Offsets of columns in pixels.
protected  MapcolumnOrRowName
    
protected  intcolumnSize
    
protected  doublecolumnSpec
    
final protected static  doubledefaultSize
    
protected  booleandirty
     Indicates whether or not the size of the cells are known for the last known size of the container.
protected  LinkedListlist
    
protected  intoldHeight
    
protected  intoldWidth
    
protected  introwOffset
     Offsets of rows in pixels.
protected  introwSize
    
protected  doublerowSpec
    

Constructor Summary
public  TableLayout()
     Constructs an instance of TableLayout.
public  TableLayout(String declaration)
     Constructs an instance of TableLayout.
public  TableLayout(double size)
     Constructs an instance of TableLayout.

Method Summary
public  voidaddLayoutComponent(String name, Component component)
     Adds the specified component with the specified name to the layout.
public  voidaddLayoutComponent(Component component, Object constraint)
     Adds the specified component with the specified name to the layout.
protected  voidcalculateSize(Container container)
     Calculates the sizes of the rows and columns based on the absolute and relative sizes specified in rowSpec and columnSpec and the size of the container.
public  voiddeleteColumn(int i)
     Deletes a column in this layout.
public  voiddeleteRow(int i)
     Deletes a row in this layout.
public  voiddrawGrid(Container container, Graphics g)
     Draws a grid on the given container.
public  double[]getColumn()
     Gets the sizes of columns in this layout.
public  doublegetColumn(int i)
     Gets the width of a single column in this layout.
Parameters:
  i - zero-based index of row to get.
public  TableLayoutConstraintsgetConstraints(Component component)
     Gets the constraints of a given component.
Parameters:
  component - desired component If the given component is found, the constraints associated withthat component.
public  floatgetLayoutAlignmentX(Container parent)
     Returns the alignment along the x axis.
public  floatgetLayoutAlignmentY(Container parent)
     Returns the alignment along the y axis.
public  intgetNumColumn()
     Gets the number of columns in this layout.
public  intgetNumRow()
     Gets the number of rows in this layout.
public  double[]getRow()
     Gets the height of a single row in this layout.
public  doublegetRow(int i)
     Gets the sizes of a row in this layout.
Parameters:
  i - zero-based index of row to get.
public  booleanhidden()
     Determines whether or not there are any hidden components.
public  voidinsertColumn(int i, double size)
     Inserts a column in this layout.
public  voidinsertRow(int i, double size)
     Inserts a row in this layout.
public  voidinvalidateLayout(Container target)
     Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
public  voidlayoutContainer(Container container)
     To lay out the specified container using this layout.
public  DimensionmaximumLayoutSize(Container target)
     Returns the maximum dimensions for this layout given the components in the specified target container.
public  DimensionminimumLayoutSize(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.
public  booleanoverlapping()
     Determines whether or not there are any overlapping components.
public  DimensionpreferredLayoutSize(Container container)
     Determines the preferred size of the container argument using this layout.
public  voidremoveLayoutComponent(Component component)
     Removes the specified component from the layout.
public  voidsetColumn(double column)
     Adjusts the number and sizes of rows in this layout.
public  voidsetColumn(int i, double size)
     Adjusts the width of a single column in this layout.
public  voidsetConstraints(Component component, TableLayoutConstraints constraint)
     Sets the constraints of a given component.
Parameters:
  component - desired component.
public  voidsetRow(double row)
     Adjusts the number and sizes of rows in this layout.
public  voidsetRow(int i, double size)
     Adjusts the height of a single row in this layout.
public  StringtoString()
     Converts this TableLayout to a string.

Field Detail
columnOffset
protected int columnOffset(Code)
Offsets of columns in pixels. The left boarder of column n is at columnOffset[n] and the right boarder is at columnOffset[n + 1] for all columns including the last one. columnOffset.length = columnSize.length + 1



columnOrRowName
protected Map columnOrRowName(Code)



columnSize
protected int columnSize(Code)
Widths of columns in pixels



columnSpec
protected double columnSpec(Code)
Widths of columns expressed in absolute and relative terms



defaultSize
final protected static double defaultSize(Code)
Default row/column size



dirty
protected boolean dirty(Code)
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.



list
protected LinkedList list(Code)
List of components and their sizes



oldHeight
protected int oldHeight(Code)
Previous known height of the container



oldWidth
protected int oldWidth(Code)
Previous known width of the container



rowOffset
protected int rowOffset(Code)
Offsets of rows in pixels. The left boarder of row n is at rowOffset[n] and the right boarder is at rowOffset[n + 1] for all rows including the last one. rowOffset.length = rowSize.length + 1



rowSize
protected int rowSize(Code)
Heights of rows in pixels



rowSpec
protected double rowSpec(Code)
Heights of rows expressed in absolute and relative terms




Constructor Detail
TableLayout
public TableLayout()(Code)
Constructs an instance of TableLayout. This TableLayout will have one row and one column.



TableLayout
public TableLayout(String declaration)(Code)
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 thisparameter is invalid, the TableLayout will have exactly onerow and one column.



TableLayout
public TableLayout(double size)(Code)
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 thisparameter is invalid, the TableLayout will have exactly onerow and one column.




Method Detail
addLayoutComponent
public void addLayoutComponent(String name, Component component)(Code)
Adds the specified component with the specified name to the layout.
Parameters:
  name - indicates entry's position and anchor
Parameters:
  component - component to add



addLayoutComponent
public void addLayoutComponent(Component component, Object constraint)(Code)
Adds the specified component with the specified name to the layout.
Parameters:
  component - component to add
Parameters:
  constraint - indicates entry's position and alignment



calculateSize
protected void calculateSize(Container container)(Code)
Calculates the sizes of the rows and columns based on the absolute and relative sizes specified in rowSpec and columnSpec and the size of the container. The result is stored in rowSize and columnSize.
Parameters:
  container - container using this TableLayout



deleteColumn
public void deleteColumn(int i)(Code)
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. See setColumn.
Parameters:
  i - zero-based index of column to delete
See Also:   setColumn
See Also:   deleteColumn



deleteRow
public void deleteRow(int i)(Code)
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. See setRow. There must be at least two rows in order to delete a row.
Parameters:
  i - zero-based index of column to delete
See Also:   setRow
See Also:   deleteRow



drawGrid
public void drawGrid(Container container, Graphics g)(Code)
Draws a grid on the given container. This is useful for seeing where the rows and columns go. In the container's paint method, call this method.
Parameters:
  container - container using this TableLayout
Parameters:
  g - graphics content of container (can be offscreen)



getColumn
public double[] getColumn()(Code)
Gets the sizes of columns in this layout. widths of each of the columns
See Also:   setColumn



getColumn
public double getColumn(int i)(Code)
Gets the width of a single column in this layout.
Parameters:
  i - zero-based index of row to get. If this parameter is notvalid, an ArrayOutOfBoundsException will be thrown. width of the requested column
See Also:   setRow



getConstraints
public TableLayoutConstraints getConstraints(Component component)(Code)
Gets the constraints of a given component.
Parameters:
  component - desired component If the given component is found, the constraints associated withthat component. If the given component is null or is not found,null is returned.



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. unconditionally, 0.5



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. unconditionally, 0.5



getNumColumn
public int getNumColumn()(Code)
Gets the number of columns in this layout. the number of columns



getNumRow
public int getNumRow()(Code)
Gets the number of rows in this layout. the number of rows



getRow
public double[] getRow()(Code)
Gets the height of a single row in this layout. height of the requested row
See Also:   setRow



getRow
public double getRow(int i)(Code)
Gets the sizes of a row in this layout.
Parameters:
  i - zero-based index of row to get. If this parameter is notvalid, an ArrayOutOfBoundsException will be thrown. height of each of the requested row
See Also:   setRow



hidden
public boolean hidden()(Code)
Determines whether or not there are any hidden components. A hidden component is one that will not be shown with this layout's current configuration. Such a component is, at least partly, in an invalid 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. True, if there are any hidden components. False, otherwise.
See Also:   overlapping



insertColumn
public void insertColumn(int i, double size)(Code)
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. See setColumn.
Parameters:
  i - zero-based index at which to insert the column.
Parameters:
  size - size of the column to be inserted
See Also:   setColumn
See Also:   deleteColumn



insertRow
public void insertRow(int i, double size)(Code)
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. See setRow.
Parameters:
  i - zero-based index at which to insert the column.
Parameters:
  size - size of the row to be inserted
See Also:   setRow
See Also:   deleteRow



invalidateLayout
public void invalidateLayout(Container target)(Code)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.



layoutContainer
public void layoutContainer(Container container)(Code)
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.


Parameters:
  container - container being served by this layout manager



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 component which needs to be laid out unconditionally, a Dimension of Integer.MAX_VALUE byInteger.MAX_VALUE since TableLayout does not limit the maximumsize of a container



minimumLayoutSize
public Dimension minimumLayoutSize(Container container)(Code)
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 allocate 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.
Parameters:
  container - container being served by this layout manager a dimension indicating the container's minimum size



overlapping
public boolean overlapping()(Code)
Determines whether or not there are any overlapping components. Two components overlap if they cover at least one common cell. True, if there are any overlapping components. False, otherwise.
See Also:   hidden



preferredLayoutSize
public Dimension preferredLayoutSize(Container container)(Code)
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 allocate 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 preferred size instead of smaller, component B's request will be fulfilled. The preferred size of the container would be 200 pixels.
Parameters:
  container - container being served by this layout manager a dimension indicating the container's preferred size



removeLayoutComponent
public void removeLayoutComponent(Component component)(Code)
Removes the specified component from the layout.
Parameters:
  component - component being removed



setColumn
public void setColumn(double column)(Code)
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 - heights of each of the columns
See Also:   getColumn



setColumn
public void setColumn(int i, double size)(Code)
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 notvalid, an ArrayOutOfBoundsException will be thrown.
Parameters:
  size - width of the column. This parameter cannot be null.
See Also:   getColumn



setConstraints
public void setConstraints(Component component, TableLayoutConstraints constraint)(Code)
Sets the constraints of a given component.
Parameters:
  component - desired component. This parameter cannot be null.
Parameters:
  constraint - new set of constraints. This parameter cannot be null. If the given component is found, the constraints associated withthat component. If the given component is null or is not found,null is returned.



setRow
public void setRow(double row)(Code)
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 - widths of each of the rows. This parameter cannot be null.
See Also:   getRow



setRow
public void setRow(int i, double size)(Code)
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 notvalid, an ArrayOutOfBoundsException will be thrown.
Parameters:
  size - height of the row. This parameter cannot be null.
See Also:   getRow



toString
public String toString()(Code)
Converts this TableLayout to a string. a string representing the columns and row sizes in the form"{{col0, col1, col2, ..., colN}, {row0, row1, row2, ..., rowM}}"



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.