All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.trumphurst.controls.DragGridPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.trumphurst.controls.DragGridPanel

public class DragGridPanel
extends Panel
implements MouseListener, MouseMotionListener, ComponentListener
A Panel which is divided into a rectangular grid which the user can change. Components may be added to the grid, and may take up any rectangular set of cells within the grid. The user may drag the borders between the components to change the relative sizes of the cells, and thus the sizes of the components.


Constructor Index

 o DragGridPanel(int, int)
Constructor.

Method Index

 o addComponent(Component, int, int, int, int)
Add a component to occupy a rectangle of cells.
 o componentHidden(ComponentEvent)
 o componentMoved(ComponentEvent)
 o componentResized(ComponentEvent)
Called when this container gets resized.
 o componentShown(ComponentEvent)
 o doLayout()
Recompute cell sizes from proportional sizes, and resize components.
 o getBorderHeight()
BorderHeight - height of the draggable borders between Components.
 o getBorderWidth()
BorderWidth - width of the draggable borders between Components.
 o getFocusHeight()
FocusHeight - height of the focus rectangle round each control.
 o getFocusWidth()
FocusWidth - width of the focus rectangle round each control.
 o getHeights()
Get the proportional heights of each row.
 o getMinimumHeight()
MinimumHeight - minimum height of a component.
 o getMinimumWidth()
MinimumWidth - minimum width of a component.
 o getWidths()
Get the proportional widths of each column.
 o isAdjustable()
Adjustable - true if use is allowed to drag borders to change cell sizes.
 o mouseClicked(MouseEvent)
 o mouseDragged(MouseEvent)
If a border is selected, change it's position.
 o mouseEntered(MouseEvent)
 o mouseExited(MouseEvent)
 o mouseMoved(MouseEvent)
Change the mouse cursor if over a draggable border.
 o mousePressed(MouseEvent)
Select a border to drag.
 o mouseReleased(MouseEvent)
Stop dragging a border.
 o paint(Graphics)
Standard paint routine.
 o removeComponent(Component)
Remove a component.
 o setAdjustable(boolean)
Adjustable - true if use is allowed to drag borders to change cell sizes.
 o setBorderHeight(int)
BorderHeight - height of the draggable borders between Components.
 o setBorderWidth(int)
BorderWidth - width of the draggable borders between Components.
 o setFocusHeight(int)
FocusHeight - height of the focus rectangle round each control.
 o setFocusWidth(int)
FocusWidth - width of the focus rectangle round each control.
 o setHeights(float[])
Set the proportional heights of each row.
 o setMinimumHeight(int)
MinimumHeight - minimum height of a component.
 o setMinimumWidth(int)
MinimumWidth - minimum width of a component.
 o setWidths(float[])
Set the proportional widths of each column.
 o toString()
Standard toString returns "DragGridPanel[x][y]" and Panel info.

Constructors

 o DragGridPanel
 public DragGridPanel(int x,
                      int y)
Constructor.

Parameters:
x - the number of columns.
y - the number of rows.

Methods

 o isAdjustable
 public boolean isAdjustable()
Adjustable - true if use is allowed to drag borders to change cell sizes.

 o setAdjustable
 public void setAdjustable(boolean on)
Adjustable - true if use is allowed to drag borders to change cell sizes.

 o getBorderWidth
 public int getBorderWidth()
BorderWidth - width of the draggable borders between Components.

 o setBorderWidth
 public void setBorderWidth(int width)
BorderWidth - width of the draggable borders between Components.

 o getBorderHeight
 public int getBorderHeight()
BorderHeight - height of the draggable borders between Components.

 o setBorderHeight
 public void setBorderHeight(int height)
BorderHeight - height of the draggable borders between Components.

 o getMinimumWidth
 public int getMinimumWidth()
MinimumWidth - minimum width of a component.

 o setMinimumWidth
 public void setMinimumWidth(int width)
MinimumWidth - minimum width of a component.

 o getMinimumHeight
 public int getMinimumHeight()
MinimumHeight - minimum height of a component.

 o setMinimumHeight
 public void setMinimumHeight(int height)
MinimumHeight - minimum height of a component.

 o getFocusWidth
 public int getFocusWidth()
FocusWidth - width of the focus rectangle round each control.

 o setFocusWidth
 public void setFocusWidth(int width)
FocusWidth - width of the focus rectangle round each control.

 o getFocusHeight
 public int getFocusHeight()
FocusHeight - height of the focus rectangle round each control.

 o setFocusHeight
 public void setFocusHeight(int height)
FocusHeight - height of the focus rectangle round each control.

 o setWidths
 public void setWidths(float widths[])
Set the proportional widths of each column.

Parameters:
widths - the widths.
Throws: ArrayIndexOutOfBoundsException
if not enough widths are supplied.
 o getWidths
 public float[] getWidths()
Get the proportional widths of each column.

Returns:
a float array containing the proportions (adds up to 1).
 o setHeights
 public void setHeights(float heights[])
Set the proportional heights of each row.

Parameters:
widths - the heights.
Throws: ArrayIndexOutOfBoundsException
if not enough heights are supplied.
 o getHeights
 public float[] getHeights()
Get the proportional heights of each row.

Returns:
a float array containing the proportions (adds up to 1).
 o addComponent
 public void addComponent(Component comp,
                          int x,
                          int y,
                          int width,
                          int height)
Add a component to occupy a rectangle of cells.

Parameters:
x - Top left cell.
y - Bottom right cell.
width - Number of cells across.
height - Number of cells down.
Throws: ArrayIndexOutofBoundsException
if any of the parameters extend outside the array.
Throws: IllegalArgumentException
if any of the space is already occupied.
 o removeComponent
 public void removeComponent(Component comp)
Remove a component. Other components will use up the vacated cell(s) if possible.

 o doLayout
 public void doLayout()
Recompute cell sizes from proportional sizes, and resize components.

Overrides:
doLayout in class Container
 o paint
 public void paint(Graphics g)
Standard paint routine.

Overrides:
paint in class Container
 o toString
 public String toString()
Standard toString returns "DragGridPanel[x][y]" and Panel info.

Overrides:
toString in class Component
 o mouseMoved
 public void mouseMoved(MouseEvent e)
Change the mouse cursor if over a draggable border.

 o mousePressed
 public void mousePressed(MouseEvent e)
Select a border to drag.

 o mouseReleased
 public void mouseReleased(MouseEvent e)
Stop dragging a border.

 o mouseClicked
 public void mouseClicked(MouseEvent e)
 o mouseEntered
 public void mouseEntered(MouseEvent e)
 o mouseExited
 public void mouseExited(MouseEvent e)
 o mouseDragged
 public void mouseDragged(MouseEvent e)
If a border is selected, change it's position.

 o componentResized
 public void componentResized(ComponentEvent e)
Called when this container gets resized.

 o componentMoved
 public void componentMoved(ComponentEvent e)
 o componentShown
 public void componentShown(ComponentEvent e)
 o componentHidden
 public void componentHidden(ComponentEvent e)

All Packages  Class Hierarchy  This Package  Previous  Next  Index