当前位置: 首页>>代码示例>>Java>>正文


Java MenuShortcut.usesShiftModifier方法代码示例

本文整理汇总了Java中java.awt.MenuShortcut.usesShiftModifier方法的典型用法代码示例。如果您正苦于以下问题:Java MenuShortcut.usesShiftModifier方法的具体用法?Java MenuShortcut.usesShiftModifier怎么用?Java MenuShortcut.usesShiftModifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.MenuShortcut的用法示例。


在下文中一共展示了MenuShortcut.usesShiftModifier方法的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 });
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:9,代码来源:AwtMenuShortcutPersistenceDelegate.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:CMenuItem.java

示例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));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:CMenuItem.java

示例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));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:CMenuItem.java

示例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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:15,代码来源:GtkMenuPeer.java

示例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});
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:AwtMenuShortcutPersistenceDelegate.java

示例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 });
}
 
开发者ID:app55,项目名称:app55-java,代码行数:9,代码来源:AwtMenuShortcutPersistenceDelegate.java


注:本文中的java.awt.MenuShortcut.usesShiftModifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。