javatools.swing
Class ResizeManager

java.lang.Object
  |
  +--javatools.swing.ResizeManager

public class ResizeManager
extends java.lang.Object

It's a class to manage resizing in form in which the GridBagLayout is used. Preferably do not use it, but if you want improve it...


Field Summary
 int BOTH
          Both horizontal and vertical resizing will be performed.
 int HORIZONTAL
          Only horizontal resizing will be performed.
 int NONE
          No resizing will be performed.
 int VERTICAL
          Only vertical resizing will be performed.
 
Constructor Summary
ResizeManager()
          Creates new ResizeManager
 
Method Summary
 void addComponent(javax.swing.JComponent comp, java.awt.Dimension dims, int resizeOpt)
          Adds a component to resize on resizing of the monitored container.
 javax.swing.JComponent getComponent(int numComponent)
          Returns a referenced component.
 java.awt.Container getContainer()
          Returns the monitored container.
 java.awt.Dimension getContainerInitialDimension()
          Returns initial dimension of the monitored container.
 java.awt.Dimension getContainerMinDimension()
          Returns minimum dimension of the monitored container.
 java.awt.Dimension getInitialDimension(int numComponent)
          Returns initial dimension of a component.
 int getNumComponents()
          Returns the number of managed components.
 int getResizeOption(int numComponent)
          Returns the resize option for a component.
 void initSize()
          Initializes the monitored object with initials sizes.
 void removeComponent(int numComponent)
          Removes a component from the list.
 void resize()
          Resizes the form by taking current dimension of the container.
 void setContainer(java.awt.Container cont, java.awt.Dimension initialDims, java.awt.Dimension minDims)
          Sets the container whose dimension will be checked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public final int NONE
No resizing will be performed.

See Also:
Constant Field Values

HORIZONTAL

public final int HORIZONTAL
Only horizontal resizing will be performed.

See Also:
Constant Field Values

VERTICAL

public final int VERTICAL
Only vertical resizing will be performed.

See Also:
Constant Field Values

BOTH

public final int BOTH
Both horizontal and vertical resizing will be performed.

See Also:
Constant Field Values
Constructor Detail

ResizeManager

public ResizeManager()
Creates new ResizeManager

Method Detail

setContainer

public void setContainer(java.awt.Container cont,
                         java.awt.Dimension initialDims,
                         java.awt.Dimension minDims)
Sets the container whose dimension will be checked.

Parameters:
cont - The referenced container.
initialDims - Initial dimension of the container.
minDims - Minimum dimension of the container.

getContainer

public java.awt.Container getContainer()
Returns the monitored container.

Returns:
The referenced container.

getContainerInitialDimension

public java.awt.Dimension getContainerInitialDimension()
Returns initial dimension of the monitored container.

Returns:
The initial dimension of the referenced container.

getContainerMinDimension

public java.awt.Dimension getContainerMinDimension()
Returns minimum dimension of the monitored container.

Returns:
The minimum dimension of the referenced container.

addComponent

public void addComponent(javax.swing.JComponent comp,
                         java.awt.Dimension dims,
                         int resizeOpt)
Adds a component to resize on resizing of the monitored container.

Parameters:
comp - The component to add.
dims - Initial dimension of the component.
resizeOpt - Integer value representing how resizing will be performed.

getNumComponents

public int getNumComponents()
Returns the number of managed components.

Returns:
The number of managed components.

getComponent

public javax.swing.JComponent getComponent(int numComponent)
                                    throws java.lang.IndexOutOfBoundsException
Returns a referenced component.

Parameters:
numComponent - The position of the needed component.
Returns:
The reference to managed component.
Throws:
java.lang.IndexOutOfBoundsException - If numComponent is not valid.

removeComponent

public void removeComponent(int numComponent)
                     throws java.lang.IndexOutOfBoundsException
Removes a component from the list.

Parameters:
numComponent - The position of the component.
Throws:
java.lang.IndexOutOfBoundsException - If numComponent is not valid.

getInitialDimension

public java.awt.Dimension getInitialDimension(int numComponent)
                                       throws java.lang.IndexOutOfBoundsException
Returns initial dimension of a component.

Parameters:
numComponent - The position of the component.
Returns:
The initial dimension of the component.
Throws:
java.lang.IndexOutOfBoundsException - If numComponent is not valid.

getResizeOption

public int getResizeOption(int numComponent)
                    throws java.lang.IndexOutOfBoundsException
Returns the resize option for a component.

Parameters:
numComponent - The position of the needed component.
Returns:
The value representing how resizing will be performed.
Throws:
java.lang.IndexOutOfBoundsException - If numComponent is not valid.

resize

public void resize()
Resizes the form by taking current dimension of the container.


initSize

public void initSize()
Initializes the monitored object with initials sizes.