Java Code Examples for java.awt.event.InputEvent#ALT_DOWN_MASK
The following examples show how to use
java.awt.event.InputEvent#ALT_DOWN_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: XEmbedHelper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Converts XEMBED modifiers mask into AWT InputEvent mask */ int getModifiers(int state) { int mods = 0; if ((state & XEMBED_MODIFIER_SHIFT) != 0) { mods |= InputEvent.SHIFT_DOWN_MASK; } if ((state & XEMBED_MODIFIER_CONTROL) != 0) { mods |= InputEvent.CTRL_DOWN_MASK; } if ((state & XEMBED_MODIFIER_ALT) != 0) { mods |= InputEvent.ALT_DOWN_MASK; } // FIXME: What is super/hyper? // FIXME: Experiments show that SUPER is ALT. So what is Alt then? if ((state & XEMBED_MODIFIER_SUPER) != 0) { mods |= InputEvent.ALT_DOWN_MASK; } // if ((state & XEMBED_MODIFIER_HYPER) != 0) { // mods |= InputEvent.DOWN_MASK; // } return mods; }
Example 2
Source File: AWTKeyStroke.java From openjdk-jdk8u-backup 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 3
Source File: AWTKeyStroke.java From Bytecoder with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") 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 4
Source File: AWTKeyStroke.java From jdk8u-jdk 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 5
Source File: AWTKeyStroke.java From Java8CN with Apache License 2.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 6
Source File: XEmbedHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Converts XEMBED modifiers mask into AWT InputEvent mask */ int getModifiers(int state) { int mods = 0; if ((state & XEMBED_MODIFIER_SHIFT) != 0) { mods |= InputEvent.SHIFT_DOWN_MASK; } if ((state & XEMBED_MODIFIER_CONTROL) != 0) { mods |= InputEvent.CTRL_DOWN_MASK; } if ((state & XEMBED_MODIFIER_ALT) != 0) { mods |= InputEvent.ALT_DOWN_MASK; } // FIXME: What is super/hyper? // FIXME: Experiments show that SUPER is ALT. So what is Alt then? if ((state & XEMBED_MODIFIER_SUPER) != 0) { mods |= InputEvent.ALT_DOWN_MASK; } // if ((state & XEMBED_MODIFIER_HYPER) != 0) { // mods |= InputEvent.DOWN_MASK; // } return mods; }
Example 7
Source File: SWTUtils.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates an AWT <code>MouseEvent</code> from a swt event. * This method helps passing SWT mouse event to awt components. * @param event The swt event. * @return A AWT mouse event based on the given SWT event. */ public static MouseEvent toAwtMouseEvent(org.eclipse.swt.events.MouseEvent event) { int button = MouseEvent.NOBUTTON; switch (event.button) { case 1: button = MouseEvent.BUTTON1; break; case 2: button = MouseEvent.BUTTON2; break; case 3: button = MouseEvent.BUTTON3; break; } int modifiers = 0; if ((event.stateMask & SWT.CTRL) != 0) { modifiers |= InputEvent.CTRL_DOWN_MASK; } if ((event.stateMask & SWT.SHIFT) != 0) { modifiers |= InputEvent.SHIFT_DOWN_MASK; } if ((event.stateMask & SWT.ALT) != 0) { modifiers |= InputEvent.ALT_DOWN_MASK; } MouseEvent awtMouseEvent = new MouseEvent(DUMMY_PANEL, event.hashCode(), event.time, modifiers, event.x, event.y, 1, false, button); return awtMouseEvent; }
Example 8
Source File: XEmbedHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Converts XEMBED modifiers mask into AWT InputEvent mask */ int getModifiers(int state) { int mods = 0; if ((state & XEMBED_MODIFIER_SHIFT) != 0) { mods |= InputEvent.SHIFT_DOWN_MASK; } if ((state & XEMBED_MODIFIER_CONTROL) != 0) { mods |= InputEvent.CTRL_DOWN_MASK; } if ((state & XEMBED_MODIFIER_ALT) != 0) { mods |= InputEvent.ALT_DOWN_MASK; } // FIXME: What is super/hyper? // FIXME: Experiments show that SUPER is ALT. So what is Alt then? if ((state & XEMBED_MODIFIER_SUPER) != 0) { mods |= InputEvent.ALT_DOWN_MASK; } // if ((state & XEMBED_MODIFIER_HYPER) != 0) { // mods |= InputEvent.DOWN_MASK; // } return mods; }
Example 9
Source File: SWTUtils.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates an AWT <code>MouseEvent</code> from a swt event. * This method helps passing SWT mouse event to awt components. * @param event The swt event. * @return A AWT mouse event based on the given SWT event. */ public static MouseEvent toAwtMouseEvent(org.eclipse.swt.events.MouseEvent event) { int button = MouseEvent.NOBUTTON; switch (event.button) { case 1: button = MouseEvent.BUTTON1; break; case 2: button = MouseEvent.BUTTON2; break; case 3: button = MouseEvent.BUTTON3; break; } int modifiers = 0; if ((event.stateMask & SWT.CTRL) != 0) { modifiers |= InputEvent.CTRL_DOWN_MASK; } if ((event.stateMask & SWT.SHIFT) != 0) { modifiers |= InputEvent.SHIFT_DOWN_MASK; } if ((event.stateMask & SWT.ALT) != 0) { modifiers |= InputEvent.ALT_DOWN_MASK; } MouseEvent awtMouseEvent = new MouseEvent(DUMMY_PANEL, event.hashCode(), event.time, modifiers, event.x, event.y, 1, false, button); return awtMouseEvent; }
Example 10
Source File: SWTUtils.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates an AWT <code>MouseEvent</code> from a swt event. * This method helps passing SWT mouse event to awt components. * @param event The swt event. * @return A AWT mouse event based on the given SWT event. */ public static MouseEvent toAwtMouseEvent(org.eclipse.swt.events.MouseEvent event) { int button = MouseEvent.NOBUTTON; switch (event.button) { case 1: button = MouseEvent.BUTTON1; break; case 2: button = MouseEvent.BUTTON2; break; case 3: button = MouseEvent.BUTTON3; break; } int modifiers = 0; if ((event.stateMask & SWT.CTRL) != 0) { modifiers |= InputEvent.CTRL_DOWN_MASK; } if ((event.stateMask & SWT.SHIFT) != 0) { modifiers |= InputEvent.SHIFT_DOWN_MASK; } if ((event.stateMask & SWT.ALT) != 0) { modifiers |= InputEvent.ALT_DOWN_MASK; } MouseEvent awtMouseEvent = new MouseEvent(DUMMY_PANEL, event.hashCode(), event.time, modifiers, event.x, event.y, 1, false, button); return awtMouseEvent; }
Example 11
Source File: DesktopComponentsHelper.java From cuba with Apache License 2.0 | 5 votes |
/** * Convert {@link KeyCombination.Modifier} to {@link InputEvent} modifier constraint. * * @param modifier modifier to convert * @return {@link InputEvent} modifier constraint */ public static int convertModifier(KeyCombination.Modifier modifier) { switch (modifier) { case CTRL: return InputEvent.CTRL_DOWN_MASK; case ALT: return InputEvent.ALT_DOWN_MASK; case SHIFT: return InputEvent.SHIFT_DOWN_MASK; default: throw new IllegalArgumentException("Modifier " + modifier.name() + " not recognized"); } }
Example 12
Source File: JavaRecorderHook.java From marathonv5 with Apache License 2.0 | 5 votes |
public static String inputEventGetModifiersExText(int modifiers) { StringBuffer sb = new StringBuffer(); if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) { sb.append("Ctrl+"); } if ((modifiers & InputEvent.META_DOWN_MASK) != 0) { sb.append("Meta+"); } if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) { sb.append("Alt+"); } if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) { sb.append("Shift+"); } if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) { sb.append("Button1+"); } if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) { sb.append("Button2+"); } if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) { sb.append("Button3+"); } String text = sb.toString(); if (text.equals("")) { return text; } return text.substring(0, text.length() - 1); }
Example 13
Source File: AWTKeyStroke.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
static String getModifiersText(int modifiers) { StringBuilder buf = new StringBuilder(); if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0 ) { buf.append("shift "); } if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0 ) { buf.append("ctrl "); } if ((modifiers & InputEvent.META_DOWN_MASK) != 0 ) { buf.append("meta "); } if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0 ) { buf.append("alt "); } if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0 ) { buf.append("altGraph "); } if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0 ) { buf.append("button1 "); } if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0 ) { buf.append("button2 "); } if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0 ) { buf.append("button3 "); } return buf.toString(); }
Example 14
Source File: DeviceTest.java From marathonv5 with Apache License 2.0 | 5 votes |
protected String getModifiersExText(int modifiers) { StringBuffer buf = new StringBuffer(); if ((modifiers & InputEvent.META_DOWN_MASK) != 0) { buf.append("Meta"); buf.append("+"); } if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) { buf.append("Ctrl"); buf.append("+"); } if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) { buf.append("Alt"); buf.append("+"); } if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) { buf.append("Shift"); buf.append("+"); } if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) { buf.append("Alt Graph"); buf.append("+"); } if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) { buf.append("Button1"); buf.append("+"); } if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) { buf.append("Button2"); buf.append("+"); } if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) { buf.append("Button3"); buf.append("+"); } return buf.toString(); }
Example 15
Source File: InstantRefactoringPerformer.java From netbeans with Apache License 2.0 | 5 votes |
private static String getKeyStrokeAsText(KeyStroke keyStroke) { int modifiers = keyStroke.getModifiers(); StringBuilder sb = new StringBuilder(); sb.append('\''); if ((modifiers & InputEvent.CTRL_DOWN_MASK) > 0) { sb.append("Ctrl+"); //NOI18N } if ((modifiers & InputEvent.ALT_DOWN_MASK) > 0) { sb.append("Alt+"); //NOI18N } if ((modifiers & InputEvent.SHIFT_DOWN_MASK) > 0) { sb.append("Shift+"); //NOI18N } if ((modifiers & InputEvent.META_DOWN_MASK) > 0) { sb.append("Meta+"); //NOI18N } if (keyStroke.getKeyCode() != KeyEvent.VK_SHIFT && keyStroke.getKeyCode() != KeyEvent.VK_CONTROL && keyStroke.getKeyCode() != KeyEvent.VK_META && keyStroke.getKeyCode() != KeyEvent.VK_ALT && keyStroke.getKeyCode() != KeyEvent.VK_ALT_GRAPH) { sb.append(org.openide.util.Utilities.keyToString( KeyStroke.getKeyStroke(keyStroke.getKeyCode(), 0) )); } sb.append('\''); return sb.toString(); }
Example 16
Source File: InteractiveTracerCanvas.java From SNT with GNU General Public License v3.0 | 5 votes |
@Override public void mouseMoved(final MouseEvent e) { if (!tracerPlugin.isReady()) return; final int rawX = e.getX(); final int rawY = e.getY(); last_x_in_pane_precise = myOffScreenXD(rawX); last_y_in_pane_precise = myOffScreenYD(rawY); final boolean mac = IJ.isMacintosh(); boolean shift_key_down = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0; final boolean joiner_modifier_down = mac ? ((e.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) : ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0); if (tracerPlugin.snapCursor && plane == ThreePanes.XY_PLANE && !joiner_modifier_down && !shift_key_down) { final double[] p = new double[3]; tracerPlugin.findSnappingPointInXYview(last_x_in_pane_precise, last_y_in_pane_precise, p); last_x_in_pane_precise = p[0]; last_y_in_pane_precise = p[1]; shift_key_down = true; } super.mouseMoved(e); tracerPlugin.mouseMovedTo(last_x_in_pane_precise, last_y_in_pane_precise, plane, shift_key_down, joiner_modifier_down); }
Example 17
Source File: AWTKeyStroke.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static String getModifiersText(int modifiers) { StringBuilder buf = new StringBuilder(); if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0 ) { buf.append("shift "); } if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0 ) { buf.append("ctrl "); } if ((modifiers & InputEvent.META_DOWN_MASK) != 0 ) { buf.append("meta "); } if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0 ) { buf.append("alt "); } if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0 ) { buf.append("altGraph "); } if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0 ) { buf.append("button1 "); } if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0 ) { buf.append("button2 "); } if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0 ) { buf.append("button3 "); } return buf.toString(); }
Example 18
Source File: AWTKeyStroke.java From jdk1.8-source-analysis with Apache License 2.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 19
Source File: PlaceAction.java From PIPE with MIT License | 4 votes |
public PlaceAction(PipeApplicationModel applicationModel) { super("Place", "Add a place", KeyEvent.VK_P, InputEvent.ALT_DOWN_MASK, applicationModel); }
Example 20
Source File: DeleteTokenAction.java From PIPE with MIT License | 2 votes |
/** * Constructor * @param applicationModel main PIPE application model */ public DeleteTokenAction(PipeApplicationModel applicationModel) { super("Delete token", "Delete a token (alt-D)", KeyEvent.VK_D, InputEvent.ALT_DOWN_MASK, applicationModel); }