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


Java MouseEvent.getScreenY方法代码示例

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


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

示例1: press

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void press(MouseEvent e) {
  Node node = get();
  if (isEnable() && e.isConsumed() == false && node != null) {
    Corner corner = calcCorner(e);
    if (corner != Corner.CENTER) {
      pressedCorner = corner;
      startX = e.getScreenX();
      startY = e.getScreenY();
      startWidth = width.get() == -1 ? node.prefWidth(-1) : width.get();
      startHeight = height.get() == -1 ? node.prefHeight(-1) : height.get();
      startPosX = node.getLayoutX();
      startPosY = node.getLayoutY();
      e.consume();
    }
  }
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:17,代码来源:ResizeSupport.java

示例2: drag

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void drag(MouseEvent e) {
  Node node = get();
  if (isEnable() && pressedCorner != null && e.isConsumed() == false && node != null) {
    double dx = e.getScreenX() - startX;
    if (pressedCorner.horizontal == HorizontalDirection.RIGHT) {
      width.set(MathUtil.toRange(startWidth + dx, minWidth.get(), maxWidth.get()));
    } else if (pressedCorner.horizontal == HorizontalDirection.LEFT) {
      width.set(MathUtil.toRange(startWidth - dx, minWidth.get(), maxWidth.get()));
      node.setLayoutX(startWidth + startPosX - width.get());
    }

    double dy = e.getScreenY() - startY;
    if (pressedCorner.vertical == VerticalDirection.DOWN) {
      height.set(MathUtil.toRange(startHeight + dy, minHeight.get(), maxHeight.get()));
    } else if (pressedCorner.vertical == VerticalDirection.UP) {
      height.set(MathUtil.toRange(startHeight - dy, minHeight.get(), maxHeight.get()));
      node.setLayoutY(startHeight + startPosY - height.get());
    }
    e.consume();
  }
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:22,代码来源:ResizeSupport.java

示例3: onPressed

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onPressed(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        xAtPress = resizerComponent.xProperty().get();
        yAtPress = resizerComponent.yProperty().get();
        widthAtPress = resizerComponent.widthProperty().get();
        heightAtPress = resizerComponent.heightProperty().get();

        screenXAtPress = event.getScreenX();
        screenYAtPress = event.getScreenY();
        lastScreenX = screenXAtPress;
        lastScreenY = screenYAtPress;
        panXAtPress = panningComponent.panXProperty().get();
        panYAtPress = panningComponent.panYProperty().get();
        dragActive = true;
        if (onResizeStarted != null) {
            onResizeStarted.run();
        }
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:21,代码来源:ResizeBehavior.java

示例4: onMousePressed

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
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,代码行数:20,代码来源:DragBehavior.java

示例5: press

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void press(MouseEvent e) {
  Node node = get();
  if (isEnable() && e.isConsumed() == false && node != null) {
    Bounds boundsInLocal = node.getBoundsInLocal();
    if (canDrag(node.screenToLocal(e.getScreenX(), e.getScreenY()), boundsInLocal.getMaxX(), boundsInLocal.getMaxY())) {
      startX = e.getScreenX() - node.getLayoutX();
      startY = e.getScreenY() - node.getLayoutY();
      e.consume();
      pressed = true;
    }
  }
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:14,代码来源:DragSupport.java

示例6: tabPaneResizeElementDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void tabPaneResizeElementDragged(final MouseEvent event) {
    final double mouseY = event.getScreenY();
    double newHeight = tabPaneContainer.getMaxHeight() - (mouseY - tabPanePreviousY);
    newHeight = Math.max(35, newHeight);

    tabPaneContainer.setMaxHeight(newHeight);
    tabPanePreviousY = mouseY;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:10,代码来源:HUPPAALController.java

示例7: onDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
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,代码行数:16,代码来源:ResizeBehavior.java

示例8: onMouseDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMouseDragged(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        if (dragActive && (inertiaOvercome || isDraggedFarEnoughToOvercomeInertia(event.getScreenX(), event.getScreenY()))) {
            inertiaOvercome = true;
            lastScreenX = event.getScreenX();
            lastScreenY = event.getScreenY();
            if (onDragged != null) {
                onDragged.accept(calculateDragDelta());
            }
            panIfOutsideAxisBounds(event);
        }
        event.consume();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:15,代码来源:DragBehavior.java

示例9: panIfOutsideAxisBounds

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void panIfOutsideAxisBounds(MouseEvent event) {
    Point2D rootOriginInScreen = panningComponent.getRoot().localToScreen(0, 0);
    double mouseXRelativeToComponent = event.getScreenX() - rootOriginInScreen.getX();
    double mouseYRelativeToComponent = event.getScreenY() - rootOriginInScreen.getY();

    if (mouseXRelativeToComponent <= 0) {
        if (!isRunning(timelineX)) {
            startPanAnimation(-getAnimationSpeed(), timelineX, animatedPanX, panningComponent.panXProperty());
        }
    } else if (mouseXRelativeToComponent >= panningComponent.getRoot().getWidth()) {
        if (!isRunning(timelineX)) {
            startPanAnimation(getAnimationSpeed(), timelineX, animatedPanX, panningComponent.panXProperty());
        }
    } else {
        timelineX.stop();
    }

    if (mouseYRelativeToComponent <= 0) {
        if (!isRunning(timelineY)) {
            startPanAnimation(-getAnimationSpeed(), timelineY, animatedPanY, panningComponent.panYProperty());
        }
    } else if (mouseYRelativeToComponent >= panningComponent.getRoot().getHeight()) {
        if (!isRunning(timelineY)) {
            startPanAnimation(getAnimationSpeed(), timelineY, animatedPanY, panningComponent.panYProperty());
        }
    } else {
        timelineY.stop();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:30,代码来源:DragBehavior.java

示例10: onMousePressed

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMousePressed(MouseEvent event) {
    if (event.getButton() == MouseButton.SECONDARY) {
        contentXAtPress = view.getContent().getLayoutX();
        contentYAtPress = view.getContent().getLayoutY();
        screenXAtPress = event.getScreenX();
        screenYAtPress = event.getScreenY();
        setSceneCursor(Cursor.MOVE);
        panningActive = true;
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:11,代码来源:PanningPresenter.java

示例11: onMouseDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onMouseDragged(MouseEvent event) {
    if (event.getButton() == MouseButton.SECONDARY && panningActive) {
        double deltaX = event.getScreenX() - screenXAtPress;
        double deltaY = event.getScreenY() - screenYAtPress;
        view.getContent().setLayoutX(contentXAtPress + deltaX);
        view.getContent().setLayoutY(contentYAtPress + deltaY);
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:9,代码来源:PanningPresenter.java

示例12: handle

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void handle(MouseEvent event)
{
    x = stage.getX() - event.getScreenX();
    y = stage.getY() - event.getScreenY();
}
 
开发者ID:BlueGoliath,项目名称:Goliath-Overclocking-Utility-FX,代码行数:7,代码来源:TitlePane.java

示例13: handleSingleClick

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void handleSingleClick(MouseEvent evt, Node node, LocalDate date) {
    if (!(evt.getButton() == MouseButton.PRIMARY)) {
        return;
    }

    YearMonthView view = getSkinnable();
    switch (view.getClickBehaviour()) {
        case NONE:
            break;
        case SHOW_DETAILS:
            Callback<DateDetailsParameter, Boolean> callback = view.getDateDetailsCallback();
            DateDetailsParameter param = new DateDetailsParameter(evt, view, node, date, evt.getScreenX(), evt.getScreenY());
            callback.call(param);
            break;
        case PERFORM_SELECTION:
            boolean multiSelect = evt.isShiftDown() || evt.isShortcutDown();
            if (!multiSelect || (view.getSelectionMode().equals(SINGLE)
                    && !evt.isControlDown())) {
                view.getSelectedDates().clear();
            }

            if (evt.isShiftDown()) {
                if (lastSelectedDate != null) {
                    LocalDate st = lastSelectedDate;
                    LocalDate et = date;
                    if (date.isBefore(st)) {
                        st = date;
                        et = lastSelectedDate;
                    }

                    do {
                        view.getSelectedDates().add(st);
                        st = st.plusDays(1);
                    } while (!et.isBefore(st));
                } else {
                    view.getSelectedDates().clear();
                    view.getSelectedDates().add(date);
                }
            } else {
                if (view.getSelectedDates().contains(date)) {
                    view.getSelectedDates().remove(date);
                } else {
                    view.getSelectedDates().add(date);
                }
            }

            lastSelectedDate = date;

            if (!date.getMonth().equals(view.getYearMonth().getMonth())) {
                view.setDate(date);
            }

            break;
        default:
            break;
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:58,代码来源:YearMonthViewSkin.java

示例14: tabPaneResizeElementPressed

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void tabPaneResizeElementPressed(final MouseEvent event) {
    tabPanePreviousY = event.getScreenY();
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:5,代码来源:HUPPAALController.java

示例15: calculateGap

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
 * Calculating gap of location between the mouse and the stage on <i>Mouse Moving Event</i>.
 * @param event
 * @param stage 
 */
private void calculateGap(MouseEvent event, Stage stage) {
	gap_x = event.getScreenX() - stage.getX();
	gap_y = event.getScreenY() - stage.getY();
}
 
开发者ID:ShekkarRaee,项目名称:xpanderfx,代码行数:10,代码来源:XpanderFX.java


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