Java Code Examples for javafx.scene.input.MouseEvent#isMetaDown()

The following examples show how to use javafx.scene.input.MouseEvent#isMetaDown() . 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: WSRecorder.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private String buildModifiersText(MouseEvent e) {
    StringBuilder sb = new StringBuilder();
    if (e.isAltDown()) {
        sb.append("Alt+");
    }
    if (e.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (e.isMetaDown()) {
        sb.append("Meta+");
    }
    if (e.isShiftDown()) {
        sb.append("Shift+");
    }
    if (sb.length() > 0) {
        sb.setLength(sb.length() - 1);
    }
    String mtext = sb.toString();
    return mtext;
}
 
Example 2
Source File: AbstractMouseHandlerFX.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the specified mouse event has modifier
 * keys that match this handler.
 * 
 * @param e  the mouse event (<code>null</code> not permitted).
 * 
 * @return A boolean. 
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 3
Source File: FX.java    From FxDock with Apache License 2.0 5 votes vote down vote up
/** sometimes MouseEvent.isPopupTrigger() is not enough */
public static boolean isPopupTrigger(MouseEvent ev)
{
	if(ev.getButton() == MouseButton.SECONDARY)
	{
		if(CPlatform.isMac())
		{
			if
			(
				!ev.isAltDown() &&
				!ev.isMetaDown() &&
				!ev.isShiftDown()
			)
			{
				return true;
			}
		}
		else
		{
			if
			(
				!ev.isAltDown() &&
				!ev.isControlDown() &&
				!ev.isMetaDown() &&
				!ev.isShiftDown()
			)
			{
				return true;
			}
		}
	}
	return false;
}
 
Example 4
Source File: ClickableBitcoinAddress.java    From devcoretalk with GNU General Public License v2.0 5 votes vote down vote up
@FXML
protected void requestMoney(MouseEvent event) {
    if (event.getButton() == MouseButton.SECONDARY || (event.getButton() == MouseButton.PRIMARY && event.isMetaDown())) {
        // User right clicked or the Mac equivalent. Show the context menu.
        addressMenu.show(addressLabel, event.getScreenX(), event.getScreenY());
    } else {
        // User left clicked.
        try {
            Desktop.getDesktop().browse(URI.create(uri()));
        } catch (IOException e) {
            GuiUtils.informationalAlert("Opening wallet app failed", "Perhaps you don't have one installed?");
        }
    }
}
 
Example 5
Source File: AbstractMouseHandlerFX.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the specified mouse event has modifier
 * keys that match this handler.
 * 
 * @param e  the mouse event (<code>null</code> not permitted).
 * 
 * @return A boolean. 
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 6
Source File: ClickableBitcoinAddress.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@FXML
protected void requestMoney(MouseEvent event) {
    if (event.getButton() == MouseButton.SECONDARY || (event.getButton() == MouseButton.PRIMARY && event.isMetaDown())) {
        // User right clicked or the Mac equivalent. Show the context menu.
        addressMenu.show(addressLabel, event.getScreenX(), event.getScreenY());
    } else {
        // User left clicked.
        try {
            Desktop.getDesktop().browse(URI.create(uri()));
        } catch (IOException e) {
            GuiUtils.informationalAlert("Opening wallet app failed", "Perhaps you don't have one installed?");
        }
    }
}
 
