當前位置: 首頁>>代碼示例>>Java>>正文


Java Node.localToScreen方法代碼示例

本文整理匯總了Java中javafx.scene.Node.localToScreen方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.localToScreen方法的具體用法?Java Node.localToScreen怎麽用?Java Node.localToScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.Node的用法示例。


在下文中一共展示了Node.localToScreen方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dispatchMouseEvent

import javafx.scene.Node; //導入方法依賴的package包/類
private void dispatchMouseEvent(Node node, Node target, PickResult pickResult, boolean popupTrigger, int clickCount,
        MouseButton buttons, double x, double y) {
    ensureVisible(node);
    Point2D screenXY = node.localToScreen(new Point2D(x, y));
    if (node != deviceState.getNode()) {
        if (deviceState.getNode() != null) {
            dispatchEvent(createMouseEvent(MouseEvent.MOUSE_EXITED, target, pickResult, x, y, screenXY.getX(), screenXY.getY(),
                    buttons, clickCount, deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed,
                    deviceState.metaPressed, false, false, false, false, popupTrigger, false, node));
        }
        dispatchEvent(createMouseEvent(MouseEvent.MOUSE_ENTERED, target, pickResult, x, y, screenXY.getX(), screenXY.getY(),
                buttons, clickCount, deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed,
                deviceState.metaPressed, false, false, false, false, popupTrigger, false, node));
    }
    for (int n = 1; n <= clickCount; n++) {
        dispatchEvent(createMouseEvent(MouseEvent.MOUSE_PRESSED, target, pickResult, x, y, screenXY.getX(), screenXY.getY(),
                buttons, n, deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
                buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false,
                popupTrigger, false, node));
        dispatchEvent(createMouseEvent(MouseEvent.MOUSE_RELEASED, target, pickResult, x, y, screenXY.getX(), screenXY.getY(),
                buttons, n, deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
                buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false,
                popupTrigger, false, node));
        dispatchEvent(createMouseEvent(MouseEvent.MOUSE_CLICKED, target, pickResult, x, y, screenXY.getX(), screenXY.getY(),
                buttons, n, deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
                buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false,
                popupTrigger, false, node));
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:30,代碼來源:FXEventQueueDevice.java

示例2: recordClick2

import javafx.scene.Node; //導入方法依賴的package包/類
@Override public void recordClick2(final RFXComponent r, MouseEvent e, boolean withCellInfo) {
    final JSONObject event = new JSONObject();
    event.put("type", "click");
    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));
    double x = e.getX();
    double y = e.getY();
    Node source = (Node) e.getSource();
    Node target = r.getComponent();
    Point2D sts = source.localToScreen(new Point2D(0, 0));
    Point2D tts = target.localToScreen(new Point2D(0, 0));
    x = e.getX() - tts.getX() + sts.getX();
    y = e.getY() - tts.getY() + sts.getY();
    event.put("x", x);
    event.put("y", y);
    if (withCellInfo) {
        event.put("cellinfo", r.getCellInfo());
    }
    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,代碼行數:39,代碼來源:WSRecorder.java

示例3: findPopOverArrowLocation

import javafx.scene.Node; //導入方法依賴的package包/類
public static ArrowLocation findPopOverArrowLocation(Node view) {
    Bounds localBounds = view.getBoundsInLocal();
    Bounds entryBounds = view.localToScreen(localBounds);

    ObservableList<Screen> screens = Screen.getScreensForRectangle(
            entryBounds.getMinX(), entryBounds.getMinY(),
            entryBounds.getWidth(), entryBounds.getHeight());
    Rectangle2D screenBounds = screens.get(0).getVisualBounds();

    double spaceLeft = entryBounds.getMinX();
    double spaceRight = screenBounds.getWidth() - entryBounds.getMaxX();
    double spaceTop = entryBounds.getMinY();
    double spaceBottom = screenBounds.getHeight() - entryBounds.getMaxY();

    if (spaceLeft > spaceRight) {
        if (spaceTop > spaceBottom) {
            return ArrowLocation.RIGHT_BOTTOM;
        }
        return ArrowLocation.RIGHT_TOP;
    }

    if (spaceTop > spaceBottom) {
        return ArrowLocation.LEFT_BOTTOM;
    }

    return ArrowLocation.LEFT_TOP;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:28,代碼來源:ViewHelper.java

示例4: findPopOverArrowPosition

import javafx.scene.Node; //導入方法依賴的package包/類
public static Point findPopOverArrowPosition(Node node, double screenY, double arrowSize, ArrowLocation arrowLocation) {
    Point point = new Point();
    point.setY(screenY);

    Bounds entryBounds = node.localToScreen(node.getBoundsInLocal());

    if (arrowLocation == ArrowLocation.LEFT_TOP || arrowLocation == ArrowLocation.LEFT_BOTTOM) {
        point.setX(entryBounds.getMaxX());
    } else {
        point.setX(entryBounds.getMinX() - arrowSize);
    }

    return point;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:15,代碼來源:ViewHelper.java

示例5: positionToButtonIndex

import javafx.scene.Node; //導入方法依賴的package包/類
/**
 * Get the index into the panes children that this node should be inserted to.
 * @param screenX Drop screen x position
 * @param screenY Drop screen y position
 * @param pane The pane of interest.
 * @return The index to insert the button into the panes children.
 */
private int positionToButtonIndex(Pane pane, double screenX, double screenY) {
    int idx = pane.getChildren().size();
    for (Node node: pane.getChildren()) {
        Bounds bounds = node.localToScreen(node.getBoundsInLocal());
        if (bounds.contains(screenX, screenY)) {
            idx = pane.getChildren().indexOf(node);
        }
    }
    return idx;
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:18,代碼來源:DragPaneDecorator.java


注:本文中的javafx.scene.Node.localToScreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。