本文整理了Java中javax.swing.JMenu.getAction()
方法的一些代码示例,展示了JMenu.getAction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.getAction()
方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:getAction
暂无
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking
@Override
public void actionPerformed(ActionEvent e) {
menu.getAction().actionPerformed(e);
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
/**
* Add an hierarchical menu to the popup menu for all node types.
*
* @param menu <TT>JMenu</TT> to add to menu.
*
* @throws IllegalArgumentException
* Thrown if a <TT>null</TT> <TT>JMenu</TT> thrown.
*/
public void addToPopup(JMenu menu)
{
if (menu == null)
{
throw new IllegalArgumentException("JMenu == null");
}
_globalPopup.add(menu);
_globalActions.add(menu.getAction());
for (Iterator<JPopupMenu> it = _popups.values().iterator(); it.hasNext();)
{
JPopupMenu pop = it.next();
pop.add(menu);
}
}
代码示例来源:origin: realXuJiang/bigtable-sql
/**
* Add an hierarchical menu to the popup menu for all node types.
*
* @param menu <TT>JMenu</TT> to add to menu.
*
* @throws IllegalArgumentException
* Thrown if a <TT>null</TT> <TT>JMenu</TT> thrown.
*/
public void addToPopup(JMenu menu)
{
if (menu == null)
{
throw new IllegalArgumentException("JMenu == null");
}
_globalPopup.add(menu);
_globalActions.add(menu.getAction());
for (Iterator<JPopupMenu> it = _popups.values().iterator(); it.hasNext();)
{
JPopupMenu pop = it.next();
pop.add(menu);
}
}
代码示例来源:origin: com.nelkinda.japi/nelkinda-japi-swing
public static Optional<JMenu> findJMenu(final JMenuBar jMenuBar, final String actionCommand) {
for (int i = 0; i < jMenuBar.getMenuCount(); i++) {
final JMenu jMenu = jMenuBar.getMenu(i);
if (actionCommand.equals(jMenu.getAction().getValue(ACTION_COMMAND_KEY))) {
return Optional.of(jMenu);
}
final Optional<JMenu> candidate = findJMenu(jMenu, actionCommand);
if (candidate.isPresent()) {
return candidate;
}
}
return Optional.empty();
}
代码示例来源:origin: com.akiban/akiban-persistit
void changeMenuMap(final Map menuMap, final boolean add) {
for (final Iterator iter = menuMap.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry) iter.next();
String menuName = (String) entry.getKey();
if (menuName.indexOf(".") >= 0) {
menuName = menuName.substring(0, menuName.indexOf("."));
}
final JComponent[] items = (JComponent[]) entry.getValue();
final Action menuAction = (Action) _actionMap.get(menuName);
final JMenuBar bar = _frame.getJMenuBar();
if (menuAction != null) {
for (int index = 0; index < bar.getMenuCount(); index++) {
final JMenu menu = bar.getMenu(index);
if (menu.getAction() == menuAction) {
for (int k = 0; k < items.length; k++) {
final JComponent item = items[k];
if (add) {
menu.add(item);
} else {
menu.remove(item);
}
}
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!