Java 类java.awt.MenuShortcut 实例源码
项目:dev-courses
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:wwwa
文件:AWTExample.java
public static void main(String[] args) {
Container container = new Container();
Panel panel = new Panel();
Menu menu = new Menu(); //!!! its not component
TextField textField = new TextField();
container.add(textField);
Window win = new Window(null);
win.pack();
menu.setShortcut(new MenuShortcut(12));
new MenuItem("label", new MenuShortcut(33, true));
Menu file = new Menu("File");
MenuItem print;
file.add(print = new MenuItem("Print", new MenuShortcut('p')));
}
项目:NotifyTools
文件:AwtMenuShortcutPersistenceDelegate.java
@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 });
}
项目:litiengine
文件:Program.java
private static Menu initFileMenu() {
Menu mnFile = new Menu(Resources.get("menu_file"));
MenuItem create = new MenuItem(Resources.get("menu_createProject"));
create.setShortcut(new MenuShortcut(KeyEvent.VK_N));
create.addActionListener(a -> EditorScreen.instance().create());
MenuItem load = new MenuItem(Resources.get("menu_loadProject"));
load.setShortcut(new MenuShortcut(KeyEvent.VK_O));
load.addActionListener(a -> EditorScreen.instance().load());
MenuItem save = new MenuItem(Resources.get("menu_save"));
save.setShortcut(new MenuShortcut(KeyEvent.VK_S));
save.addActionListener(a -> EditorScreen.instance().save(false));
MenuItem saveAs = new MenuItem(Resources.get("menu_saveAs"));
saveAs.addActionListener(a -> EditorScreen.instance().save(true));
MenuItem exit = new MenuItem(Resources.get("menu_exit"));
exit.setShortcut(new MenuShortcut(KeyEvent.VK_Q));
exit.addActionListener(a -> Game.terminate());
mnFile.add(load);
mnFile.add(create);
mnFile.add(save);
mnFile.add(saveAs);
mnFile.addSeparator();
recentFiles = new Menu(Resources.get("menu_recentFiles"));
loadRecentFiles();
mnFile.add(recentFiles);
mnFile.addSeparator();
mnFile.add(exit);
return mnFile;
}
项目:OpenDiabetes
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:sstore-soft
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:s-store
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:OpenJSharp
文件:CMenuItem.java
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);
}
项目:parabuild-ci
文件:DatabaseManager.java
/**
* Method declaration
*
*
* @param f
* @param m
*/
void addMenuItems(Menu f, String m[]) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:parabuild-ci
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:parabuild-ci
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:parabuild-ci
文件:DatabaseManager.java
/**
* Method declaration
*
*
* @param f
* @param m
*/
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:jdk8u-jdk
文件:CMenuItem.java
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));
}
项目:openjdk-jdk10
文件:CMenuItem.java
@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));
}
项目:openjdk9
文件:CMenuItem.java
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);
}
项目:jdk8u_jdk
文件:CMenuItem.java
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));
}
项目:lookaside_java-1.8.0-openjdk
文件:CMenuItem.java
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));
}
项目:javify
文件:GtkMenuPeer.java
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);
}
项目:javify
文件:GtkMenuPeer.java
public void addItem (MenuItemPeer item, MenuShortcut ms)
{
int key = 0;
boolean shiftModifier = false;
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem (item, key, shiftModifier);
}
项目:jvm-stm
文件:GtkMenuPeer.java
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);
}
项目:jvm-stm
文件:GtkMenuPeer.java
public void addItem (MenuItemPeer item, MenuShortcut ms)
{
int key = 0;
boolean shiftModifier = false;
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem (item, key, shiftModifier);
}
项目:VoltDB
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:openbeans
文件:AwtMenuShortcutPersistenceDelegate.java
@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 });
}
项目:infobip-open-jdk-8
文件:CMenuItem.java
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);
}
项目:jdk8u-dev-jdk
文件:CMenuItem.java
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);
}
项目:Pegasus
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:OLD-OpenJDK8
文件:CMenuItem.java
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);
}
项目:cn1
文件:AwtMenuShortcutPersistenceDelegate.java
@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});
}
项目:cn1
文件:Encoder.java
private static void registerAwtPDs() {
delegates.put(Choice.class, new AwtChoicePersistenceDelegate());
delegates.put(Color.class, new AwtColorPersistenceDelegate());
delegates.put(Container.class,
new AwtContainerPersistenceDelegate());
delegates.put(Component.class,
new AwtComponentPersistenceDelegate());
delegates.put(Cursor.class, new AwtCursorPersistenceDelegate());
delegates.put(Dimension.class,
new AwtDimensionPersistenceDelegate());
delegates.put(Font.class, new AwtFontPersistenceDelegate());
delegates.put(Insets.class, new AwtInsetsPersistenceDelegate());
delegates.put(List.class, new AwtListPersistenceDelegate());
delegates.put(Menu.class, new AwtMenuPersistenceDelegate());
delegates.put(MenuBar.class, new AwtMenuBarPersistenceDelegate());
delegates.put(MenuShortcut.class,
new AwtMenuShortcutPersistenceDelegate());
delegates.put(Point.class, new AwtPointPersistenceDelegate());
delegates.put(Rectangle.class,
new AwtRectanglePersistenceDelegate());
delegates.put(SystemColor.class,
new AwtSystemColorPersistenceDelegate());
delegates.put(TextAttribute.class,
new AwtFontTextAttributePersistenceDelegate());
delegates.put(ScrollPane.class,
new AwtScrollPanePersistenceDelegate());
}
项目:JamVM-PH
文件:GtkMenuPeer.java
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);
}
项目:JamVM-PH
文件:GtkMenuPeer.java
public void addItem (MenuItemPeer item, MenuShortcut ms)
{
int key = 0;
boolean shiftModifier = false;
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem (item, key, shiftModifier);
}
项目:openjdk-jdk7u-jdk
文件:CMenuItem.java
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);
}
项目:classpath
文件:GtkMenuPeer.java
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);
}
项目:classpath
文件:GtkMenuPeer.java
public void addItem (MenuItemPeer item, MenuShortcut ms)
{
int key = 0;
boolean shiftModifier = false;
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem (item, key, shiftModifier);
}
项目:freeVM
文件:AwtMenuShortcutPersistenceDelegate.java
@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 });
}
项目:Mobile-Network-LTE
文件:DatabaseManager.java
void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
MenuItem item = new MenuItem(m[i].substring(1));
char c = m[i].charAt(0);
if (c != '-') {
item.setShortcut(new MenuShortcut(c));
}
item.addActionListener(this);
f.add(item);
}
}
项目:openjdk-icedtea7
文件:CMenuItem.java
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);
}
项目:app55-java
文件:AwtMenuShortcutPersistenceDelegate.java
@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 });
}
项目:zayf
文件:ZayfTrayIcon.java
private static PopupMenu getMenu()
{
menu = new PopupMenu(ZAYF_TRAY_TOOLTIP);
exitItem = new MenuItem("exit", new MenuShortcut('x'));
menu.add(exitItem);
return menu;
}
项目:hypergraphdb-android
文件:AwtMenuShortcutPersistenceDelegate.java
@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 });
}