|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dsto.dfc.swing.commands.CommandMenus
public final class CommandMenus
Utility for generating menus from command views.
Method Summary | |
---|---|
static Command |
getCommandForMenuItem(JComponent menuComponent)
|
static Point |
getMenuLocation(Component parent,
JPopupMenu menu,
int x,
int y)
Compute best location for menu, bumping location from (x, y) if necessary to fit menu on screen. |
static void |
installContextMenu(Component target,
CommandView view)
Install a context menu based on a given command view to popup when the right mouse button is pressed on a component. |
static void |
installContextMenu(Component target,
CommandView view,
boolean attachToScrollPane)
Install a context menu based on a given command view to popup when the right mouse button is pressed on a component. |
static void |
makeMenuBar(JMenuBar menuBar,
CommandView commandView)
Create a menu bar from a command view. |
static void |
makePopupMenu(JPopupMenu menu,
CommandView commandView)
|
static void |
makePopupMenu(JPopupMenu menu,
CommandView commandView,
CommandViewNode node)
|
static boolean |
showContextMenu(Component parent,
int x,
int y)
Show the context menu (if any) installed on a component with installContextMenu(). |
static void |
showContextMenu(Component parent,
JPopupMenu menu,
int x,
int y)
Show a context menu at a given suggested location, bumping menu to fit on screen as necessary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void makeMenuBar(JMenuBar menuBar, CommandView commandView)
public static void makePopupMenu(JPopupMenu menu, CommandView commandView)
public static void makePopupMenu(JPopupMenu menu, CommandView commandView, CommandViewNode node)
public static void installContextMenu(Component target, CommandView view)
target
- The component to detect clicks on. If target is a
JComponent, auto-attach-to-scrollpane is enabled.view
- The view for the context menu.public static void installContextMenu(Component target, CommandView view, boolean attachToScrollPane)
target
- The component to detect clicks on.view
- The view for the context menu.attachToScrollPane
- If true, enable auto-attach-to-scrollpane
mode where the context menu pops up on right clicks in a scroll
pane containing target as well as in the target itself.public static boolean showContextMenu(Component parent, int x, int y)
parent
- The component to show the menu for.x
- The X coord of the menu.y
- The Y coord of the menu.
public static void showContextMenu(Component parent, JPopupMenu menu, int x, int y)
parent
- The parent of the menu.menu
- The menu to show. If this menu has no compoments, then this
method is a noop.x
- The suggested X coord of the menu.y
- The suggested Y coord of the menu.getMenuLocation(java.awt.Component, javax.swing.JPopupMenu, int, int)
public static Point getMenuLocation(Component parent, JPopupMenu menu, int x, int y)
public static Command getCommandForMenuItem(JComponent menuComponent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |