amber.awt
Class XYLayout

java.lang.Object
  |
  +--amber.awt.XYLayout
All Implemented Interfaces:
java.awt.LayoutManager

public class XYLayout
extends java.lang.Object
implements java.awt.LayoutManager

This is an XY layout manager which handles laying out components in a simple X,Y,W,H manner.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
ApplicationHandler, ComponentHandler

Constructor Summary
XYLayout()
          Default constructor.
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Add the specified component to the layout.
 java.lang.String getComponentLayout(java.awt.Component comp)
          Find the layout characteristics for a specified component.
static int[] getCoordinates(java.lang.String coords)
          This function takes the input string and converts it to a coordinate array.
static void getCoordinates(java.lang.String coords, int[] data)
          This function takes the input string and converts it to a coordinate array.
 void layoutContainer(java.awt.Container parent)
          This function actually performs the required layout of the components.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Returns the minimum dimensions of the layout in pixels.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Returns the preferred dimensions of the layout in pixels.
 void removeLayoutComponent(java.awt.Component comp)
          Remove the specified component from the layout.
 void setSize(int width, int height)
          Set the preferred and minimum size of the layout.
static java.lang.String valuesToString(int[] coords)
          This function takes the input array and converts it to a coordinate String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XYLayout

public XYLayout()
Default constructor.
Method Detail

setSize

public void setSize(int width,
                    int height)
Set the preferred and minimum size of the layout.
Parameters:
width - int containing the width of the layout.
height - int containing the height of the layout.

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Add the specified component to the layout. The name parameter specifies where the layout will be placed.
Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - String containing where to place the component in the layout. The format of the string is x,y,w,h (no spaces allowed).
comp - Component to add to the layout.

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Remove the specified component from the layout.
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - Component to remove from the layout.

getComponentLayout

public java.lang.String getComponentLayout(java.awt.Component comp)
Find the layout characteristics for a specified component.
Parameters:
comp - Component to get the characteristics for.
Returns:
String containing the layout or null if no such component is contained.

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Returns the preferred dimensions of the layout in pixels. If setSize is used these are the dimensions used.
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - Container which owns this layout.
Returns:
Dimension containing the width and height.

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Returns the minimum dimensions of the layout in pixels. If setSize is used these are the dimensions used.
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - Container which owns this layout.
Returns:
Dimension containing the width and height.

layoutContainer

public void layoutContainer(java.awt.Container parent)
This function actually performs the required layout of the components.
Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
parent - Container which owns this layout.

getCoordinates

public static int[] getCoordinates(java.lang.String coords)
This function takes the input string and converts it to a coordinate array.
Parameters:
coords - String containing the coordinates in n,n... format.
Returns:
int array containing the converted coordinates.

valuesToString

public static java.lang.String valuesToString(int[] coords)
This function takes the input array and converts it to a coordinate String.
Parameters:
coords - int array containing the coordinates.
Returns:
String containing the coordinates in n,n... format.

getCoordinates

public static void getCoordinates(java.lang.String coords,
                                  int[] data)
This function takes the input string and converts it to a coordinate array. This is similar to the other getCoordinates however it uses a static array passed in.
Parameters:
coords - String containing the coordinates in n,n... format.
data - The int array to place the converted data into.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.