本文整理了Java中javafx.scene.Node.localToScene()
方法的一些代码示例,展示了Node.localToScene()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.localToScene()
方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:localToScene
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
public void show(Node node){
if(!isShowing()){
if(node.getScene() == null || node.getScene().getWindow() == null)
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() + node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + ((Region)node).getHeight());
((JFXAutoCompletePopupSkin<T>)getSkin()).animate();
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
public void show(Node node) {
if (text == null) {
text = (Text) node.lookup(".text");
}
node = text;
if (!isShowing()) {
if (node.getScene() == null || node.getScene().getWindow() == null) {
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
}
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() +
node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
} else {
// if already showing update location if needed
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() +
node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
}
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
/**
* show the popup according to the specified position with a certain offset
*
* @param vAlign can be TOP/BOTTOM
* @param hAlign can be LEFT/RIGHT
* @param initOffsetX on the x axis
* @param initOffsetY on the y axis
*/
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) {
if (!isShowing()) {
if (node.getScene() == null || node.getScene().getWindow() == null) {
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
}
Window parent = node.getScene().getWindow();
final Point2D origin = node.localToScene(0, 0);
final double anchorX = parent.getX() + origin.getX()
+ node.getScene().getX() + (hAlign == PopupHPosition.RIGHT ? ((Region) node).getWidth() : 0);
final double anchorY = parent.getY() + origin.getY()
+ node.getScene()
.getY() + (vAlign == PopupVPosition.BOTTOM ? ((Region) node).getHeight() : 0);
this.show(parent, anchorX, anchorY);
((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY);
Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate());
}
}
代码示例来源:origin: stackoverflow.com
Node chartArea = chart.lookup(".chart-plot-background");
Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
代码示例来源:origin: stackoverflow.com
Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
代码示例来源:origin: stackoverflow.com
Set<Node> tabs = tabPane.lookupAll(".tab");
for (Node node : tabs) {
System.out.println("Coordinates relatively to Scene: " + node.localToScene(node.getBoundsInLocal()));
}
代码示例来源:origin: stackoverflow.com
private List<Node> getVisibleElements(ScrollPane pane) {
List<Node> visibleNodes = new ArrayList<Node>();
Bounds paneBounds = pane.localToScene(pane.getBoundsInParent());
if (pane.getContent() instanceof Parent) {
for (Node n : ((Parent) pane.getContent()).getChildrenUnmodifiable()) {
Bounds nodeBounds = n.localToScene(n.getBoundsInLocal());
if (paneBounds.intersects(nodeBounds)) {
visibleNodes.add(n);
}
}
}
return visibleNodes;
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @param node
* @return The Y scene coordinate of the node.
*/
static public double sceneY(Node node) {
return node.localToScene(node.getBoundsInLocal()).getMinY() + node.getScene().getY();
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @param node
* @return The X scene coordinate of the node.
*/
static public double sceneX(Node node) {
return node.localToScene(node.getBoundsInLocal()).getMinX() + node.getScene().getX();
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
private static TableCell<?, ?> getTableCellAt(TableView<?> tableView, Point2D point) {
point = tableView.localToScene(point);
Set<Node> lookupAll = getTableCells(tableView);
TableCell<?, ?> selected = null;
for (Node cellNode : lookupAll) {
Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
if (boundsInScene.contains(point)) {
selected = (TableCell<?, ?>) cellNode;
break;
}
}
return selected;
}
代码示例来源:origin: org.loadui/testFx
public static boolean isNodeWithinSceneBounds(Node node)
{
Scene scene = node.getScene();
Bounds nodeBounds = node.localToScene( node.getBoundsInLocal() );
return nodeBounds.intersects( 0, 0, scene.getWidth(), scene.getHeight() );
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
/**
*
* @param node
* @return The Y screen coordinate of the node.
*/
static public double screenY(Node node) {
return node.localToScene(node.getBoundsInLocal()).getMinY() + node.getScene().getY() + node.getScene().getWindow().getY();
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
/**
*
* @param node
* @return The X screen coordinate of the node.
*/
static public double screenX(Node node) {
return node.localToScene(node.getBoundsInLocal()).getMinX()
+ node.getScene().getX() + node.getScene().getWindow().getX();
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
/**
*
* @param node
* @return The Y screen coordinate of the node.
*/
static public double screenY(Node node) {
return node.localToScene(node.getBoundsInLocal()).getMinY()
+ node.getScene().getY() + node.getScene().getWindow().getY();
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
/**
*
* @param node
* @return The X screen coordinate of the node.
*/
static public double screenX(Node node) {
return node.localToScene(node.getBoundsInLocal()).getMinX() + node.getScene().getX() + node.getScene().getWindow().getX();
}
代码示例来源:origin: com.jfoenix/jfoenix
public void show(Node node){
if(!isShowing()){
if(node.getScene() == null || node.getScene().getWindow() == null)
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() + node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + ((Region)node).getHeight());
((JFXAutoCompletePopupSkin<T>)getSkin()).animate();
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Show this popup right below the given Node
*
* @param node
*/
public void show(Node node) {
if (node.getScene() == null || node.getScene().getWindow() == null) {
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
} // $NON-NLS-1$
if (isShowing()) {
return;
}
final Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + control.getHeight());
}
代码示例来源:origin: org.controlsfx/controlsfx
/**
* Show this popup right below the given Node
* @param node
*/
public void show(Node node){
if(node.getScene() == null || node.getScene().getWindow() == null)
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); //$NON-NLS-1$
if(isShowing()){
return;
}
Window parent = node.getScene().getWindow();
this.show(
parent,
parent.getX() + node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + TITLE_HEIGHT);
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
@Override
public void handle(MouseEvent event) {
Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY());
Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY());
Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal());
valueMarker.setStartY(0);
valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY() - chartWrap.sceneToLocal(chartAreaBounds).getMinY());
valueMarker.setStartX(0);
valueMarker.setEndX(0);
valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2);
double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY();
valueMarker.setTranslateY(-ydelta * 2);
}
});
代码示例来源:origin: com.aquafx-project/aquafx
private void updateArrowLinePositions() {
double left = arrowButton.localToScene(0, 0).getX() - arrowButtonContainer.localToScene(0, 0).getX();
arrowButtonLeftLine.setLayoutX(left-1);
arrowButtonLeftLine.setPrefHeight(arrowButtonContainer.getLayoutBounds().getHeight());
arrowButtonRightLine.setLayoutX(left + arrowButton.getLayoutBounds().getWidth());
arrowButtonRightLine.setPrefHeight(arrowButtonContainer.getLayoutBounds().getHeight());
double arrowLeft = arrow.localToScene(0, 0).getX() - arrowButtonContainer.localToScene(0, 0).getX();
arrowLeftLine.setLayoutX(arrowLeft-1);
arrowLeftLine.setPrefHeight(arrowButtonContainer.getLayoutBounds().getHeight());
arrowRightLine.setLayoutX(arrowLeft + arrow.getLayoutBounds().getWidth());
arrowRightLine.setPrefHeight(arrowButtonContainer.getLayoutBounds().getHeight());
}
}
内容来源于网络,如有侵权,请联系作者删除!