本文整理匯總了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());
}