Java Code Examples for javax.swing.JMenuItem#getMnemonic()
The following examples show how to use
javax.swing.JMenuItem#getMnemonic() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MnemonicFactory.java From ramus with GNU General Public License v3.0 | 6 votes |
private static void setMnemonics(final ArrayList<JMenuItem> list) { final ArrayList<Character> c = new ArrayList<Character>(); for (final JMenuItem item : list) if (item != null) { setMnemonics(item); final int m = item.getMnemonic(); if (m == 0) { final Character mn = getM(c, item.getText()); if (mn != null) { c.add(mn); item.setMnemonic(mn); } } else c.add(new Character((char) m)); } }
Example 2
Source File: GuiMenu.java From FancyBing with GNU General Public License v3.0 | 5 votes |
public JMenuItem add(JMenuItem item) { super.add(item); item.setToolTipText(null); item.setIcon(null); int mnemonic = item.getMnemonic(); if (mnemonic > 0) { if (m_mnemonics.contains(mnemonic)) System.err.println("Warning: duplicate mnemonic item: " + item.getText()); m_mnemonics.add(mnemonic); } return item; }
Example 3
Source File: GuiMenu.java From FancyBing with GNU General Public License v3.0 | 5 votes |
public void remove(JMenuItem item) { int mnemonic = item.getMnemonic(); if (mnemonic > 0) m_mnemonics.remove(Integer.valueOf(mnemonic)); super.remove(item); }
Example 4
Source File: NbMenuItem.java From netbeans with Apache License 2.0 | 5 votes |
/** * @param it * @return instance of NbMenuItem constructed from parameter it */ public NbMenuItem(JMenuItem it) { setName(it.getText());//getLabel(); this.accelerator = (it.getAccelerator() == null) ? null : it.getAccelerator().toString(); this.mnemo = (char) it.getMnemonic(); // System.out.println("NbMenuItem ["+name+"] - mnemo: ["+it.getMnemonic()+"]"); why are the mnemonic always in capital? this.enabled = it.isEnabled(); this.checkbox = it instanceof JCheckBoxMenuItem; this.radiobutton = it instanceof JRadioButtonMenuItem; this.checked = it.isSelected(); }
Example 5
Source File: NbMenuItem.java From netbeans with Apache License 2.0 | 5 votes |
/** * @param it * @return instance of NbMenuItem constructed from parameter it */ public NbMenuItem(JMenuItem it) { setName(it.getText());//getLabel(); this.accelerator = (it.getAccelerator() == null) ? null : it.getAccelerator().toString(); this.mnemo = (char) it.getMnemonic(); // System.out.println("NbMenuItem ["+name+"] - mnemo: ["+it.getMnemonic()+"]"); why are the mnemonic always in capital? this.enabled = it.isEnabled(); this.checkbox = it instanceof JCheckBoxMenuItem; this.radiobutton = it instanceof JRadioButtonMenuItem; this.checked = it.isSelected(); }
Example 6
Source File: MenuChecker.java From netbeans with Apache License 2.0 | 4 votes |
NbMenu(JMenuItem menu, List<NbMenu> submenu) { name = menu.getText();//getLabel(); accelerator = (menu.getAccelerator() == null) ? null : menu.getAccelerator().toString(); mnemo = menu.getMnemonic(); this.submenu = submenu; }