public class TreeAnimator extends AbstractComponentDecorator implements TreeExpansionListener
| Modifier and Type | Class and Description |
|---|---|
protected class |
TreeAnimator.DragDestination |
AbstractComponentDecorator.PainterDEFAULT_BOUNDS, TOP| Constructor and Description |
|---|
TreeAnimator(JTree tree) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canMove(TreePath path)
The default assumes any node except the root may be moved.
|
protected boolean |
canMove(TreePath fromPath,
TreePath toPath,
int index)
Returns whether the node at the given path may be moved to the given
index on the given target path.
|
void |
dispose()
Stop decorating.
|
void |
endDrag(Point where)
End an internal drag.
|
protected TreeAnimator.DragDestination |
getDragDestination(Point where)
Return a proposed insertion location for the given coordinate given in
actual JTree coordinate space.
|
protected int |
getPlaceholderRow() |
static void |
main(String[] args)
Throw up a frame to demonstrate the animator at work.
|
protected void |
moveNode(TreePath fromPath,
TreePath toPath,
int index)
Request that the node on the given path be moved to the given
index on the given target path.
|
void |
paint(Graphics g)
Define the decoration's appearance.
|
void |
setPlaceholderLocation(Point where)
Invoke this method as the cursor location changes.
|
void |
setVisible(boolean visible)
Use this to change the visibility of the decoration.
|
boolean |
startDrag(Point where)
Start a local drag.
|
void |
treeCollapsed(TreeExpansionEvent e) |
void |
treeExpanded(TreeExpansionEvent e) |
attach, clipDecorationBounds, getComponent, getDecorationBounds, getPainter, getToolTipText, getToolTipText, isVisible, repaint, setCursor, setDecorationBounds, setDecorationBounds, setPainterBounds, setToolTipText, synch, toStringpublic TreeAnimator(JTree tree)
protected boolean canMove(TreePath path)
protected boolean canMove(TreePath fromPath, TreePath toPath, int index)
protected void moveNode(TreePath fromPath, TreePath toPath, int index)
public boolean startDrag(Point where)
public void treeExpanded(TreeExpansionEvent e)
treeExpanded in interface TreeExpansionListenerpublic void treeCollapsed(TreeExpansionEvent e)
treeCollapsed in interface TreeExpansionListenerpublic void setVisible(boolean visible)
AbstractComponentDecoratorsetVisible in class AbstractComponentDecoratorpublic void endDrag(Point where)
public void dispose()
AbstractComponentDecoratordispose in class AbstractComponentDecoratorprotected TreeAnimator.DragDestination getDragDestination(Point where)
public void setPlaceholderLocation(Point where)
protected int getPlaceholderRow()
public void paint(Graphics g)
AbstractComponentDecoratorAbstractComponentDecorator.getDecorationBounds(), which defaults to the
decorated component bounds.paint in class AbstractComponentDecoratorpublic static void main(String[] args)
Copyright © 2023. All rights reserved.