Java Code Examples for javafx.scene.input.MouseButton#NONE

The following examples show how to use javafx.scene.input.MouseButton#NONE . 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: DragResizerUtilTests.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
MyMouseEvent(final double x, final double y) {
    super(MouseEvent.MOUSE_MOVED, x, y, //
            x, y, // screen coordinates
            MouseButton.NONE, // mouse button
            0, // clickCount
            false, // shiftDown
            false, // controlDown
            false, // altDown
            false, // metaDown
            false, // primaryButtonDown
            false, // middleButtonDown
            false, // secondaryButtonDown
            true, // synthesised
            false, // popupTrigger
            true, // stillSincePress
            null // pickResult
    );
}
 
Example 2
Source File: UICanvasEditor.java    From arma-dialog-creator with MIT License 6 votes vote down vote up
/**
 This is called when the mouse listener is invoked and a mouse release was the event

 @param mousex x position of mouse relative to canvas
 @param mousey y position of mouse relative to canvas
 @param mb mouse button that was released
 */
protected void mouseReleased(int mousex, int mousey, @NotNull MouseButton mb) {
	this.mouseButtonDown = MouseButton.NONE;
	selection.setSelecting(false);
	setContextMenu(null, mousex, mousey);
	contextMenuControl = null;
	if (mb == MouseButton.SECONDARY) {
		if (menuCreator != null && selection.getFirst() != null) {
			contextMenuControl = selection.getFirst();
			setContextMenu(menuCreator.initialize(contextMenuControl.getComponent()), mousex, mousey);
		} else if (canvasContextMenu != null) {
			setContextMenu(canvasContextMenu, mousex, mousey);
		}
	} else {
		if (hasDoubleClickedCtrl) {
			doubleClickUpdateGroup.update(selection.getFirst());
		}
	}
}
 
Example 3
Source File: FXEventQueueDevice.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public MouseButton getButtons() {
    if (button1Pressed) {
        return MouseButton.PRIMARY;
    }
    if (button2Pressed) {
        return MouseButton.MIDDLE;
    }
    if (button3Pressed) {
        return MouseButton.SECONDARY;
    }
    return MouseButton.NONE;
}
 
Example 4
Source File: FXEventQueueDevice.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public MouseButton getButtonMask() {
    if (button1Pressed) {
        return MouseButton.PRIMARY;
    }
    if (button2Pressed) {
        return MouseButton.MIDDLE;
    }
    if (button3Pressed) {
        return MouseButton.SECONDARY;
    }
    return MouseButton.NONE;
}
 
Example 5
Source File: FXEventQueueDevice.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void moveto(Node node, double xoffset, double yoffset) {
    MouseButton buttons = deviceState.getButtons();
    if (node != deviceState.getNode()) {
        if (deviceState.getNode() != null) {
            dispatchEvent(createMouseEvent(MouseEvent.MOUSE_PRESSED, null, null, xoffset, yoffset, 0, 0, buttons, 0,
                    deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
                    buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false,
                    false, false, node));
        }
        dispatchEvent(createMouseEvent(MouseEvent.MOUSE_ENTERED, null, null, xoffset, yoffset, 0, 0, buttons, 0,
                deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
                buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false, false,
                false, node));
    }
    Node source = node;
    EventType<MouseEvent> id = MouseEvent.MOUSE_MOVED;
    if (buttons != MouseButton.NONE) {
        id = MouseEvent.MOUSE_DRAGGED;
        source = deviceState.getDragSource();
    }
    MouseButton modifierEx = deviceState.getButtonMask();
    dispatchEvent(createMouseEvent(id, null, null, xoffset, yoffset, 0, 0, buttons, 0, deviceState.shiftPressed,
            deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed, modifierEx == MouseButton.PRIMARY,
            modifierEx == MouseButton.MIDDLE, modifierEx == MouseButton.SECONDARY, false, false, false, source));
    deviceState.setNode(node);
    deviceState.setMousePosition(xoffset, yoffset);
}