use of java.awt.MenuItem in project voltdb by VoltDB.
the class Transfer method addMenuItems.
/**
* Method declaration
*
*
* @param f
* @param m
*/
private void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
if (m[i].equals("-")) {
f.addSeparator();
} else {
MenuItem item = new MenuItem(m[i]);
item.addActionListener(this);
f.add(item);
}
}
}
use of java.awt.MenuItem in project jdk8u_jdk by JetBrains.
the class AWTInputMethodPopupMenu method addMenuItem.
void addMenuItem(Object targetMenu, String label, String command, String currentSelection) {
MenuItem menuItem;
if (isSelected(command, currentSelection)) {
menuItem = new CheckboxMenuItem(label, true);
} else {
menuItem = new MenuItem(label);
}
menuItem.setActionCommand(command);
menuItem.addActionListener(this);
menuItem.setEnabled(command != null);
((Menu) targetMenu).add(menuItem);
}
use of java.awt.MenuItem in project jdk8u_jdk by JetBrains.
the class CMenuItem method setLabel.
public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
int keyMask = modifiers;
if (keyCode == KeyEvent.VK_UNDEFINED) {
MenuShortcut shortcut = ((MenuItem) getTarget()).getShortcut();
if (shortcut != null) {
keyCode = shortcut.getKey();
keyMask |= InputEvent.META_MASK;
if (shortcut.usesShiftModifier()) {
keyMask |= InputEvent.SHIFT_MASK;
}
}
}
if (label == null) {
label = "";
}
// CHAR_UNDEFINED into 0.
if (keyChar == KeyEvent.CHAR_UNDEFINED) {
keyChar = 0;
}
final String finalLabel = label;
final char finalKeyChar = keyChar;
final int finalKeyCode = keyCode;
final int finalKeyMask = keyMask;
execute(ptr -> nativeSetLabel(ptr, finalLabel, finalKeyChar, finalKeyCode, finalKeyMask));
}
Aggregations