本文整理汇总了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));
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}