Java Code Examples for java.awt.event.InputEvent#ALT_MASK

The following examples show how to use java.awt.event.InputEvent#ALT_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: AWTKeyStroke.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
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 2
Source File: AWTKeyStroke.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: AWTKeyStroke.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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 Java8CN with Apache License 2.0 6 votes vote down vote up
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 dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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 6
Source File: TargetingPhaseDisplay.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void hexMoused(BoardViewEvent b) {

    // Are we ignoring events?
    if (isIgnoringEvents()) {
        return;
    }

    // ignore buttons other than 1
    if (!clientgui.getClient().isMyTurn()
        || ((b.getModifiers() & InputEvent.BUTTON1_MASK) == 0)) {
        return;
    }
    // control pressed means a line of sight check.
    // added ALT_MASK by kenn
    if (((b.getModifiers() & InputEvent.CTRL_MASK) != 0)
        || ((b.getModifiers() & InputEvent.ALT_MASK) != 0)) {
        return;
    }
    // check for shifty goodness
    if (shiftheld != ((b.getModifiers() & InputEvent.SHIFT_MASK) != 0)) {
        shiftheld = (b.getModifiers() & InputEvent.SHIFT_MASK) != 0;
    }

    if (b.getType() == BoardViewEvent.BOARD_HEX_DRAGGED) {
        if (shiftheld || twisting) {
            updateFlipArms(false);
            torsoTwist(b.getCoords());
        }
        clientgui.getBoardView().cursor(b.getCoords());
    } else if (b.getType() == BoardViewEvent.BOARD_HEX_CLICKED) {
        twisting = false;
        clientgui.getBoardView().select(b.getCoords());
    }
}
 
Example 7
Source File: ModifierTracker.java    From pumpernickel with MIT License 5 votes vote down vote up
public static int getModifiers() {
	return (alt ? InputEvent.ALT_MASK : 0)
			+ (altGraph ? InputEvent.ALT_GRAPH_MASK : 0)
			+ (shift ? InputEvent.SHIFT_MASK : 0)
			+ (ctrl ? InputEvent.CTRL_MASK : 0)
			+ (meta ? InputEvent.META_MASK : 0);

}
 
Example 8
Source File: AWTKeyStroke.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 9
Source File: AWTKeyStroke.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 10
Source File: AWTKeyStroke.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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 11
Source File: SunToolkit.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
 */
public int getFocusAcceleratorKeyMask() {
    return InputEvent.ALT_MASK;
}
 
Example 12
Source File: SunToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
 */
public int getFocusAcceleratorKeyMask() {
    return InputEvent.ALT_MASK;
}
 
Example 13
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 14
Source File: SunToolkit.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
 */
public int getFocusAcceleratorKeyMask() {
    return InputEvent.ALT_MASK;
}
 
Example 15
Source File: ChartPanel.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
    this.info.setRenderingSource(this);
    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.overlays = new java.util.ArrayList();

    this.availableMouseHandlers = new java.util.ArrayList();

    this.zoomHandler = new ZoomHandler();
    this.availableMouseHandlers.add(zoomHandler);

    PanHandler panHandler = new PanHandler();
    int 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")) {
        panMask = InputEvent.ALT_MASK;
    }
    panHandler.setModifier(panMask);
    this.availableMouseHandlers.add(panHandler);
    this.auxiliaryMouseHandlers = new java.util.ArrayList();
}
 
Example 16
Source File: SunToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
 */
@SuppressWarnings("deprecation")
public int getFocusAcceleratorKeyMask() {
    return InputEvent.ALT_MASK;
}
 
Example 17
Source File: SunToolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
 */
public int getFocusAcceleratorKeyMask() {
    return InputEvent.ALT_MASK;
}
 
Example 18
Source File: LWCToolkit.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 19
Source File: SunToolkit.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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 vote down vote up
/**
 * 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));
}