|
|||||||||
Home >> All >> edu >> stanford >> genetics >> [ treeview overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
edu.stanford.genetics.treeview
Class DragGridPanel

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.stanford.genetics.treeview.DragGridPanel
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.event.ComponentListener, java.awt.event.ContainerListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
- public class DragGridPanel
- extends javax.swing.JPanel
- implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.ContainerListener
- extends javax.swing.JPanel
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.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
(package private) boolean |
adjustable
Set to true if user is allowed to adjust sizes. |
(package private) int |
bheight
Height of the draggable borders between Components. |
(package private) int |
bwidth
Width of the draggable borders between Components. |
(package private) int |
coldrag
column divider being dragged by mouse, or 0. |
(package private) java.awt.Component[][] |
components
The components, organised in a grid. |
(package private) static int |
crossHairCursor
Cross-hair cursor |
(package private) int |
currentCursor
current cursor type. |
(package private) int |
curscol
column divider which cursor is over. |
(package private) int |
cursrow
row divider which cursor is over. |
(package private) DragBar |
dragBar
|
(package private) int |
focusheight
Height of the focus rectangle round each control. |
(package private) int |
focuswidth
Width of the focus rectangle round each control. |
(package private) static int |
handCursor
Hand cursor |
(package private) static int |
leftRightCursor
Left-right cursor |
(package private) int |
minheight
Minimum height of a component. |
(package private) int |
minwidth
Minimum width of a component. |
(package private) java.awt.Cursor |
originalCursor
original cursor type. |
(package private) boolean |
resize
|
(package private) int |
rowdrag
row divider being dragged by mouse, or 0. |
(package private) static boolean |
trace
|
(package private) static int |
upDownCursor
Up-down cursor |
(package private) static RCSVersion |
version
|
(package private) int[] |
xpos
The x positions of the dividing lines between cells. |
(package private) float[] |
xsizes
The relative sizes of the cell columns. |
(package private) int[] |
ypos
The y positions of the dividing lines between cells. |
(package private) float[] |
ysizes
The relative sizes of the cell rows. |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DragGridPanel(int x,
int y)
Constructor. |
Method Summary | |
void |
addComponent(java.awt.Component comp,
int x,
int y,
int width,
int height)
Add a component to occupy a rectangle of cells. |
void |
addComponent(java.awt.Component component,
java.awt.Rectangle rectangle)
Adds a component to the DragGridPanel |
private void |
addFocusListenerRecursively(java.awt.Component c)
added by alok 9/12/2001 |
void |
componentAdded(java.awt.event.ContainerEvent e)
added by alok 9/12/2001 |
void |
componentHidden(java.awt.event.ComponentEvent e)
This method is called when the component is hidden. |
void |
componentMoved(java.awt.event.ComponentEvent e)
This method is called when the component is moved. |
void |
componentRemoved(java.awt.event.ContainerEvent e)
added by alok 9/12/2001 |
void |
componentResized(java.awt.event.ComponentEvent e)
Called when this container gets resized. |
void |
componentShown(java.awt.event.ComponentEvent e)
This method is called when the component is made visible. |
private void |
debug(java.lang.String s)
|
private void |
debug(java.lang.String s,
java.lang.Object o)
|
void |
doLayout()
Recompute cell sizes from proportional sizes, and resize components. |
private boolean |
dragging()
|
private void |
drawFocus(java.awt.Graphics g,
int x,
int y)
|
void |
focusGained(java.awt.event.FocusEvent e)
draws focus rectangle, added by alok 9/12/2001 |
void |
focusLost(java.awt.event.FocusEvent e)
This method is invoked when a component loses the keyboard focus. |
int |
getBorderHeight()
BorderHeight - height of the draggable borders between Components. |
int |
getBorderWidth()
BorderWidth - width of the draggable borders between Components. |
int |
getFocusHeight()
FocusHeight - height of the focus rectangle round each control. |
int |
getFocusWidth()
FocusWidth - width of the focus rectangle round each control. |
float[] |
getHeights()
Get the proportional heights of each row. |
int |
getMinimumHeight()
MinimumHeight - minimum height of a component. |
int |
getMinimumWidth()
MinimumWidth - minimum width of a component. |
java.awt.Dimension |
getPreferredSize()
added by alok 10/9/2001 |
float[] |
getWidths()
Get the proportional widths of each column. |
boolean |
isAdjustable()
Adjustable - true if use is allowed to drag borders to change cell sizes. |
void |
mouseClicked(java.awt.event.MouseEvent e)
This method is called when the mouse is clicked (pressed and released in short succession) on a component. |
void |
mouseDragged(java.awt.event.MouseEvent e)
If a border is selected, change it's position. |
void |
mouseEntered(java.awt.event.MouseEvent e)
This method is called when the mouse enters a component. |
void |
mouseExited(java.awt.event.MouseEvent e)
This method is called when the mouse exits a component. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Change the mouse cursor if over a draggable border. |
void |
mousePressed(java.awt.event.MouseEvent e)
Select a border to drag. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Stop dragging a border. |
private boolean |
onDragBorder(int x,
int y)
Work out if the mouse cursor is over a draggable border. |
void |
paintComponent(java.awt.Graphics g)
Standard paint routine. |
void |
removeComponent(java.awt.Component comp)
Remove a component. |
private void |
removeFocusListenerRecursively(java.awt.Component c)
added by alok 9/12/2001 |
(package private) void |
resizeComponents()
Resize components into new grid. |
void |
setAdjustable(boolean on)
Adjustable - true if use is allowed to drag borders to change cell sizes. |
void |
setBorderHeight(int height)
BorderHeight - height of the draggable borders between Components. |
void |
setBorderWidth(int width)
BorderWidth - width of the draggable borders between Components. |
private void |
setCursor(int newcursor)
Switch cursor to indicate user can drag a border. |
void |
setFocusHeight(int height)
FocusHeight - height of the focus rectangle round each control. |
void |
setFocusWidth(int width)
FocusWidth - width of the focus rectangle round each control. |
void |
setHeights(float[] heights)
Set the proportional heights of each row. |
void |
setMinimumHeight(int height)
MinimumHeight - minimum height of a component. |
void |
setMinimumWidth(int width)
MinimumWidth - minimum width of a component. |
void |
setWidths(float[] widths)
Set the proportional widths of each column. |
java.lang.String |
toString()
Standard toString returns "DragGridPanel[x][y]" and Panel info. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
version
static RCSVersion version
resize
boolean resize
adjustable
boolean adjustable
- Set to true if user is allowed to adjust sizes.
bwidth
int bwidth
- Width of the draggable borders between Components.
bheight
int bheight
- Height of the draggable borders between Components.
minwidth
int minwidth
- Minimum width of a component.
minheight
int minheight
- Minimum height of a component.
focuswidth
int focuswidth
- Width of the focus rectangle round each control.
focusheight
int focusheight
- Height of the focus rectangle round each control.
components
java.awt.Component[][] components
- The components, organised in a grid.
If a component takes up more than one cell, it is placed
in all the array positions it occupies.
xpos
int[] xpos
- The x positions of the dividing lines between cells.
xpos[0] is always 0, and xpos[no of columns] is the width of the Panel.
ypos
int[] ypos
- The y positions of the dividing lines between cells.
ypos[0] is always 0, and ypos[no of rows] is the height of the Panel.
xsizes
float[] xsizes
- The relative sizes of the cell columns. Add up to 1.
ysizes
float[] ysizes
- The relative sizes of the cell rows. Add up to 1.
coldrag
int coldrag
- column divider being dragged by mouse, or 0.
rowdrag
int rowdrag
- row divider being dragged by mouse, or 0.
curscol
int curscol
- column divider which cursor is over.
cursrow
int cursrow
- row divider which cursor is over.
originalCursor
java.awt.Cursor originalCursor
- original cursor type.
currentCursor
int currentCursor
- current cursor type.
leftRightCursor
static final int leftRightCursor
- Left-right cursor
- See Also:
- Constant Field Values
upDownCursor
static final int upDownCursor
- Up-down cursor
- See Also:
- Constant Field Values
crossHairCursor
static final int crossHairCursor
- Cross-hair cursor
- See Also:
- Constant Field Values
handCursor
static final int handCursor
- Hand cursor
- See Also:
- Constant Field Values
trace
static final boolean trace
- See Also:
- Constant Field Values
dragBar
DragBar dragBar
Constructor Detail |
DragGridPanel
public DragGridPanel(int x, int y)
- Constructor.
Method Detail |
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.
getWidths
public float[] getWidths()
- Get the proportional widths of each column.
setHeights
public void setHeights(float[] heights)
- Set the proportional heights of each row.
getHeights
public float[] getHeights()
- Get the proportional heights of each row.
addComponent
public void addComponent(java.awt.Component component, java.awt.Rectangle rectangle)
- Adds a component to the DragGridPanel
addComponent
public void addComponent(java.awt.Component comp, int x, int y, int width, int height)
- Add a component to occupy a rectangle of cells.
removeComponent
public void removeComponent(java.awt.Component comp)
- Remove a component. Other components will use up the
vacated cell(s) if possible.
getPreferredSize
public java.awt.Dimension getPreferredSize()
- added by alok 10/9/2001
addFocusListenerRecursively
private void addFocusListenerRecursively(java.awt.Component c)
- added by alok 9/12/2001
removeFocusListenerRecursively
private void removeFocusListenerRecursively(java.awt.Component c)
- added by alok 9/12/2001
componentAdded
public void componentAdded(java.awt.event.ContainerEvent e)
- added by alok 9/12/2001
- Specified by:
componentAdded
in interfacejava.awt.event.ContainerListener
componentRemoved
public void componentRemoved(java.awt.event.ContainerEvent e)
- added by alok 9/12/2001
- Specified by:
componentRemoved
in interfacejava.awt.event.ContainerListener
doLayout
public void doLayout()
- Recompute cell sizes from proportional sizes, and resize components.
paintComponent
public void paintComponent(java.awt.Graphics g)
- Standard paint routine.
focusGained
public void focusGained(java.awt.event.FocusEvent e)
- draws focus rectangle, added by alok 9/12/2001
- Specified by:
focusGained
in interfacejava.awt.event.FocusListener
focusLost
public void focusLost(java.awt.event.FocusEvent e)
- Description copied from interface:
java.awt.event.FocusListener
- This method is invoked when a component loses the keyboard focus.
- Specified by:
focusLost
in interfacejava.awt.event.FocusListener
drawFocus
private void drawFocus(java.awt.Graphics g, int x, int y)
toString
public java.lang.String toString()
- Standard toString returns "DragGridPanel[x][y]" and Panel info.
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Change the mouse cursor if over a draggable border.
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Select a border to drag.
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Stop dragging a border.
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener
- This method is called when the mouse is clicked (pressed and released
in short succession) on a component.
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener
- This method is called when the mouse enters a component.
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener
- This method is called when the mouse exits a component.
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- If a border is selected, change it's position.
- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
componentResized
public void componentResized(java.awt.event.ComponentEvent e)
- Called when this container gets resized.
- Specified by:
componentResized
in interfacejava.awt.event.ComponentListener
componentMoved
public void componentMoved(java.awt.event.ComponentEvent e)
- Description copied from interface:
java.awt.event.ComponentListener
- This method is called when the component is moved.
- Specified by:
componentMoved
in interfacejava.awt.event.ComponentListener
componentShown
public void componentShown(java.awt.event.ComponentEvent e)
- Description copied from interface:
java.awt.event.ComponentListener
- This method is called when the component is made visible.
- Specified by:
componentShown
in interfacejava.awt.event.ComponentListener
componentHidden
public void componentHidden(java.awt.event.ComponentEvent e)
- Description copied from interface:
java.awt.event.ComponentListener
- This method is called when the component is hidden.
- Specified by:
componentHidden
in interfacejava.awt.event.ComponentListener
resizeComponents
void resizeComponents()
- Resize components into new grid.
onDragBorder
private boolean onDragBorder(int x, int y)
- Work out if the mouse cursor is over a draggable border.
Only called if DragGridPanel is adjustable.
Sets cursor shape, curscol and cursrow appropriately.
setCursor
private void setCursor(int newcursor)
- Switch cursor to indicate user can drag a border.
Only called if new cursor is different to current one.
dragging
private boolean dragging()
debug
private void debug(java.lang.String s, java.lang.Object o)
debug
private void debug(java.lang.String s)
|
|||||||||
Home >> All >> edu >> stanford >> genetics >> [ treeview overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |