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.
-
DragGridPanel(int, int)
- Constructor.
-
addComponent(Component, int, int, int, int)
- Add a component to occupy a rectangle of cells.
-
componentHidden(ComponentEvent)
-
-
componentMoved(ComponentEvent)
-
-
componentResized(ComponentEvent)
- Called when this container gets resized.
-
componentShown(ComponentEvent)
-
-
doLayout()
- Recompute cell sizes from proportional sizes, and resize components.
-
getBorderHeight()
- BorderHeight - height of the draggable borders between Components.
-
getBorderWidth()
- BorderWidth - width of the draggable borders between Components.
-
getFocusHeight()
- FocusHeight - height of the focus rectangle round each control.
-
getFocusWidth()
- FocusWidth - width of the focus rectangle round each control.
-
getHeights()
- Get the proportional heights of each row.
-
getMinimumHeight()
- MinimumHeight - minimum height of a component.
-
getMinimumWidth()
- MinimumWidth - minimum width of a component.
-
getWidths()
- Get the proportional widths of each column.
-
isAdjustable()
- Adjustable - true if use is allowed to drag borders to change cell sizes.
-
mouseClicked(MouseEvent)
-
-
mouseDragged(MouseEvent)
- If a border is selected, change it's position.
-
mouseEntered(MouseEvent)
-
-
mouseExited(MouseEvent)
-
-
mouseMoved(MouseEvent)
- Change the mouse cursor if over a draggable border.
-
mousePressed(MouseEvent)
- Select a border to drag.
-
mouseReleased(MouseEvent)
- Stop dragging a border.
-
paint(Graphics)
- Standard paint routine.
-
removeComponent(Component)
- Remove a component.
-
setAdjustable(boolean)
- Adjustable - true if use is allowed to drag borders to change cell sizes.
-
setBorderHeight(int)
- BorderHeight - height of the draggable borders between Components.
-
setBorderWidth(int)
- BorderWidth - width of the draggable borders between Components.
-
setFocusHeight(int)
- FocusHeight - height of the focus rectangle round each control.
-
setFocusWidth(int)
- FocusWidth - width of the focus rectangle round each control.
-
setHeights(float[])
- Set the proportional heights of each row.
-
setMinimumHeight(int)
- MinimumHeight - minimum height of a component.
-
setMinimumWidth(int)
- MinimumWidth - minimum width of a component.
-
setWidths(float[])
- Set the proportional widths of each column.
-
toString()
- Standard toString returns "DragGridPanel[x][y]" and Panel info.
DragGridPanel
public DragGridPanel(int x,
int y)
- Constructor.
- Parameters:
- x - the number of columns.
- y - the number of rows.
isAdjustable
public boolean isAdjustable()
- Adjustable - true if use is allowed to drag borders to change cell sizes.
setAdjustable
public void setAdjustable(boolean on)
- Adjustable - true if use is allowed to drag borders to change cell sizes.
getBorderWidth
public int getBorderWidth()
- BorderWidth - width of the draggable borders between Components.
setBorderWidth
public void setBorderWidth(int width)
- BorderWidth - width of the draggable borders between Components.
getBorderHeight
public int getBorderHeight()
- BorderHeight - height of the draggable borders between Components.
setBorderHeight
public void setBorderHeight(int height)
- BorderHeight - height of the draggable borders between Components.
getMinimumWidth
public int getMinimumWidth()
- MinimumWidth - minimum width of a component.
setMinimumWidth
public void setMinimumWidth(int width)
- MinimumWidth - minimum width of a component.
getMinimumHeight
public int getMinimumHeight()
- MinimumHeight - minimum height of a component.
setMinimumHeight
public void setMinimumHeight(int height)
- MinimumHeight - minimum height of a component.
getFocusWidth
public int getFocusWidth()
- FocusWidth - width of the focus rectangle round each control.
setFocusWidth
public void setFocusWidth(int width)
- FocusWidth - width of the focus rectangle round each control.
getFocusHeight
public int getFocusHeight()
- FocusHeight - height of the focus rectangle round each control.
setFocusHeight
public void setFocusHeight(int height)
- FocusHeight - height of the focus rectangle round each control.
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.
getWidths
public float[] getWidths()
- Get the proportional widths of each column.
- Returns:
- a float array containing the proportions (adds up to 1).
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.
getHeights
public float[] getHeights()
- Get the proportional heights of each row.
- Returns:
- a float array containing the proportions (adds up to 1).
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.
removeComponent
public void removeComponent(Component comp)
- Remove a component. Other components will use up the
vacated cell(s) if possible.
doLayout
public void doLayout()
- Recompute cell sizes from proportional sizes, and resize components.
- Overrides:
- doLayout in class Container
paint
public void paint(Graphics g)
- Standard paint routine.
- Overrides:
- paint in class Container
toString
public String toString()
- Standard toString returns "DragGridPanel[x][y]" and Panel info.
- Overrides:
- toString in class Component
mouseMoved
public void mouseMoved(MouseEvent e)
- Change the mouse cursor if over a draggable border.
mousePressed
public void mousePressed(MouseEvent e)
- Select a border to drag.
mouseReleased
public void mouseReleased(MouseEvent e)
- Stop dragging a border.
mouseClicked
public void mouseClicked(MouseEvent e)
mouseEntered
public void mouseEntered(MouseEvent e)
mouseExited
public void mouseExited(MouseEvent e)
mouseDragged
public void mouseDragged(MouseEvent e)
- If a border is selected, change it's position.
componentResized
public void componentResized(ComponentEvent e)
- Called when this container gets resized.
componentMoved
public void componentMoved(ComponentEvent e)
componentShown
public void componentShown(ComponentEvent e)
componentHidden
public void componentHidden(ComponentEvent e)
All Packages Class Hierarchy This Package Previous Next Index