Basic Shapes in JavaFX
With JavaFX, you can draw basic two-dimensional objects such as lines, arcs, rectangles, ellipses. You can also fill the shape with a solid color, a gradient fill, or text that’s created from an image. You can make your shapes solid or transparent, and you can rotate, clip, skew, and do all sorts of other unspeakable things to them.
Rectangle rect1 = new Rectangle(100, 100, 200, 200); Circle circle1 = new Circle(100, 100, 200); Ellipse ellipse1 = new Ellipse(100, 100, 200, 250); Line line1 = new Line(100,100,200,200);
Fill and Stroke
Shape1.setFill(Color.RED); shape1.setStroke(Color.BLACK); shape1.setStrokeWidth(3);
Translate and Rotate
Shape1.setTranslateX(100); shape1.setTranslateY(100); shape1.setRotate(90);