|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.event.MouseAdapter
com.jidesoft.tree.TreePopupMenuInstaller
public class TreePopupMenuInstaller
TreePopupMenuInstaller allows you to add a popup menu to a JTree and customize it. To use it, you just need to call
TreePopupMenuInstaller installer = new TreePopupMenuInstaller(tree);
Or if you want to uninstall it, call
TreePopupMenuInstaller.getTreePopupMenuInstaller(tree).uninstallListeners();
However TreePopupMenuInstaller has no menu items. You need create your own TreePopupMenuCustomizer to do it.
| Field Summary | |
|---|---|
static String |
CLIENT_PROPERTY_POPUP_MENU_INSTALLER
Client property used by JTree to provide its own TreePopupMenuCustomizer. |
| Constructor Summary | |
|---|---|
TreePopupMenuInstaller(JTree tree)
Creates a TreePopupMenuInstaller. |
|
| Method Summary | |
|---|---|
static void |
addSeparatorIfNecessary(JPopupMenu popup)
Adds a separator to the popup menu if there are menu items on it already. |
void |
addTreePopupMenuCustomizer(TreePopupMenuCustomizer customizer)
Add a tree popup menu customizer. |
protected JPopupMenu |
createPopupMenu()
Create the popup menu. |
protected void |
customizeMenuItems(JTree tree,
JPopupMenu popup,
TreePath[] path)
Customizes the menu items for the popup menu. |
protected TreePath[] |
getTargetTreePath(JTree tree,
Point p)
Finds the target tree path the menu will install on. |
TreePopupMenuCustomizer[] |
getTreePopupMenuCustomizers()
Get the installed popup menu customizer. |
static TreePopupMenuInstaller |
getTreePopupMenuInstaller(JTree tree)
Gets the TreePopupMenuInstaller installed on the JTree. |
void |
installListeners()
Installs the listeners needed in order to show the popup menu for the JTree. |
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
removeTreePopupMenuCustomizer(TreePopupMenuCustomizer customizer)
Remove a tree popup menu customizer. |
void |
uninstallListeners()
Uninstalls the listeners needed in order to show the popup menu for the JTree. |
| Methods inherited from class java.awt.event.MouseAdapter |
|---|
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CLIENT_PROPERTY_POPUP_MENU_INSTALLER
| Constructor Detail |
|---|
public TreePopupMenuInstaller(JTree tree)
tree - the JTree.| Method Detail |
|---|
public void addTreePopupMenuCustomizer(TreePopupMenuCustomizer customizer)
customizer - the customizerpublic void removeTreePopupMenuCustomizer(TreePopupMenuCustomizer customizer)
customizer - the customizerpublic TreePopupMenuCustomizer[] getTreePopupMenuCustomizers()
public void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class MouseAdapterpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MouseAdapterprotected JPopupMenu createPopupMenu()
protected void customizeMenuItems(JTree tree,
JPopupMenu popup,
TreePath[] path)
tree - the JTree.popup - the popup menu.path - the target tree paths.public void installListeners()
public void uninstallListeners()
public static TreePopupMenuInstaller getTreePopupMenuInstaller(JTree tree)
tree - the JTree
protected TreePath[] getTargetTreePath(JTree tree,
Point p)
tree - the JTreep - the point
nullpublic static void addSeparatorIfNecessary(JPopupMenu popup)
popup - the popup menu.
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||