java.awt.event.InputEvent#CTRL_MASK源码实例Demo

下面列出了java.awt.event.InputEvent#CTRL_MASK 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Processing.R   文件: RLangInputHandler.java
@Override
public boolean handleTyped(KeyEvent event) {
  char c = event.getKeyChar();

  if ((event.getModifiers() & InputEvent.CTRL_MASK) != 0) {
    // on linux, ctrl-comma (prefs) being passed through to the editor
    if (c == KeyEvent.VK_COMMA) {
      event.consume();
      return true;
    }
    // https://github.com/processing/processing/issues/3847
    if (c == KeyEvent.VK_SPACE) {
      event.consume();
      return true;
    }
  }
  return false;
}
 
源代码2 项目: Bytecoder   文件: DragSourceDragEvent.java
/**
 * Sets old modifiers by the new ones.
 */
@SuppressWarnings("deprecation")
private void setOldModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_MASK;
    }
}
 
源代码3 项目: openjdk-jdk8u-backup   文件: bug7170657.java
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
/**
 * Sets old modifiers by the new ones.
 */
private void setOldModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_MASK;
    }
}
 
源代码5 项目: jdk8u60   文件: DragSourceDragEvent.java
/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: AWTKeyStroke.java
private static int mapNewModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_MASK;
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_MASK;
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        modifiers |= InputEvent.CTRL_MASK;
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        modifiers |= InputEvent.META_MASK;
    }

    return modifiers;
}
 
源代码7 项目: jdk8u-jdk   文件: bug7170657.java
public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
源代码9 项目: hottub   文件: DragSourceDragEvent.java
/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
源代码10 项目: tn5250j   文件: KeyMapper.java
public final static KeyStroke getKeyStroke(String which) {

		Collection<String> v = mappedKeys.values();
		Set<KeyStroker> o = mappedKeys.keySet();
		Iterator<KeyStroker> k = o.iterator();
		Iterator<String> i = v.iterator();
		while (k.hasNext()) {
			KeyStroker ks = k.next();
			String keyVal = i.next();
			if (keyVal.equals(which)) {
				int mask = 0;

				if (ks.isShiftDown())
					mask |= InputEvent.SHIFT_MASK;
				if (ks.isControlDown())
					mask |= InputEvent.CTRL_MASK;
				if (ks.isAltDown())
					mask |= InputEvent.ALT_MASK;
				if (ks.isAltGrDown())
					mask |= InputEvent.ALT_GRAPH_MASK;

				return KeyStroke.getKeyStroke(ks.getKeyCode(),mask);
			}
		}

		return KeyStroke.getKeyStroke(0,0);
	}
 
源代码11 项目: jdk8u60   文件: AWTKeyStroke.java
private static int mapOldModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        modifiers |= InputEvent.ALT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        modifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        modifiers |= InputEvent.META_DOWN_MASK;
    }

    modifiers &= InputEvent.SHIFT_DOWN_MASK
        | InputEvent.ALT_DOWN_MASK
        | InputEvent.ALT_GRAPH_DOWN_MASK
        | InputEvent.CTRL_DOWN_MASK
        | InputEvent.META_DOWN_MASK
        | InputEvent.BUTTON1_DOWN_MASK
        | InputEvent.BUTTON2_DOWN_MASK
        | InputEvent.BUTTON3_DOWN_MASK;

    return modifiers;
}
 
源代码12 项目: consulo   文件: MacKeymapUtil.java
public static String getModifiersText(@JdkConstants.InputEventMask int modifiers) {
  StringBuilder buf = new StringBuilder();
  if ((modifiers & InputEvent.CTRL_MASK) != 0) buf.append(CONTROL);
  if ((modifiers & InputEvent.ALT_MASK) != 0) buf.append(OPTION);
  if ((modifiers & InputEvent.SHIFT_MASK) != 0) buf.append(SHIFT);
  if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) buf.append(Toolkit.getProperty("AWT.altGraph", "Alt Graph"));
  if ((modifiers & InputEvent.BUTTON1_MASK) != 0) buf.append(Toolkit.getProperty("AWT.button1", "Button1"));
  if ((modifiers & InputEvent.META_MASK) != 0) buf.append(COMMAND);
  return buf.toString();

}
 
