Java Code Examples for javafx.scene.Node#getLayoutY()
The following examples show how to use
javafx.scene.Node#getLayoutY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiTouchSample.java From marathonv5 with Apache License 2.0 | 6 votes |
@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); } } }
Example 2
Source File: MultiTouchSample.java From marathonv5 with Apache License 2.0 | 6 votes |
@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); } } }
Example 3
Source File: OverlayStage.java From DeskChan with GNU Lesser General Public License v3.0 | 6 votes |
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); }
Example 4
Source File: MouseDragSnippet.java From gef with Eclipse Public License 2.0 | 6 votes |
protected void onMousePress(MouseEvent event) { pressed = (Node) event.getTarget(); System.out.println("press " + pressed); startMousePosition = new Point2D(event.getSceneX(), event.getSceneY()); startLayoutPosition = new Point2D(pressed.getLayoutX(), pressed.getLayoutY()); // add effect pressed.setEffect(new Bloom(0)); IAnchor ifxAnchor = anchors.get(pressed); if (ifxAnchor != null) { Set<AnchorKey> keys = ifxAnchor.positionsUnmodifiableProperty() .keySet(); for (AnchorKey key : keys) { key.getAnchored().setEffect(null); } } }
Example 5
Source File: VerticalTransition.java From JFoenix with Apache License 2.0 | 6 votes |
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.translateYProperty(), (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()) * (topDirection? -1 : 1), Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); }
Example 6
Source File: FXTestUtils.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * Drags the given {@link Node} from the start location to the end location. * * @param node the {@link Node} which should be dragged * @param offsetX the x offset on the node where the drag gesture starts from * @param offsetY the y offset on the node where the drag gesture starts from * @param endX the x coordinate of the targeted location * @param endY the y coordinate of the targeted location */ public static void dragTo(final Node node, final double offsetX, final double offsetY, final double endX, final double endY) { final double startX = node.getLayoutX() + offsetX; final double startY = node.getLayoutY() + offsetY; final double dragX = startX + (endX - node.getLayoutX()); final double dragY = startY + (endY - node.getLayoutY()); final MouseEvent pressed = createMouseEvent(MouseEvent.MOUSE_PRESSED, startX, startY); final MouseEvent dragged = createMouseEvent(MouseEvent.MOUSE_DRAGGED, dragX, dragY); final MouseEvent released = createMouseEvent(MouseEvent.MOUSE_RELEASED, dragX, dragY); Event.fireEvent(node, pressed); Event.fireEvent(node, dragged); Event.fireEvent(node, released); }
Example 7
Source File: DefaultNodeSkin.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
@Override public Point2D getConnectorPosition(final GConnectorSkin connectorSkin) { final Node connectorRoot = connectorSkin.getRoot(); final Side side = DefaultConnectorTypes.getSide(connectorSkin.getConnector().getType()); // The following logic is required because the connectors are offset slightly from the node edges. final double x, y; if (side.equals(Side.LEFT)) { x = 0; y = connectorRoot.getLayoutY() + connectorSkin.getHeight() / 2; } else if (side.equals(Side.RIGHT)) { x = getRoot().getWidth(); y = connectorRoot.getLayoutY() + connectorSkin.getHeight() / 2; } else if (side.equals(Side.TOP)) { x = connectorRoot.getLayoutX() + connectorSkin.getWidth() / 2; y = 0; } else { x = connectorRoot.getLayoutX() + connectorSkin.getWidth() / 2; y = getRoot().getHeight(); } return new Point2D(x, y); }
Example 8
Source File: TitledNodeSkin.java From graph-editor with Eclipse Public License 1.0 | 5 votes |
@Override public Point2D getConnectorPosition(final GConnectorSkin connectorSkin) { final Node connectorRoot = connectorSkin.getRoot(); final double x = connectorRoot.getLayoutX() + connectorSkin.getWidth() / 2; final double y = connectorRoot.getLayoutY() + connectorSkin.getHeight() / 2; if (inputConnectorSkins.contains(connectorSkin)) { return new Point2D(x, y); } else { // Subtract 1 to align start-of-connection correctly. Compensation for rounding errors? return new Point2D(x - 1, y); } }
Example 9
Source File: XYChartUtils.java From chart-fx with Apache License 2.0 | 4 votes |
public static double getLocationY(final Node node) { return node.getLayoutY() + node.getTranslateY(); }
Example 10
Source File: OrientationHelper.java From Flowless with BSD 2-Clause "Simplified" License | 4 votes |
@Override public double layoutX(Node node) { return node.getLayoutY(); }
Example 11
Source File: OrientationHelper.java From Flowless with BSD 2-Clause "Simplified" License | 4 votes |
@Override public double layoutY(Node node) { return node.getLayoutY(); }
Example 12
Source File: TreeNodeSkin.java From graph-editor with Eclipse Public License 1.0 | 3 votes |
@Override public Point2D getConnectorPosition(final GConnectorSkin connectorSkin) { final Node connectorRoot = connectorSkin.getRoot(); final double x = connectorRoot.getLayoutX() + connectorSkin.getWidth() / 2; final double y = connectorRoot.getLayoutY() + connectorSkin.getHeight() / 2; return new Point2D(x, y); }