本文整理匯總了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();
}
}
示例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;
}
}
};
}
示例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();
}
}
示例4: onReleased
private void onReleased(MouseEvent event) {
if (event.getButton() == MouseButton.PRIMARY) {
dragActive = false;
if (onResizeDone != null) {
onResizeDone.run();
}
event.consume();
}
}
示例5: getMouseButton
public MouseButton getMouseButton() {
if (button == 0) {
return MouseButton.PRIMARY;
} else if (button == 1) {
return MouseButton.MIDDLE;
} else {
return MouseButton.SECONDARY;
}
}
示例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;
}
}
示例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();
}
}
示例8: getButtons
public MouseButton getButtons() {
if (button1Pressed) {
return MouseButton.PRIMARY;
}
if (button2Pressed) {
return MouseButton.MIDDLE;
}
if (button3Pressed) {
return MouseButton.SECONDARY;
}
return MouseButton.NONE;
}
示例9: getButtonMask
public MouseButton getButtonMask() {
if (button1Pressed) {
return MouseButton.PRIMARY;
}
if (button2Pressed) {
return MouseButton.MIDDLE;
}
if (button3Pressed) {
return MouseButton.SECONDARY;
}
return MouseButton.NONE;
}
示例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);
}
}
}
示例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);
}
}
示例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();
}
}
示例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?");
}
}
}
示例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);
}
}
示例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();
}
}