Example usage for java.awt.event InputEvent getModifiersEx

List of usage examples for java.awt.event InputEvent getModifiersEx

Introduction

In this page you can find the example usage for java.awt.event InputEvent getModifiersEx.

Prototype

public int getModifiersEx() 

Source Link

Document

Returns the extended modifier mask for this event.

Usage

From source file:Main.java

/** Return true if the Alt button was held when 'e' was generated. */
public static boolean altPressed(InputEvent e) {
    return (e.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0;
}

From source file:Main.java

/** Return true if the Control button was held when 'e' was generated. */
public static boolean controlPressed(InputEvent e) {
    return (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0;
}

From source file:Main.java

/** Return true if the Shift button was held when 'e' was generated. */
public static boolean shiftPressed(InputEvent e) {
    return (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
}

From source file:Main.java

public static boolean isShiftDown(InputEvent e) {
    return (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) > 0;
}

From source file:Main.java

static boolean isMetaDown(final InputEvent event) {
    final int modifiersEx = event.getModifiersEx();
    final int flag = modifiersEx & InputEvent.META_DOWN_MASK;
    return flag != 0;
}

From source file:Main.java

static boolean isShiftDown(final InputEvent event) {
    final int modifiersEx = event.getModifiersEx();
    final int flag = modifiersEx & InputEvent.SHIFT_DOWN_MASK;
    return flag != 0;
}

From source file:Main.java

static boolean isMiddleDown(final InputEvent event) {
    final int modifiersEx = event.getModifiersEx();
    final int flag = modifiersEx & InputEvent.BUTTON2_DOWN_MASK;
    return flag != 0;
}

From source file:Main.java

static boolean isRightDown(final InputEvent event) {
    final int modifiersEx = event.getModifiersEx();
    final int flag = modifiersEx & InputEvent.BUTTON3_DOWN_MASK;
    return flag != 0;
}

From source file:Main.java

static boolean isModifierKeyDown(final InputEvent event) {
    final int modifiersEx = event.getModifiersEx();
    final int flag = modifiersEx & (InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK
            | InputEvent.ALT_GRAPH_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.META_DOWN_MASK);
    return flag != 0;
}

From source file:Main.java

static boolean isAltDown(final InputEvent event) {
    final int modifiersEx = event.getModifiersEx();
    final int flag = modifiersEx & InputEvent.ALT_DOWN_MASK;
    return flag != 0;
}