本文整理汇总了Java中javafx.scene.Node.getLayoutY方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getLayoutY方法的具体用法?Java Node.getLayoutY怎么用?Java Node.getLayoutY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Node
的用法示例。
在下文中一共展示了Node.getLayoutY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: press
import javafx.scene.Node; //导入方法依赖的package包/类
private void press(MouseEvent e) {
Node node = get();
if (isEnable() && e.isConsumed() == false && node != null) {
Corner corner = calcCorner(e);
if (corner != Corner.CENTER) {
pressedCorner = corner;
startX = e.getScreenX();
startY = e.getScreenY();
startWidth = width.get() == -1 ? node.prefWidth(-1) : width.get();
startHeight = height.get() == -1 ? node.prefHeight(-1) : height.get();
startPosX = node.getLayoutX();
startPosY = node.getLayoutY();
e.consume();
}
}
}
示例4: makeLocationScale
import javafx.scene.Node; //导入方法依赖的package包/类
private static void makeLocationScale(Scene scene, Node node) {
double nodeX = node.getLayoutX();
double sceneWidth = scene.getWidth();
double nodeY = node.getLayoutY();
double sceneHeight = scene.getHeight();
if (nodeX != 0.0) {
ChangeListener<Number> xResizer = (arg0, oldValue, newValue) -> node.relocate(nodeX / sceneWidth * newValue.doubleValue(), node.getLayoutY());
scene.widthProperty().addListener(xResizer);
}
if (nodeY != 0.0) {
ChangeListener<Number> yResizer = (arg0, oldValue, newValue) -> node.relocate(node.getLayoutX(), nodeY / sceneHeight * newValue.doubleValue());
scene.heightProperty().addListener(yResizer);
}
}
示例5: press
import javafx.scene.Node; //导入方法依赖的package包/类
@Override
public void press(MouseEvent e) {
Node node = get();
if (isEnable() && e.isConsumed() == false && node != null) {
Bounds boundsInLocal = node.getBoundsInLocal();
if (canDrag(node.screenToLocal(e.getScreenX(), e.getScreenY()), boundsInLocal.getMaxX(), boundsInLocal.getMaxY())) {
startX = e.getScreenX() - node.getLayoutX();
startY = e.getScreenY() - node.getLayoutY();
e.consume();
pressed = true;
}
}
}