A circle.
Ellipse
Here are some Ellipse
constructors.
For details, look at the Oracle documentation.
Ellipse() Creates an empty Ellipse. Ellipse(double radiusX, double radiusY) Creates an Ellipse of the given size. Ellipse(double centerX, double centerY, double radiusX, double radiusY) Creates an Ellipse of the given position and size.
Here are some of the Ellipse
methods.
You can construct a Ellipse
object
with one of the constructors, and then later on adjust its size, color, and location.
double getCenterX() Gets the value of centerX. double getCenterY() Gets the value of centerY. double getRadiusX() Gets the value of the radiusX. double getRadiusY() Gets the value of the radiusY. void setCenterX(double value) Sets the value of centerX. void setCenterY(double value) Sets the value of centerY. void setRadiusX(double value) Sets the value of radius. void setRadiusY(double value) Sets the value of radius.
Here are some methods inherited from Shape
:
public final void setFill(Paint value) Set the color for the fill. public final Paint getFill() Get the color of the fill. public final void setStroke(Paint value) Set the color for the stroke public final Paint getStroke() Get the color of the stroke public final void setStrokeWidth(double value) Set the width of the stroke, in pixels public final Paint getStrokeWidth() Gets the width of the stroke, in pixels
The bounding box of a figure is the smallest rectangle that completely contains the figure. Complete the following fragment so that the bounding box of the ellipse is the entire window.
public void start( Stage primaryStage ) { double width = 300.0, height = 200.0; double centerX = ; double centerY = ; double radiusX = ; double radiusY = ; Ellipse ellipse = new Ellipse( centerX, centerY, radiusX, radiusY ); ellipse.setFill( Color.AQUA ); Pane pane = new Pane( ellipse ); Scene scene = new Scene( pane, width, height, Color.CORNSILK ); primaryStage.setTitle("Bounding Box"); primaryStage.setScene( scene ); primaryStage.show(); }