public final class PopupMenuGravityTracker extends Object implements GravityTracker
Module: swing-util-api
To use this in your app, include the following dependency in your POM:
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>swing-util-api</artifactId>
</dependency>USE_ALPHABETIC_ORDER| Constructor and Description |
|---|
PopupMenuGravityTracker(JPopupMenu menu)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMenu(JMenu newSubmenu,
double gravity)
Adds a new submenu into a position based on "gravity" of the new item.
|
void |
addMenuItem(JMenuItem newMenuItem,
double gravity)
Adds a new menu item into a position based on "gravity" of the new item.
|
void |
addMenuSeparator(double gravity)
Adds a separator into a position based on "gravity" of the new item.
|
JPopupMenu |
getMenu()
Returns the JPopupMenu or JMenu that this gravity tracker tracks.
|
void |
removeComponent(Component component)
Removes an item from this tracker and the corresponding menu.
|
public PopupMenuGravityTracker(JPopupMenu menu)
menu - The JPopupMenu to associate with this PopupMenuGravityTracker.public JPopupMenu getMenu()
GravityTrackergetMenu in interface GravityTrackerpublic void addMenuItem(JMenuItem newMenuItem, double gravity)
GravityTrackeraddMenuItem in interface GravityTrackernewMenuItem - the new item to insert into the menugravity - the weight determining the insert position
(use USE_ALPHABETIC_ORDER if you want alphabetic ordering)public void addMenu(JMenu newSubmenu, double gravity)
GravityTrackeraddMenu in interface GravityTrackernewSubmenu - the new submenu to insert into the menugravity - the weight determining the insert positionpublic void addMenuSeparator(double gravity)
GravityTrackeraddMenuSeparator in interface GravityTrackergravity - the weight determining the insert positionpublic void removeComponent(Component component)
GravityTrackerremoveComponent in interface GravityTrackercomponent - the item that is to be removedCopyright 2011 Cytoscape Consortium. All rights reserved.