@Override public void setText(final MenuItem menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setLabel(menuItem.getText()); } }); }
@Override public void setShortcut(final MenuItem menuItem) { // yikes... final int vKey = SwingUtil.getVirtualKey(menuItem.getShortcut()); SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setShortcut(new MenuShortcut(vKey)); } }); }
SwingUtil.invokeAndWaitQuietly(new Runnable() { @Override public
/** * Sets a menu entry shortcut key (Mnemonic) so that menu entry can be "selected" via the keyboard while the menu is displayed. * * Mnemonics are case-insensitive, and if the character defined by the mnemonic is found within the text, the first occurrence * of it will be underlined. * * @param key this is the VK key to set as the mnemonic */ public void setShortcut(final int key) { this.mnemonicKey = SwingUtil.getFromVirtualKey(key); if (peer != null) { ((MenuItemPeer) peer).setShortcut(this); } }
@Override public void run() { JMenuItem jMenuItem = new JMenuItem(); // do the same modifications that would also happen (if specified) for the actual displayed menu items if (SystemTray.SWING_UI != null) { jMenuItem.setUI(SystemTray.SWING_UI.getItemUI(jMenuItem, null)); } // this is the largest size of an image used in a JMenuItem, before the size of the JMenuItem is forced to be larger int height = SwingUtil.getLargestIconHeightForButton(jMenuItem); iconSize.set(height); } });
SwingUtil.invokeAndWait(new Runnable() { @Override public
@Override public void setShortcut(final MenuItem menuItem) { char shortcut = menuItem.getShortcut(); // yikes... final int vKey = SwingUtil.getVirtualKey(shortcut); SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setMnemonic(vKey); } }); }
final AtomicInteger iconSize = new AtomicInteger(); SwingUtil.invokeAndWaitQuietly(new Runnable() { @Override public
/** * Sets a menu entry shortcut key (Mnemonic) so that menu entry can be "selected" via the keyboard while the menu is displayed. * * Mnemonics are case-insensitive, and if the character defined by the mnemonic is found within the text, the first occurrence * of it will be underlined. * * @param key this is the VK key to set as the mnemonic */ public void setShortcut(final int key) { this.mnemonicKey = SwingUtil.getFromVirtualKey(key); if (peer != null) { ((CheckboxPeer) peer).setShortcut(this); } } }
@Override public void setEnabled(final Checkbox menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setEnabled(menuItem.getEnabled()); } }); }
@Override public void setShortcut(final Checkbox menuItem) { char shortcut = menuItem.getShortcut(); // yikes... final int vKey = SwingUtil.getVirtualKey(shortcut); SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setMnemonic(vKey); } }); }
@Override public void setText(final Checkbox menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setLabel(menuItem.getText()); } }); }
@Override public void setShortcut(final dorkbox.systemTray.MenuItem menuItem) { char shortcut = menuItem.getShortcut(); // yikes... final int vKey = SwingUtil.getVirtualKey(shortcut); SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setShortcut(new MenuShortcut(vKey)); } }); }
@Override public void setText(final Status menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setText(menuItem.getText()); } }); }
@Override public void setShortcut(final Checkbox menuItem) { char shortcut = menuItem.getShortcut(); // yikes... final int vKey = SwingUtil.getVirtualKey(shortcut); SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setShortcut(new MenuShortcut(vKey)); } }); }
@Override public void setEnabled(final Checkbox menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setEnabled(menuItem.getEnabled()); } }); }
@Override public void setShortcut(final MenuItem menuItem) { char shortcut = menuItem.getShortcut(); // yikes... final int vKey = SwingUtil.getVirtualKey(shortcut); SwingUtil.invokeLater(new Runnable() { @Override public void run() { ((JMenu) _native).setMnemonic(vKey); } }); }
@Override public void remove() { SwingUtil.invokeLater(new Runnable() { @Override public void run() { parent._native.remove(_native); } }); } }
@Override public void setEnabled(final MenuItem menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setEnabled(menuItem.getEnabled()); } }); }
@Override public void setText(final Checkbox menuItem) { SwingUtil.invokeLater(new Runnable() { @Override public void run() { _native.setText(menuItem.getText()); } }); }