javax.swing.JMenu.putClientProperty()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中javax.swing.JMenu.putClientProperty()方法的一些代码示例,展示了JMenu.putClientProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.putClientProperty()方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:putClientProperty

JMenu.putClientProperty介绍

暂无

代码示例

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/** Adds the specified action as a menu item to the supplied menu. */
protected void addMenuItem(JMenu m, JMenuItem mi) {
  if (mi != null) {
    if (m.getClientProperty("needsSeparator") == Boolean.TRUE) {
      m.addSeparator();
      m.putClientProperty("needsSeparator", null);
    }
    m.add(mi);
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/** Adds the specified action as a menu item to the supplied menu. */
protected void addAction(JMenu m, Action a) {
  if (a != null) {
    if (m.getClientProperty("needsSeparator") == Boolean.TRUE) {
      m.addSeparator();
      m.putClientProperty("needsSeparator", null);
    }
    JMenuItem mi;
    mi = m.add(a);
    mi.setIcon(null);
    mi.setToolTipText(null);
  }
}

代码示例来源:origin: net.sf.doolin/doolin-gui

@Override
public MenuBuilder createSubMenu(String name, String label) {
  JMenu subMenu = getMenuByName(name);
  if (subMenu != null) {
    return (JMenuBuilder) subMenu.getClientProperty(JMenuBuilder.class);
  } else {
    subMenu = createMenu(name, label);
    this.menu.add(subMenu);
    noSeparator();
    JMenuBuilder menuContainer = new JMenuBuilder(subMenu);
    subMenu.putClientProperty(JMenuBuilder.class, menuContainer);
    return menuContainer;
  }
}

代码示例来源:origin: net.sf.doolin/doolin-gui

@Override
public MenuBuilder createSubMenu(String name, String label) {
  JMenu subMenu = getMenuByName(name);
  if (subMenu != null) {
    return (JMenuBuilder) subMenu.getClientProperty(JMenuBuilder.class);
  } else {
    subMenu = createMenu(name, label);
    this.popupMenu.add(subMenu);
    noSeparator();
    JMenuBuilder menuContainer = new JMenuBuilder(subMenu);
    subMenu.putClientProperty(JMenuBuilder.class, menuContainer);
    return menuContainer;
  }
}

代码示例来源:origin: net.sf.doolin/doolin-gui

@Override
public MenuBuilder createSubMenu(String name, String label) {
  JMenu menu = getMenuByName(name);
  if (menu != null) {
    return (JMenuBuilder) menu.getClientProperty(JMenuBuilder.class);
  } else {
    menu = createMenu(name, label);
    this.menuBar.add(menu);
    noSeparator();
    JMenuBuilder menuContainer = new JMenuBuilder(menu);
    menu.putClientProperty(JMenuBuilder.class, menuContainer);
    return menuContainer;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private void createSubMenu() {
  subMenu = new JMenu(displayName);
  subMenu.setEnabled(isSubmenu);
  subMenu.putClientProperty(DynamicMenuContent.HIDE_WHEN_DISABLED, getValue(DynamicMenuContent.HIDE_WHEN_DISABLED));

代码示例来源:origin: kaikramer/keystore-explorer

getClass().getResource(res.getString("KseFrame.jmChangeType.image")))));
PlatformUtil.setMnemonic(jmKeyStoreChangeType, res.getString("KseFrame.jmChangeType.mnemonic").charAt(0));
jmKeyStoreChangeType.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE); // For the benefit of the plastic L&F
jpmKeyStore.add(jmKeyStoreChangeType);

代码示例来源:origin: kaikramer/keystore-explorer

PlatformUtil.setMnemonic(jmChangeType, res.getString("KseFrame.jmChangeType.mnemonic").charAt(0));
jmChangeType.setEnabled(false);
jmChangeType.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE); // For the benefit of the plastic L&F
jmTools.add(jmChangeType);

代码示例来源:origin: freeplane/freeplane

public void addMenuComponent(JMenu menu, final Component component, final int index) {
  final JPopupMenu popupMenu = menu.getPopupMenu();
  final int itemCount = popupMenu.getComponentCount();
  if(index == 0 || index < itemCount)
    popupMenu.insert(component, index);
  else {
    final Component lastMenuItem = popupMenu.getComponent(itemCount - 1);
    final boolean extraSubMenu = isExtraSubMenu(lastMenuItem);
    if (extraSubMenu || !fitsOnScreen(popupMenu, component)) {
      final JMenu submenu;
      if(extraSubMenu) {
        submenu = (JMenu) lastMenuItem;
      }
      else {
        if (component instanceof JPopupMenu.Separator)
          return;
        submenu = new JMenu("-");
        submenu.putClientProperty(EXTRA_SUBMENU, Boolean.TRUE);
        popupMenu.add(submenu);
        if(! Compat.isMacOsX())
          submenu.getPopupMenu().addPopupMenuListener(MnemonicSetter.INSTANCE);
      }
      addMenuComponent(submenu, component, submenu.getPopupMenu().getComponentCount());
    }
    else
      popupMenu.insert(component, index);
  }
}

相关文章