本文整理汇总了Java中javafx.scene.Node.setLayoutY方法的典型用法代码示例。如果您正苦于以下问题:Java Node.setLayoutY方法的具体用法?Java Node.setLayoutY怎么用?Java Node.setLayoutY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Node
的用法示例。
在下文中一共展示了Node.setLayoutY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SeparatedStage
import javafx.scene.Node; //导入方法依赖的package包/类
SeparatedStage(Node node){
super();
position = new Point2D(node.getLayoutX(),node.getLayoutY());
root.getChildren().add(node);
//scene.setFill(Color.WHITE);
this.node = node;
setOnShowing(showHandler);
setOnHiding(showHandler);
root.setOnMouseDragged(startDragHandler);
root.setOnMouseExited(stopDragHandler);
root.setOnMouseReleased(stopDragHandler);
setAlwaysOnTop();
try {
node.setLayoutX(0);
node.setLayoutY(0);
} catch (Exception e){ }
show();
stage.setX(position.getX());
stage.setY(position.getY());
Bounds bounds = node.getLayoutBounds();
stage.setHeight(bounds.getHeight()+5);
stage.setWidth(bounds.getWidth()+5);
}
示例2: layoutChildren
import javafx.scene.Node; //导入方法依赖的package包/类
@Override protected void layoutChildren() {
final double w = getWidth();
final double h = getHeight();
clipRect.setWidth(w);
clipRect.setHeight(h);
for (Node child : getChildren()) {
if (child == postView) {
postView.relocate(w - 15 - postView.getLayoutBounds().getWidth(), 0);
} else if (child.getLayoutX() == 0 && child.getLayoutY() == 0) {
final double iw = child.getBoundsInParent().getWidth();
final double ih = child.getBoundsInParent().getHeight();
child.setLayoutX((w - iw) * Math.random() + 100);
child.setLayoutY((h - ih) * Math.random() + 100);
}
}
}
示例3: drag
import javafx.scene.Node; //导入方法依赖的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();
}
}
示例4: drag
import javafx.scene.Node; //导入方法依赖的package包/类
@Override
public void drag(MouseEvent e) {
Node node = get();
if (pressed && isEnable() && e.isConsumed() == false && node != null) {
node.setLayoutX(MathUtil.toRange(e.getScreenX() - startX, minX.get(), maxX.get()));
node.setLayoutY(MathUtil.toRange(e.getScreenY() - startY, minY.get(), maxY.get()));
e.consume();
}
}
示例5: slice
import javafx.scene.Node; //导入方法依赖的package包/类
private static void slice(Node node, double layoutFromX, double layoutFromY, double layoutToX, double layoutToY,
double opacity, EventHandler<ActionEvent> handler) {
FadeTransition fadeTransition = new FadeTransition(Duration.millis(200), node);
fadeTransition.setFromValue(opacity);
fadeTransition.setToValue(1D - opacity);
Path path = new Path();
path.getElements().add(new MoveTo(node.getLayoutX() + layoutToX, node.getLayoutY() + layoutToY));
node.setLayoutX(node.getLayoutX() + layoutFromX);
node.setLayoutY(node.getLayoutY() + layoutFromY);
PathTransition pathTransition = new PathTransition(Duration.millis(200), path, node);
ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, pathTransition);
parallelTransition.setOnFinished(handler);
parallelTransition.play();
}
示例6: relocate
import javafx.scene.Node; //导入方法依赖的package包/类
void relocate(Node node, double x, double y){
node.setLayoutX(x - this.getX());
node.setLayoutY(y - this.getY());
}