public class TreeNodeMouseAdapter extends MouseAdapter
MouseAdapter
for handling single-
and double-clicks on nodes in a JTree
.
The following example illustrates how this adapter might be used:
tree.addMouseListener(new TreeNodeMouseAdapter() { public void itemClicked(TreePath path, int button) { System.out.println("Button " + button + " clicked on node " path.getLastPathComponent()); } });
Constructor and Description |
---|
TreeNodeMouseAdapter()
Construct a new
TreeNodeMouseAdapter . |
Modifier and Type | Method and Description |
---|---|
void |
mouseClicked(MouseEvent evt)
Handle a mouse event.
|
void |
nodeClicked(TreePath path,
int button)
Handle a single-click on a node.
|
void |
nodeDoubleClicked(TreePath path,
int button)
Handle a double-click on a node.
|
mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
public TreeNodeMouseAdapter()
TreeNodeMouseAdapter
.public final void mouseClicked(MouseEvent evt)
JTree
; if it is not,
the event is ignored.mouseClicked
in interface MouseListener
mouseClicked
in class MouseAdapter
evt
- The event.public void nodeClicked(TreePath path, int button)
path
- The path to the node that was clicked on.button
- The mouse button that was clicked.public void nodeDoubleClicked(TreePath path, int button)
path
- The path to the node that was clicked on.button
- The mouse button that was clicked.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses