Javatpoint Logo
Javatpoint Logo

JavaFX Cylinder

In general, a cylinder can be defined as a three dimensional solid object having two parallel circular basis connected by a curved surface. There are the two main parameters that describe a cylinder, namely height of the curved surface and the radius of the circular base.

The radius and the height of a cylinder are shown in the following image.

JavaFX Cylinder

In JavaFX, the class javafx.scene.shape.Cylinder represents a cylinder. We just need to instantiate this class in order to create a cylinder.


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

Property Property Setter Methods
height It is a double type property. It represents the Z dimension of the Cylinder. setHeight(double value)
radius It is a double type property. It represents the radius of the Cylinder. setRadius(double value)


There are the three constructors in the class.

  1. public Cylinder() : Creates the new instance with default parameters.
  2. public Cylinder(double radius, double height) : Creates the new instance with the specified radius and height.
  3. public Cylinder(double radius, double height, int divisions) : creates the new instance with the specified radius, height and divisions.
  4. Example

    JavaFX Cylinder
    Next TopicJavaFX Sphere

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA