javafx.scene.layout.Region
javafx.scene.shape.Rectangle
javafx.scene.shape.Circle
javafx.scene.shape.Ellipse
javafx.scene.shape.Arc
javafx.scene.text.Text
NodeAnchor
class to define the anchors between the Nodes. The usual way to perform this is to create an instance of the class and specify the reference Node at the class creation,a d specify the ancoring of other Nodes relative to this NodeRectangle rec = new Rectangle(); rec.setFill(Color.YELLOW); Text text = new Text(); text.setFill(Color.RED); text.setText("TOTO"); text.setTextOrigin(VPos.CENTER); text.setTextAlignment(TextAlignment.CENTER); NodeAnchor anchor = new NodeAnchor(text); // the Rectangle will be put on the bottom of the text anchor.anchor(rec, AnchorPosition.BOTTOM, AnchorPosition.TOP); Pane root = new Pane(); rec.setX(200); rec.setY(100); rec.setWidth(100); rec.setHeight(100); text.setWrappingWidth(70); root.getChildren().add(rec); root.getChildren().add(text);
Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences