Java Code Examples for java.awt.event.InputEvent#CTRL_MASK
The following examples show how to use
java.awt.event.InputEvent#CTRL_MASK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RLangInputHandler.java From Processing.R with GNU General Public License v3.0 | 6 votes |
@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; }
Example 2
Source File: DragSourceDragEvent.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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; } }
Example 3
Source File: DragSourceDragEvent.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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; } }
Example 4
Source File: bug7170657.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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"); } }
Example 5
Source File: DragSourceDragEvent.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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; } }
Example 6
Source File: DragSourceDragEvent.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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; } }
Example 7
Source File: AWTKeyStroke.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example 8
Source File: bug7170657.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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"); } }
Example 9
Source File: DragSourceDragEvent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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; } }
Example 10
Source File: MacKeymapUtil.java From consulo with Apache License 2.0 | 5 votes |
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(); }
Example 11
Source File: AWTKeyStroke.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example 12
Source File: KeyMapper.java From tn5250j with GNU General Public License v2.0 | 5 votes |
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); }
Example 13
Source File: LWCToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * 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); }
Example 14
Source File: LWCToolkit.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 15
Source File: GlassPane.java From netbeans with Apache License 2.0 | 4 votes |
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; }
Example 16
Source File: MiniMap.java From megamek with GNU General Public License v2.0 | 4 votes |
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(); } } }
Example 17
Source File: ChartPanel.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * 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(); }
Example 18
Source File: StructureFilterPopupComponent.java From consulo with Apache License 2.0 | 4 votes |
@JdkConstants.InputEventMask private int getMask() { return SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK; }
Example 19
Source File: SunToolkit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 2 votes |
/** * 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)); }
Example 20
Source File: SunToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * 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)); }