Javatpoint Logo
Javatpoint Logo

JavaFX Box

In general, a box can be defined as the three dimensional shape having all the faces in the rectangular shape. Boxes are generally the cuboid having three dimensions height, depth and width. In JavaFX, box is represented by the class javafx.scene.shape.Box. We just need to instantiate this class in order to create the box.

The height, width and depth of a cube (box) is shown in the following image.


JavaFX Box

Properties

The class contains various properties that are described in the following table.

Property Description Setter Methods
depth It is a double type property. It represents the z-dimension of the Box. setDepth(double value)
height It is a double type property. It represents the Y-dimension of the Box. setHeight(double value)
width It is a double type property. It represents the X-dimension of the Box. setWidth(double value)

Constructors

The class contains two constructors described below.

  1. public Box(): creates the instance of Box class with the default parameters.
  2. public Box(double width, double height, double depth) : creates the instance of Box class with the specified dimensions
  3. Example


    JavaFX Box
    Next TopicJavaFX Cylinder




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA