本文整理了Java中javax.swing.JMenu.getComponentCount()
方法的一些代码示例,展示了JMenu.getComponentCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.getComponentCount()
方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:getComponentCount
暂无
代码示例来源:origin: freeplane/freeplane
public JMenu getExtraSubMenu(JMenu parentComponent) {
final Component lastComponent = parentComponent.getComponent(parentComponent.getComponentCount()-1);
if (isExtraSubMenu(lastComponent))
return (JMenu) lastComponent;
else
return null;
}
代码示例来源:origin: freeplane/freeplane
public boolean hasExtraSubMenu(final JMenu menu) {
final Component lastComponent = menu.getComponent(menu.getComponentCount()-1);
return isExtraSubMenu(lastComponent);
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public JMenuItem getMenuPresenter() {
List<File> openedFiles = OpenProductAction.getOpenedProductFiles();
List<String> pathList = getRecentProductPaths().get();
final Preferences preference = SnapApp.getDefault().getPreferences();
int maxFileList = preference.getInt(UiBehaviorController.PREFERENCE_KEY_LIST_FILES_TO_REOPEN,
DEFAULT_MAX_FILE_LIST_REOPEN);
// Add "open recent product file" actions
JMenu menu = new JMenu(Bundle.CTL_ReopenProductActionMenuText());
pathList.stream().limit(maxFileList).forEach(path->{
if (!openedFiles.contains(new File(path))) {
JMenuItem menuItem = new JMenuItem(path);
OpenProductAction openProductAction = new OpenProductAction();
openProductAction.setFile(new File(path));
menuItem.addActionListener(openProductAction);
menu.add(menuItem);
}
});
// Add "Clear List" action
if (menu.getComponentCount() > 0 || pathList.size() > 0) {
menu.addSeparator();
JMenuItem menuItem = new JMenuItem(Bundle.CTL_ClearListActionMenuText());
menuItem.addActionListener(e -> getRecentProductPaths().clear());
menu.add(menuItem);
}
return menu;
}
代码示例来源:origin: MegaMek/mekhq
if (unsorted.getComponentCount() > 0 || unsorted.getItemCount() > 0) {
menu.add(unsorted);
menu.setEnabled(true);
内容来源于网络,如有侵权,请联系作者删除!