本文整理了Java中java.awt.Menu.getLabel()
方法的一些代码示例,展示了Menu.getLabel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.getLabel()
方法的具体详情如下:
包路径:java.awt.Menu
类名称:Menu
方法名:getLabel
暂无
代码示例来源:origin: net.imagej/imagej-legacy
/**
* Helper method to look up special cases for menu weighting
*/
private int getIndex(final Menu menu, final String label) {
// Place export sub-menu after import sub-menu
if (menu.getLabel().equals("File") && label.equals("Export")) {
for (int i = 0; i < menu.getItemCount(); i++) {
final MenuItem menuItem = menu.getItem(i);
if (menuItem.getLabel().equals("Import")) return i + 1;
}
}
// TODO pass and use actual command weight from IJ2.. maybe?
// No special case: append to end of menu
return menu.getItemCount();
}
代码示例来源:origin: net.imagej/ij
/** Builds up a root tree from ImageJ's menu bar.
* The root tree replicates ImageJ's menu bar with its menus and their submenus.
* Delegates to the {@link recursesubMenu(Menu, DefaultMutableTreeNode} method to gather the root children.
*
*/
private synchronized DefaultMutableTreeNode doRootFromMenus() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("ImageJ Menus");
if(argLength==0) node.setUserObject("Control Panel");
MenuBar menuBar = Menus.getMenuBar();
for (int i=0; i<menuBar.getMenuCount(); i++) {
Menu menu = menuBar.getMenu(i);
DefaultMutableTreeNode menuNode = new DefaultMutableTreeNode(menu.getLabel());
recurseSubMenu(menu, menuNode);
node.add(menuNode);
}
return node;
}
代码示例来源:origin: imagej/ImageJA
/** Builds up a root tree from ImageJ's menu bar.
* The root tree replicates ImageJ's menu bar with its menus and their submenus.
* Delegates to the {@link recursesubMenu(Menu, DefaultMutableTreeNode} method to gather the root children.
*
*/
private synchronized DefaultMutableTreeNode doRootFromMenus() {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("ImageJ Menus");
if(argLength==0) node.setUserObject("Control Panel");
MenuBar menuBar = Menus.getMenuBar();
for (int i=0; i<menuBar.getMenuCount(); i++) {
Menu menu = menuBar.getMenu(i);
DefaultMutableTreeNode menuNode = new DefaultMutableTreeNode(menu.getLabel());
recurseSubMenu(menu, menuNode);
node.add(menuNode);
}
return node;
}
代码示例来源:origin: net.imagej/ij
public void findAllMenuItems() {
MenuBar menuBar = Menus.getMenuBar();
int topLevelMenus = menuBar.getMenuCount();
for (int i=0; i<topLevelMenus; ++i) {
Menu topLevelMenu=menuBar.getMenu(i);
parseMenu(topLevelMenu.getLabel(), topLevelMenu);
}
}
代码示例来源:origin: imagej/ImageJA
public void findAllMenuItems() {
MenuBar menuBar = Menus.getMenuBar();
int topLevelMenus = menuBar.getMenuCount();
for (int i=0; i<topLevelMenus; ++i) {
Menu topLevelMenu=menuBar.getMenu(i);
parseMenu(topLevelMenu.getLabel(), topLevelMenu);
}
}
代码示例来源:origin: sc.fiji/3D_Viewer
private JMenu menuToJMenu(final Menu menu) {
final JMenu jm = new JMenu(menu.getLabel());
final int num = menu.getItemCount();
for (int i = 0; i < num; i++) {
代码示例来源:origin: sc.fiji/VIB-lib
public static String[] getWindowList() {
Vector v = new Vector();
MenuBar mbar = Menus.getMenuBar();
Menu menu = null;
for (int i = 0; i < mbar.getMenuCount(); i++)
if (mbar.getMenu(i).getLabel().equals("Window")) {
menu = mbar.getMenu(i);
break;
}
if (menu == null)
throw new RuntimeException("no Window menu?");
for (int i = 0; i < WindowManager.getWindowCount(); i++) {
ImagePlus img = WindowManager.getImage(i + 1);
v.add(img.getTitle());
}
for (int i = 0; i < menu.getItemCount(); i++) {
String title = menu.getItem(i).getLabel();
if (WindowManager.getFrame(title) != null)
v.add(title);
}
String[] result = new String[v.size()];
for (int i = 0; i < result.length; i++)
result[i] = (String)v.get(i);
return result;
}
代码示例来源:origin: net.imagej/imagej-legacy
private void nullShortcut(final IJ1Helper ij1Helper, final String menuLabel,
final String subMenuLabel, final String itemLabel)
{
final MenuBar menuBar = ij1Helper.getMenuBar();
for (int m = 0; m < menuBar.getMenuCount(); m++) {
final Menu menu = menuBar.getMenu(m);
if (!menuLabel.equals(menu.getLabel())) continue;
for (int s = 0; s < menu.getItemCount(); s++) {
final MenuItem ms = menu.getItem(s);
if (!(ms instanceof Menu)) continue;
final Menu subMenu = (Menu) ms;
if (!subMenuLabel.equals(subMenu.getLabel())) continue;
for (int i = 0; i < subMenu.getItemCount(); i++) {
final MenuItem mi = subMenu.getItem(i);
if (!itemLabel.equals(mi.getLabel())) continue;
subMenu.remove(i);
mi.deleteShortcut();
subMenu.insert(mi, i);
}
}
}
}
}
代码示例来源:origin: sc.fiji/VIB-lib
public static boolean addAmiraTableList(GenericDialog g, String t) {
Vector vector = new Vector();
MenuBar mbar = Menus.getMenuBar();
Menu menu = null;
for (int i = 0; i < mbar.getMenuCount(); i++)
if (mbar.getMenu(i).getLabel().equals("Window")) {
menu = mbar.getMenu(i);
break;
}
if (menu == null)
throw new RuntimeException("no Window menu?");
for (int i = 0; i < menu.getItemCount(); i++) {
String title = menu.getItem(i).getLabel();
Frame frame = WindowManager.getFrame(title);
if (frame != null && frame instanceof AmiraTable)
vector.add(title);
}
if (vector.size() < 1) {
IJ.error("No AmiraTable available");
return false;
}
addChoice(g, t, vector);
return true;
}
代码示例来源:origin: net.imagej/imagej-legacy
if (currentLabel.equals(menu.getLabel())) {
menuCache.put(menuPath, depth, menu);
return menu;
parent.insert(menu, getIndex(parent, menu.getLabel()));
代码示例来源:origin: net.imagej/ij
if (menuBar.getMenuCount()>=5)
pluginsMenu = menuBar.getMenu(5);
if (pluginsMenu==null || !"Plugins".equals(pluginsMenu.getLabel()))
return;
n = pluginsMenu.getItemCount();
代码示例来源:origin: imagej/ImageJA
if (menuBar.getMenuCount()>=5)
pluginsMenu = menuBar.getMenu(5);
if (pluginsMenu==null || !"Plugins".equals(pluginsMenu.getLabel()))
return;
n = pluginsMenu.getItemCount();
代码示例来源:origin: net.imagej/ij
tw.setTitle(title2);
int mbSize = tw.mb!=null?tw.mb.getMenuCount():0;
if (mbSize>0 && tw.mb.getMenu(mbSize-1).getLabel().equals("Results"))
tw.mb.remove(mbSize-1);
title = title2;
代码示例来源:origin: imagej/ImageJA
tw.setTitle(title2);
int mbSize = tw.mb!=null?tw.mb.getMenuCount():0;
if (mbSize>0 && tw.mb.getMenu(mbSize-1).getLabel().equals("Results"))
tw.mb.remove(mbSize-1);
title = title2;
代码示例来源:origin: abbot/abbot
path = ((Menu)top).getLabel() + "|" + path;
内容来源于网络,如有侵权,请联系作者删除!