源代码13 项目: megamek   文件: MiniMap.java
void processMouseClick(int x, int y, MouseEvent me) {
    if (y > (getSize().height - 14) && !dragging) {
        if (minimized) {
            setSize(getSize().width, heightBufer);
            m_mapImage = createImage(getSize().width, heightBufer);
            minimized = false;
            initializeMap();
        } else {
            if (x < 14) {
                zoomIn();
            } else if ((x < 28) && (zoom > 2)) {
                heightDisplayMode = ((++heightDisplayMode) > NBR_MODES) ? 0
                        : heightDisplayMode;
                initializeMap();
            } else if (x > (getSize().width - 14)) {
                zoomOut();
            } else {
                // Minimize button
                heightBufer = getSize().height;
                setSize(getSize().width, 14);
                m_mapImage = createImage(Math.max(1, getSize().width), 14);

                minimized = true;
                initializeMap();
            }  
        }
    } else if (m_bview != null) {
        if ((x < margin) || (x > (getSize().width - leftMargin))
            || (y < topMargin)
            || (y > (getSize().height - topMargin - 14))) {
            return;
        }
        if ((me.getModifiers() & InputEvent.CTRL_MASK) != 0) {
            m_bview
                    .checkLOS(translateCoords(x - leftMargin, y - topMargin));
        } else {
            m_bview.centerOnPointRel(
                    ((double)(x - leftMargin))/(double)((hexSideBySin30[zoom] + hexSide[zoom])*m_board.getWidth()),
                    ((double)(y - topMargin))/(double)(2 * hexSideByCos30[zoom]*m_board.getHeight()));
            m_bview.stopSoftCentering();
            repaint();
        }
    }
}
 
源代码14 项目: openjdk-8-source   文件: LWCToolkit.java
/**
 * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
 */
@Override
public int getFocusAcceleratorKeyMask() {
    return InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
}
 
源代码15 项目: jdk8u-jdk   文件: LWCToolkit.java
/**
 * Tests whether specified key modifiers mask can be used to enter a
 * printable character.
 */
@Override
public boolean isPrintableCharacterModifiersMask(int mods) {
    return ((mods & (InputEvent.META_MASK | InputEvent.CTRL_MASK)) == 0);
}
 
源代码16 项目: netbeans   文件: GlassPane.java
private static boolean ctrlOrCmdModifier(MouseEvent e) {
    if (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() == InputEvent.META_MASK) { // on Mac
        return (e.getModifiersEx() & InputEvent.META_DOWN_MASK) == InputEvent.META_DOWN_MASK;
    }
    return (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK;
}
 
源代码17 项目: SIMVA-SoS   文件: ChartPanel.java
/**
 * Constructs a JFreeChart panel.
 *
 * @param chart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawWidth  the minimum drawing width.
 * @param minimumDrawHeight  the minimum drawing height.
 * @param maximumDrawWidth  the maximum drawing width.
 * @param maximumDrawHeight  the maximum drawing height.
 * @param useBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param copy  a flag indicating whether or not a copy option should be
 *              available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be
 *                  enabled for the chart.
 *
 * @since 1.0.13
 */
public ChartPanel(JFreeChart chart, int width, int height,
       int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth,
       int maximumDrawHeight, boolean useBuffer, boolean properties,
       boolean copy, boolean save, boolean print, boolean zoom,
       boolean tooltips) {

    setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || copy || save || print || zoom) {
        this.popup = createPopupMenu(properties, copy, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;
    this.zoomOutlinePaint = Color.blue;
    this.zoomFillPaint = new Color(0, 0, 255, 63);

    this.panMask = InputEvent.CTRL_MASK;
    // for MacOSX we can't use the CTRL key for mouse drags, see:
    // http://developer.apple.com/qa/qa2004/qa1362.html
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.startsWith("mac os x")) {
        this.panMask = InputEvent.ALT_MASK;
    }

    this.overlays = new java.util.ArrayList();
}
 
源代码18 项目: consulo   文件: StructureFilterPopupComponent.java
@JdkConstants.InputEventMask
private int getMask() {
  return SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK;
}
 
源代码19 项目: jdk8u-jdk   文件: SunToolkit.java
/**
 * Tests whether specified key modifiers mask can be used to enter a printable
 * character. This is a default implementation of this method, which reflects
 * the way things work on Windows: here, pressing ctrl + alt allows user to enter
 * characters from the extended character set (like euro sign or math symbols)
 */
public boolean isPrintableCharacterModifiersMask(int mods) {
    return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK));
}
 
源代码20 项目: jdk8u-dev-jdk   文件: SunToolkit.java
/**
 * Tests whether specified key modifiers mask can be used to enter a printable
 * character. This is a default implementation of this method, which reflects
 * the way things work on Windows: here, pressing ctrl + alt allows user to enter
 * characters from the extended character set (like euro sign or math symbols)
 */
public boolean isPrintableCharacterModifiersMask(int mods) {
    return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK));
}