当前位置: 首页>>代码示例>>Java>>正文


Java MouseButton.PRIMARY属性代码示例

本文整理汇总了Java中javafx.scene.input.MouseButton.PRIMARY属性的典型用法代码示例。如果您正苦于以下问题:Java MouseButton.PRIMARY属性的具体用法?Java MouseButton.PRIMARY怎么用?Java MouseButton.PRIMARY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javafx.scene.input.MouseButton的用法示例。


在下文中一共展示了MouseButton.PRIMARY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMousePressed

private void onMousePressed(MouseEvent event) {
    // Don't start drag if shortcut is down because the node might be about to be deselected.
    if (event.getButton() == MouseButton.PRIMARY && !event.isShortcutDown()) {
        screenXAtPress = event.getScreenX();
        screenYAtPress = event.getScreenY();
        lastScreenX = screenXAtPress;
        lastScreenY = screenYAtPress;
        panXAtPress = panningComponent.panXProperty().get();
        panYAtPress = panningComponent.panYProperty().get();
        xAtPress = node.getLayoutX();
        yAtPress = node.getLayoutY();
        dragActive = true;
        inertiaOvercome = false;
        if (onDragStarted != null) {
            onDragStarted.run();
        }
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:19,代码来源:DragBehavior.java

示例2: makeOnButtonDownListener

private EventHandler<MouseEvent> makeOnButtonDownListener(){
	return new EventHandler<MouseEvent>() {

		@Override
		public void handle(MouseEvent event) {
			if(event.getButton() == MouseButton.PRIMARY){
				HitInfo i = DnDTextInput.getHitInfo((TextInputControl) event.getSource(), event);
				IndexRange r = textInput.getSelection();
				
				if(DnDTextInput.isInRange(i.getInsertionIndex(), r)){
					currentSelection = r;
				}
				
				inClick = true;
			}
		}
	};
}
 
开发者ID:coalang-soft,项目名称:dragdropfx,代码行数:18,代码来源:TextDragListenerContext.java

示例3: onPressed

private void onPressed(Node dragged, MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        dragActive = true;
        inertiaOvercome = false;
        nodeXOnPress = dragged.getLayoutX();
        mouseXOnPress = event.getScreenX();

        minWidthBackup = container.getMinWidth();
        prefWidthBackup = container.getPrefWidth();
        maxWidthBackup = container.getMaxWidth();
        container.setMinWidth(container.getWidth());
        container.setPrefWidth(container.getWidth());
        container.setMaxWidth(container.getWidth());

        translates = moveableChildren().collect(Collectors.toMap(Function.identity(), child -> new TranslateAnimation(child, dragged)));
        moveableChildren().forEach(child -> child.setManaged(false));

        // Move dragged node temporarily to front. Reset to original index on mouse release.
        dragged.toFront();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:21,代码来源:KeyFrameDragAnimator.java

示例4: onReleased

private void onReleased(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        dragActive = false;
        if (onResizeDone != null) {
            onResizeDone.run();
        }
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:9,代码来源:ResizeBehavior.java

示例5: getMouseButton

public MouseButton getMouseButton() {
    if (button == 0) {
        return MouseButton.PRIMARY;
    } else if (button == 1) {
        return MouseButton.MIDDLE;
    } else {
        return MouseButton.SECONDARY;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:IDevice.java

示例6: storeMouseDown

private void storeMouseDown(MouseButton button) {
    if (button == MouseButton.PRIMARY) {
        button1Pressed = true;
    }
    if (button == MouseButton.MIDDLE) {
        button2Pressed = true;
    }
    if (button == MouseButton.SECONDARY) {
        button3Pressed = true;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:FXEventQueueDevice.java

示例7: onMouseReleased

private void onMouseReleased(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        dragActive = false;
        if (onDragDone != null) {
            onDragDone.run();
        }
        timelineX.stop();
        timelineY.stop();
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:11,代码来源:DragBehavior.java

示例8: getButtons

public MouseButton getButtons() {
    if (button1Pressed) {
        return MouseButton.PRIMARY;
    }
    if (button2Pressed) {
        return MouseButton.MIDDLE;
    }
    if (button3Pressed) {
        return MouseButton.SECONDARY;
    }
    return MouseButton.NONE;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:FXEventQueueDevice.java

示例9: getButtonMask

public MouseButton getButtonMask() {
    if (button1Pressed) {
        return MouseButton.PRIMARY;
    }
    if (button2Pressed) {
        return MouseButton.MIDDLE;
    }
    if (button3Pressed) {
        return MouseButton.SECONDARY;
    }
    return MouseButton.NONE;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:FXEventQueueDevice.java

示例10: onReleased

private void onReleased(Node dragged, MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY && dragActive) {
        dragActive = false;

        container.setMinWidth(minWidthBackup);
        container.setPrefWidth(prefWidthBackup);
        container.setMaxWidth(maxWidthBackup);

        int draggedIndex = translates.get(dragged).initialIndex;
        int dropIndex = translates.values().stream()
                .filter(t -> t.forward.get())
                .map(t -> t.initialIndex)
                .map(i -> i < draggedIndex ? i : i - 1)
                .min(Comparator.naturalOrder())
                .orElse(container.getChildren().size() - 1);

        // Reset dragged node to original index.
        for (int i = draggedIndex; i < container.getChildren().size() - 1; i++) {
            container.getChildren().get(draggedIndex).toFront();
        }

        moveableChildren().forEach(child -> child.setManaged(true));
        moveableChildren().forEach(child -> child.setTranslateX(0));
        translates.values().forEach(animation -> {
            if (animation.translate != null) {
                animation.translate.stop();
                animation.translate.setNode(null);
            }
        });
        translates = null;

        if (repositionHandler != null && draggedIndex != dropIndex) {
            repositionHandler.accept(draggedIndex, dropIndex);
        }
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:36,代码来源:KeyFrameDragAnimator.java

示例11: recordRawMouseEvent

@Override public void recordRawMouseEvent(final RFXComponent r, MouseEvent e) {
    final JSONObject event = new JSONObject();
    event.put("type", "click_raw");
    int button = e.getButton() == MouseButton.PRIMARY ? java.awt.event.MouseEvent.BUTTON1 : java.awt.event.MouseEvent.BUTTON3;
    event.put("button", button);
    event.put("clickCount", e.getClickCount());
    event.put("modifiersEx", buildModifiersText(e));
    Node source = (Node) e.getSource();
    Node target = r.getComponent();
    Point2D sts = source.localToScene(new Point2D(e.getX(), e.getY()));
    Point2D tts = target.sceneToLocal(sts);
    event.put("x", tts.getX());
    event.put("y", tts.getY());
    final JSONObject o = new JSONObject();
    o.put("event", event);
    fill(r, o);
    if (e.getClickCount() == 1) {
        clickTimer = new Timer();
        clickTimer.schedule(new TimerTask() {
            @Override public void run() {
                sendRecordMessage(o);
            }
        }, timerinterval.intValue());
    } else if (e.getClickCount() == 2) {
        if (clickTimer != null) {
            clickTimer.cancel();
            clickTimer = null;
        }
        sendRecordMessage(o);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:31,代码来源:WSRecorder.java

示例12: handleMouseClick

/**
 * Handles mouse click actions for the scene
 *
 * @param e
 */
private void handleMouseClick (MouseEvent e) {
    if (e.getButton() == MouseButton.PRIMARY && e.getClickCount() == DOUBLE_CLICK) {
        myController.uploadNewBackground();
        myRenderer.updateNewTiles();
        updateBitMap();
        render();
    }
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:13,代码来源:SceneCreator.java

示例13: requestMoney

@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?");
        }
    }
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:14,代码来源:ClickableBitcoinAddress.java

示例14: onBackgroundReleased

private void onBackgroundReleased(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        root.setVisible(false);
        dragActive = false;
        if (!event.isStillSincePress()) {
            selectInBounds(root.getBoundsInParent());
        }
        root.setWidth(0);
        root.setHeight(0);
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:11,代码来源:SelectionBoxComponent.java

示例15: onDragged

private void onDragged(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        if (dragActive) {
            lastScreenX = event.getScreenX();
            lastScreenY = event.getScreenY();
            if (onResized != null && event.getSource() instanceof Region) {
                Rectangle2D result = calculateNewSize((Region) event.getSource());
                if (result != null) {
                    onResized.accept(result);
                }
            }
        }
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:15,代码来源:ResizeBehavior.java


注:本文中的javafx.scene.input.MouseButton.PRIMARY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。