本文整理汇总了Java中java.awt.MenuShortcut.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java MenuShortcut.getKey方法的具体用法?Java MenuShortcut.getKey怎么用?Java MenuShortcut.getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.MenuShortcut
的用法示例。
在下文中一共展示了MenuShortcut.getKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiate
import java.awt.MenuShortcut; //导入方法依赖的package包/类
@Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
MenuShortcut shortcut = (MenuShortcut) oldInstance;
int keyCode = shortcut.getKey();
boolean useShiftModifier = shortcut.usesShiftModifier();
return new Expression(shortcut, shortcut.getClass(), BeansUtils.NEW,
new Object[] { keyCode, useShiftModifier });
}
示例2: setLabel
import java.awt.MenuShortcut; //导入方法依赖的package包/类
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 = "";
}
// <rdar://problem/3654824>
// Native code uses a keyChar of 0 to indicate that the
// keyCode should be used to generate the shortcut. Translate
// CHAR_UNDEFINED into 0.
if (keyChar == KeyEvent.CHAR_UNDEFINED) {
keyChar = 0;
}
nativeSetLabel(getModel(), label, keyChar, keyCode, keyMask);
}
示例3: setLabel
import java.awt.MenuShortcut; //导入方法依赖的package包/类
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 = "";
}
// <rdar://problem/3654824>
// Native code uses a keyChar of 0 to indicate that the
// keyCode should be used to generate the shortcut. Translate
// 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));
}
示例4: setLabel
import java.awt.MenuShortcut; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
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 = "";
}
// <rdar://problem/3654824>
// Native code uses a keyChar of 0 to indicate that the
// keyCode should be used to generate the shortcut. Translate
// 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));
}
示例5: addItem
import java.awt.MenuShortcut; //导入方法依赖的package包/类
public void addItem (MenuItem item)
{
int key = 0;
boolean shiftModifier = false;
MenuShortcut ms = item.getShortcut ();
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem ((MenuItemPeer) item.getPeer (), key, shiftModifier);
}
示例6: instantiate
import java.awt.MenuShortcut; //导入方法依赖的package包/类
@Override
@SuppressWarnings("boxing")
protected Expression instantiate(Object oldInstance, Encoder enc) {
MenuShortcut shortcut = (MenuShortcut) oldInstance;
int keyCode = shortcut.getKey();
boolean useShiftModifier = shortcut.usesShiftModifier();
return new Expression(shortcut, shortcut.getClass(),
Statement.CONSTRUCTOR_NAME, new Object[] {keyCode, useShiftModifier});
}
示例7: instantiate
import java.awt.MenuShortcut; //导入方法依赖的package包/类
@Override
protected Expression instantiate(Object oldInstance, Encoder enc)
{
MenuShortcut shortcut = (MenuShortcut) oldInstance;
int keyCode = shortcut.getKey();
boolean useShiftModifier = shortcut.usesShiftModifier();
return new Expression(shortcut, shortcut.getClass(), BeansUtils.NEW, new Object[] { keyCode, useShiftModifier });
}