Example 7
Source File: OSFXUtils.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static String mouseEventGetModifiersExText(MouseEvent event) {
    StringBuffer sb = new StringBuffer();

    if (event.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (event.isMetaDown()) {
        sb.append("Meta+");
    }
    if (event.isAltDown()) {
        sb.append("Alt+");
    }
    if (event.isShiftDown()) {
        sb.append("Shift+");
    }
    if (event.isPrimaryButtonDown()) {
        sb.append("Button1+");
    }
    if (event.isMiddleButtonDown()) {
        sb.append("Button2+");
    }
    if (event.isSecondaryButtonDown()) {
        sb.append("Button3+");
    }
    String text = sb.toString();
    if (text.equals("")) {
        return text;
    }
    return text.substring(0, text.length() - 1);
}
 
Example 8
Source File: EventQueueDeviceTest.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
protected static String getModifiersExText(MouseEvent event) {
    StringBuffer buf = new StringBuffer();
    if (event.isMetaDown()) {
        buf.append("Meta");
        buf.append("+");
    }
    if (event.isControlDown()) {
        buf.append("Ctrl");
        buf.append("+");
    }
    if (event.isAltDown()) {
        buf.append("Alt");
        buf.append("+");
    }
    if (event.isShiftDown()) {
        buf.append("Shift");
        buf.append("+");
    }
    if (event.getButton() == MouseButton.PRIMARY) {
        buf.append("Button1");
        buf.append("+");
    }
    if (event.getButton() == MouseButton.MIDDLE) {
        buf.append("Button2");
        buf.append("+");
    }
    if (event.getButton() == MouseButton.SECONDARY) {
        buf.append("Button3");
        buf.append("+");
    }
    return buf.toString();
}
 
Example 9
Source File: JavaFxRecorderHook.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static String mouseEventGetModifiersExText(MouseEvent event) {
    StringBuffer sb = new StringBuffer();
    if (event.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (event.isMetaDown()) {
        sb.append("Meta+");
    }
    if (event.isAltDown()) {
        sb.append("Alt+");
    }
    if (event.isShiftDown()) {
        sb.append("Shift+");
    }
    if (event.isPrimaryButtonDown()) {
        sb.append("Button1+");
    }
    if (event.isMiddleButtonDown()) {
        sb.append("Button2+");
    }
    if (event.isSecondaryButtonDown()) {
        sb.append("Button3+");
    }
    String text = sb.toString();
    if (text.equals("")) {
        return text;
    }
    return text.substring(0, text.length() - 1);
}
 
Example 10
Source File: AbstractMouseHandlerFX.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the specified mouse event has modifier
 * keys that match this handler.
 * 
 * @param e  the mouse event (<code>null</code> not permitted).
 * 
 * @return A boolean. 
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 11
Source File: AbstractMouseHandlerFX.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the specified mouse event has modifier
 * keys that match this handler.
 * 
 * @param e  the mouse event (<code>null</code> not permitted).
 * 
 * @return A boolean. 
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 12
Source File: TaAbstractMouseHandlerFX.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Returns {@code true} if the specified mouse event has modifier
 * keys that match this handler.
 *
 * @param e  the mouse event ({@code null} not permitted).
 *
 * @return A boolean.
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 13
Source File: RFXComponent.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
protected void mousePressed(MouseEvent me) {
    if (me.isPrimaryButtonDown() && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown() && !me.isControlDown()) {
        mouseButton1Pressed(me);
    } else {
        recorder.recordClick2(this, me, true);
    }
}
 
Example 14
Source File: AbstractMouseHandlerFX.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if the specified mouse event has modifier
 * keys that match this handler.
 * 
 * @param e  the mouse event (<code>null</code> not permitted).
 * 
 * @return A boolean. 
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 15
Source File: AbstractMouseHandlerFX.java    From jfreechart-fx with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Returns {@code true} if the specified mouse event has modifier
 * keys that match this handler.
 * 
 * @param e  the mouse event ({@code null} not permitted).
 * 
 * @return A boolean. 
 */
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
    boolean b = true;
    b = b && (this.altKey == e.isAltDown());
    b = b && (this.ctrlKey == e.isControlDown());
    b = b && (this.metaKey == e.isMetaDown());
    b = b && (this.shiftKey == e.isShiftDown());
    return b;
}
 
Example 16
Source File: RFXTreeTableView.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
protected void mouseClicked(MouseEvent me) {
    if (me.isControlDown() || me.isAltDown() || me.isMetaDown() || onCheckBox((Node) me.getTarget()))
        return;
    recorder.recordClick2(this, me, true);
}
 
Example 17
Source File: RFXListView.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
protected void mouseClicked(MouseEvent me) {
    if (me.isControlDown() || me.isAltDown() || me.isMetaDown() || onCheckBox((Node) me.getTarget()))
        return;
    recorder.recordClick2(this, me, true);
}
 
Example 18
Source File: RFXTableView.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
protected void mouseClicked(MouseEvent me) {
    if (me.isControlDown() || me.isAltDown() || me.isMetaDown() || onCheckBox((Node) me.getTarget()))
        return;
    recorder.recordClick2(this, me, true);
}
 
Example 19
Source File: DragSupport.java    From scenic-view with GNU General Public License v3.0 4 votes vote down vote up
private boolean isModifierCorrect(MouseEvent t, KeyCode keyCode) {
    return (keyCode != KeyCode.ALT ^ t.isAltDown())
            && (keyCode != KeyCode.CONTROL ^ t.isControlDown())
            && (keyCode != KeyCode.SHIFT ^ t.isShiftDown())
            && (keyCode != KeyCode.META ^ t.isMetaDown());
}
 
Example 20
Source File: MouseEventsHelper.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
public static boolean isOnlyCtrlModifierDown(final MouseEvent event) {
    return event.isControlDown() && !event.isAltDown() && !event.isMetaDown() && !event.isShiftDown();
}