本文整理了Java中javafx.scene.Node.relocate()
方法的一些代码示例,展示了Node.relocate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.relocate()
方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:relocate
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY);
break;
default:
代码示例来源:origin: org.fxmisc.flowless/flowless
@Override
public void relocate(Node node, double b0, double l0) {
node.relocate(b0, l0);
}
代码示例来源:origin: org.fxmisc.flowless/flowless
@Override
public void relocate(Node node, double b0, double l0) {
node.relocate(l0, b0);
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @param progress
* @param animationLayoutInfo
*/
@Implements(interfaces=AnimationInterpolation.class)
static public void animateFromTheOrigin(double progress, AnimationLayoutInfo animationLayoutInfo) {
double lOX = animationLayoutInfo.originX - (animationLayoutInfo.layoutInfo.beadDiameter / 2);
double lOY = animationLayoutInfo.originY - (animationLayoutInfo.layoutInfo.beadDiameter / 2);
double lX = lOX + (progress * (animationLayoutInfo.nodeLayoutInfo.x - lOX));
double lY = lOY + (progress * (animationLayoutInfo.nodeLayoutInfo.y - lOY));
animationLayoutInfo.node.relocate(lX, lY);
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @param progress
* @param animationLayoutInfo
*/
@Implements(interfaces=AnimationInterpolation.class)
static public void animateAppear(double progress, AnimationLayoutInfo animationLayoutInfo) {
animationLayoutInfo.node.setOpacity(progress);
animationLayoutInfo.node.relocate(animationLayoutInfo.nodeLayoutInfo.x, animationLayoutInfo.nodeLayoutInfo.y);
}
代码示例来源:origin: com.guigarage/animations
@Override
protected void layoutChildren() {
super.layoutChildren();
for(Node child : getChildren()) {
if(!child.equals(playIcon) && !child.equals(pauseIcon)) {
child.relocate(0, 0);
child.resize(getWidth(), getHeight());
}
}
}
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @param progress
* @param animationLayoutInfo
*/
@Implements(interfaces=AnimationInterpolation.class)
static public void animateOverTheArc(double progress, AnimationLayoutInfo animationLayoutInfo) {
double lAngle = animationLayoutInfo.layoutInfo.startAngle + (progress * (animationLayoutInfo.nodeLayoutInfo.angle - animationLayoutInfo.layoutInfo.startAngle));
double lX = calculateX(animationLayoutInfo.layoutInfo.chainDiameter, lAngle) + (animationLayoutInfo.layoutInfo.beadDiameter / 2)
- (animationLayoutInfo.nodeLayoutInfo.w / 2) // add the difference between the bead's size and the node's, so it ends up in the center
- animationLayoutInfo.layoutInfo.clipLeft
;
double lY = calculateY(animationLayoutInfo.layoutInfo.chainDiameter, lAngle) + (animationLayoutInfo.layoutInfo.beadDiameter / 2)
- (animationLayoutInfo.nodeLayoutInfo.w / 2) // add the difference between the bead's size and the node's, so it ends up in the center
- animationLayoutInfo.layoutInfo.clipTop
;
animationLayoutInfo.node.relocate(lX, lY);
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
Node graphicsNode = collect.get(0);
graphicsNode.autosize();
graphicsNode.relocate(0, 0);
} else {
double start = 0;
for (Node n : collect) {
n.autosize();
n.relocate(start, 0);
start += n.prefWidth(-1);
Node graphicsNode = collect.get(0);
graphicsNode.autosize();
graphicsNode.relocate(getWidth()-graphicsNode.prefWidth(-1), 0);
for (Node n : collect) {
n.autosize();
n.relocate(getWidth()-n.prefWidth(-1) - start, 0);
start += n.prefWidth(-1);
Node graphicsNode = collect.get(0);
graphicsNode.autosize();
graphicsNode.relocate(0, getHeight() - graphicsNode.prefHeight(-1));
} else {
double start = 0;
for (Node n : collect) {
n.autosize();
n.relocate(start, getHeight() - n.prefHeight(-1));
start += n.prefWidth(-1);
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
@Override
protected void layoutChildren() {
getParent().requestLayout();
super.layoutChildren();
for (Node n : getManagedChildren()) {
if (n instanceof Region) {
Region p = (Region) n;
double width = Math.max(p.getMinWidth(), p.getPrefWidth());
double height = Math.max(p.getMinHeight(), p.getPrefHeight());
n.resize(width, height);
double nX = Math.min(0, n.getLayoutX());
double nY = Math.min(0, n.getLayoutY());
n.relocate(nX, nY);
}
}
}
代码示例来源:origin: stackoverflow.com
double deltaX = event.getSceneX() - mouseAnchor.get().getX();
double deltaY = event.getSceneY() - mouseAnchor.get().getY();
node.relocate(node.getLayoutX()+deltaX, node.getLayoutY()+deltaY);
mouseAnchor.set(new Point2D(event.getSceneX(), event.getSceneY()));;
});
代码示例来源:origin: stackoverflow.com
EventHandler<MouseEvent> onMouseReleasedEventHandler = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
fixPosition((Node) t.getSource());
}
};
resource.setOnMouseReleased(onMouseReleasedEventHandler);
private void fixPosition( Node node) {
double x = node.getTranslateX();
double y = node.getTranslateY();
node.relocate(node.getLayoutX() + x, node.getLayoutY() + y);
node.setTranslateX(0);
node.setTranslateY(0);
}
代码示例来源:origin: stackoverflow.com
node.relocate(x + 10, y - node.prefHeight(Integer.MAX_VALUE) / 2);
node.autosize();
代码示例来源:origin: stackoverflow.com
for (Data<X, Y> horizontalMarker : horizontalMarkers) {
Line line = (Line) horizontalMarker.getNode();
line.setStartX(0);
line.setEndX(getBoundsInLocal().getWidth());
line.setStartY(getYAxis().getDisplayPosition(horizontalMarker.getYValue()) + 0.5); // 0.5 for crispness
line.setEndY(line.getStartY());
line.toFront();
Node text = nodeMap.get(line);
text.relocate(line.getBoundsInParent().getMinX() + line.getBoundsInParent().getWidth()/2 - text.prefWidth(-1) / 2, line.getBoundsInParent().getMinY() - 30);
}
代码示例来源:origin: stackoverflow.com
node.setOnMouseDragged(mouseEvent -> node.relocate( mouseEvent.getScreenX() + dragDelta.x, mouseEvent.getScreenY() + dragDelta.y));
代码示例来源:origin: org.controlsfx/controlsfx
@Override protected void layoutChildren(double x, double y, double w, double h) {
for (int i = 0; i < getChildren().size(); i++) {
Node n = getChildren().get(i);
double nw = snapSize(n.prefWidth(h));
double nh = snapSize(n.prefHeight(-1));
if (i > 0) {
// We have to position the bread crumbs slightly overlapping
double ins = n instanceof BreadCrumbButton ? ((BreadCrumbButton)n).getArrowWidth() : 0;
x = snapPosition(x - ins);
}
n.resize(nw, nh);
n.relocate(x, y);
x += nw;
}
}
代码示例来源:origin: stackoverflow.com
double deltaX = event.getSceneX() - mouseAnchor.get().getX();
double deltaY = event.getSceneY() - mouseAnchor.get().getY();
node.relocate(node.getLayoutX()+deltaX, node.getLayoutY()+deltaY);
mouseAnchor.set(new Point2D(event.getSceneX(), event.getSceneY()));;
});
代码示例来源:origin: stackoverflow.com
node.relocate( mouseEvent.getScreenX() + dragDelta.x, mouseEvent.getScreenY() + dragDelta.y);
circlePane.update();
代码示例来源:origin: no.tornado/tornadofx-controls
if (graphic != null) {
double centeredX = x + (w / 2) - graphic.getLayoutBounds().getWidth() / 2;
graphic.relocate(centeredX, y);
y += Math.max(graphic.getLayoutBounds().getHeight(), graphicFixedSize());
graphic.relocate(centeredX, y);
if (graphic != null) {
double centeredY = y + (h / 2) - graphic.getLayoutBounds().getHeight() / 2;
graphic.relocate(x, centeredY);
代码示例来源:origin: org.controlsfx/controlsfx
@Override protected void layoutChildren(double x, double y, double w, double h) {
// double currentWidth = getSkinnable().getWidth();
double cellWidth = getSkinnable().gridViewProperty().get().getCellWidth();
double cellHeight = getSkinnable().gridViewProperty().get().getCellHeight();
double horizontalCellSpacing = getSkinnable().gridViewProperty().get().getHorizontalCellSpacing();
double verticalCellSpacing = getSkinnable().gridViewProperty().get().getVerticalCellSpacing();
double xPos = 0;
double yPos = 0;
// This has been commented out as I removed the API from GridView until
// a use case was created.
// HPos currentHorizontalAlignment = getSkinnable().gridViewProperty().get().getHorizontalAlignment();
// if (currentHorizontalAlignment != null) {
// if (currentHorizontalAlignment.equals(HPos.CENTER)) {
// xPos = (currentWidth % computeCellWidth()) / 2;
// } else if (currentHorizontalAlignment.equals(HPos.RIGHT)) {
// xPos = currentWidth % computeCellWidth();
// }
// }
for (Node child : getChildren()) {
child.relocate(xPos + horizontalCellSpacing, yPos + verticalCellSpacing);
child.resize(cellWidth, cellHeight);
xPos = xPos + horizontalCellSpacing + cellWidth + horizontalCellSpacing;
}
}
}
代码示例来源:origin: com.jfoenix/jfoenix
mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY);
break;
default:
内容来源于网络,如有侵权,请联系作者删除!