Javatpoint Logo
Javatpoint Logo

JavaFX Sphere

In general, sphere can be defined as a round 3D object with every point on its surface equidistant from its centre. A sphere can be seen as a Circle created in a 3 dimensional plane where every coordinate contains an extra dimension Z.

The examples of Sphere in the real world are globe, ball, etc. In JavaFX, Sphere is represented by the class javafx.scene.shape.Sphere. We just need to instantiate this class in order to create the sphere. A sphere is shown in the following image.


JavaFX Sphere

Properties

The properties of the class along with their setter methods are described in the following table.

Property Description Setter Methods
radius It is a double type property. It represents the radius of the sphere. SetRadius(double radius)

Constructors

There are the three constructors

  1. public Sphere() : creates a new instance of sphere of radius 1.0
  2. public Sphere(double radius) : creates a new instance of sphere with the specified radius.
  3. public Sphere(double radius, int divisions) : creates a new instance of sphere with the specified radius and divisions.

Example


JavaFX Sphere
Next TopicJavaFX Layouts




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA