javax.swing.JMenuItem.getMnemonic()方法的使用及代码示例

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

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

JMenuItem.getMnemonic介绍

暂无

代码示例

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

if (c[i] instanceof JMenuItem) {
 final JMenuItem mi = (JMenuItem) c[i];
 int mn = mi.getMnemonic();
 if (mn <= 0) {
  final String tx = mi.getText() == null ? null : BuLib.candidateMnemonics(mi.getText());

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

if (c[i] instanceof JMenuItem) {
 JMenuItem mi = (JMenuItem) c[i];
 int mn = mi.getMnemonic();
 if (mn <= 0) {
  String tx = BuLib.candidateMnemonics(mi.getText());

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private JMenu cloneMenu(JMenu menu)
{
 JMenu ret = new JMenu(menu.getText());
 for (int i = 0; i < menu.getItemCount(); i++)
 {
   JMenuItem toClone = menu.getItem(i);
   if (toClone instanceof JMenu)
   {
    ret.add(cloneMenu((JMenu) toClone));
   }
   else if(toClone instanceof JMenuItem)
   {
    JMenuItem clone = new JMenuItem(toClone.getText(), toClone.getIcon());
    clone.setMnemonic(toClone.getMnemonic());
    clone.setAction(toClone.getAction());
    clone.setAccelerator(toClone.getAccelerator());
    clone.setToolTipText(toClone.getToolTipText());
    ret.add(clone);
   }
   else
   {
    ret.addSeparator();
   }
 }
 return ret;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

int mn=mi.getMnemonic();
if(mn<=0)

代码示例来源:origin: realXuJiang/bigtable-sql

private JMenu cloneMenu(JMenu menu)
{
 JMenu ret = new JMenu(menu.getText());
 for (int i = 0; i < menu.getItemCount(); i++)
 {
   JMenuItem toClone = menu.getItem(i);
   if (toClone instanceof JMenu)
   {
    ret.add(cloneMenu((JMenu) toClone));
   }
   else if(toClone instanceof JMenuItem)
   {
    JMenuItem clone = new JMenuItem(toClone.getText(), toClone.getIcon());
    clone.setMnemonic(toClone.getMnemonic());
    clone.setAction(toClone.getAction());
    clone.setAccelerator(toClone.getAccelerator());
    clone.setToolTipText(toClone.getToolTipText());
    ret.add(clone);
   }
   else
   {
    ret.addSeparator();
   }
 }
 return ret;
}

代码示例来源:origin: com.jidesoft/jide-oss

int key = menuItem.getMnemonic();
if (key == 0)
  return;

代码示例来源:origin: com.jidesoft/jide-oss

int key = menuItem.getMnemonic();
if (key == 0)
  return;

代码示例来源:origin: com.jidesoft/jide-oss

int key = menuItem.getMnemonic();
if (key == 0)
  return;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

int mnemonic = ((JMenuItem) comp).getMnemonic();
if ( mnemonic != 0 )

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void menuKeyTyped(MenuKeyEvent e)
{
  if (DEBUG)
  {
    System.out.println(
      "in BasicMenuItemUI.menuKeyTyped for " + menuItem.getText());
  }
  int key= menuItem.getMnemonic();
  if (key == 0)
    return;
  if (lower(key) == lower((int) (e.getKeyChar())))
  {
    MenuSelectionManager manager= e.getMenuSelectionManager();
    doClick(manager);
    e.consume();
  }
}
public void menuKeyPressed(MenuKeyEvent e)

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void menuKeyTyped(MenuKeyEvent e) { 
   int key = menuItem.getMnemonic();
   if(key == 0)
      return;
   MenuElement path[] = e.getPath();
   if(lower(key) == lower((int)(e.getKeyChar()))) {
      JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu();
      MenuElement sub[] = popupMenu.getSubElements();
      if(sub.length > 0) {
         MenuSelectionManager manager = e.getMenuSelectionManager();
         MenuElement newPath[] = new MenuElement[path.length + 2];
         System.arraycopy(path,0,newPath,0,path.length);
         newPath[path.length] = popupMenu;
         newPath[path.length+1] = sub[0];
         manager.setSelectedPath(newPath);
      }
      e.consume();
   }
}
public void menuKeyPressed(MenuKeyEvent e) {}

代码示例来源:origin: com.dorkbox/SystemTray

item.setImage(bimage);
item.setShortcut(entry.getMnemonic());
item.setText(entry.getText());

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Handles the mnemonic key typed in the MenuItem if this menuItem is in a standalone popup menu. This
 * invocation normally handled in BasicMenuUI.MenuKeyHandler.menuKeyPressed. Ideally, the MenuKeyHandlers for
 * both BasicMenuItemUI and BasicMenuUI can be consolidated into BasicPopupMenuUI but that would require an
 * semantic change. This would result in a performance win since we can shortcut a lot of the needless
 * processing from MenuSelectionManager.processKeyEvent(). See 4670831.
 */
public void menuKeyTyped(MenuKeyEvent e) {
  if (menuItem != null && menuItem.isEnabled()) {
    int key = menuItem.getMnemonic();
    if (key == 0 || e.getPath().length != 2) // Hack! Only proceed if in a JPopupMenu
      return;
    if (lower((char) key) == lower(e.getKeyChar())) {
      MenuSelectionManager manager =
          e.getMenuSelectionManager();
      doClick(manager);
      e.consume();
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Handles the mnemonic key typed in the MenuItem if this menuItem is in a standalone popup menu. This
 * invocation normally handled in BasicMenuUI.MenuKeyHandler.menuKeyPressed. Ideally, the MenuKeyHandlers for
 * both BasicMenuItemUI and BasicMenuUI can be consolidated into BasicPopupMenuUI but that would require an
 * semantic change. This would result in a performance win since we can shortcut a lot of the needless
 * processing from MenuSelectionManager.processKeyEvent(). See 4670831.
 */
public void menuKeyTyped(MenuKeyEvent e) {
  if (menuItem != null && menuItem.isEnabled()) {
    int key = menuItem.getMnemonic();
    if (key == 0 || e.getPath().length != 2) // Hack! Only proceed if in a JPopupMenu
      return;
    if (lower((char) key) == lower(e.getKeyChar())) {
      MenuSelectionManager manager =
          e.getMenuSelectionManager();
      doClick(manager);
      e.consume();
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Handles the mnemonic key typed in the MenuItem if this menuItem is in a standalone popup menu. This
 * invocation normally handled in BasicMenuUI.MenuKeyHandler.menuKeyPressed. Ideally, the MenuKeyHandlers for
 * both BasicMenuItemUI and BasicMenuUI can be consolidated into BasicPopupMenuUI but that would require an
 * semantic change. This would result in a performance win since we can shortcut a lot of the needless
 * processing from MenuSelectionManager.processKeyEvent(). See 4670831.
 */
public void menuKeyTyped(MenuKeyEvent e) {
  if (menuItem != null && menuItem.isEnabled()) {
    int key = menuItem.getMnemonic();
    if (key == 0 || e.getPath().length != 2) // Hack! Only proceed if in a JPopupMenu
      return;
    if (lower((char) key) == lower(e.getKeyChar())) {
      MenuSelectionManager manager =
          e.getMenuSelectionManager();
      doClick(manager);
      e.consume();
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

continue;
int key = ((JMenuItem) items[j]).getMnemonic();
if (lower((char) key) == lower(keyChar)) {
  if (matches == 0) {

代码示例来源:origin: com.jidesoft/jide-oss

int key = ((JMenuItem) items[j]).getMnemonic();
if (lower((char) key) == lower(keyChar)) {
  if (matches == 0) {

代码示例来源:origin: com.jidesoft/jide-oss

int key = ((JMenuItem) items[j]).getMnemonic();
if (lower((char) key) == lower(keyChar)) {
  if (matches == 0) {

相关文章

JMenuItem类方法