Element: Cube.

Icon: 

Text: A 3D box.

Description: A Cube is a drawing element that displays a cube (what is commonly known as a box) in three dimensions. The cube is determined by its origin and its size along each of the coordinate axes.

The ellipsoid can be moved by dragging its origin point, and resized dragging the opposite vertex, invoking up to three different actions.

Advanced Color Scheme

This element allows the use of an advanced color scheme for it. The user can define an origin and a direction in space so that the distance from the origin along this direction decides the color that will be used to fill the interior of the element. This can produce drawings like the one displayed below.

Table of properties

Name Description Values accepted
Position and Size
Origin X The X coordinate of the origin of the element. Any constant or variable of type double or int.
Origin Y The Y coordinate of the origin of the element. Any constant or variable of type double or int.
Origin Z The Z coordinate of the origin of the element. Any constant or variable of type double or int.
Size X The size of the element in the X direction. Any constant or variable of type double or int.
Size Y The size of the element in the Y direction. Any constant or variable of type double or int.
Size Z The size of the element in the Z direction. Any constant or variable of type double or int.

Visibility and Interaction

Visible The visibility of the element. A boolean variable or one of the constants true or false.
Enabled Whether the element moves when the user drags its origin. A boolean variable or one of the constants true or false.
Resizable Whether the element resizes when the user drags its end point (the vertex opposite to the origin). A boolean variable or one of the constants true or false.
On Press The action to invoke when the element is pressed. The Java code to invoke for the action. 
On Drag The action to invoke when the element is moved. The Java code to invoke for the action. 
On Release The action to invoke when the element is released. The Java code to invoke for the action. 
On Enter The action to invoke when the pointer enters the element. The Java code to invoke for the action. 
On Exit The action to invoke when the pointer leaves the element. The Java code to invoke for the action. 
Configuration
Close Bottom Whether to close the bottom part of the cube. A boolean variable or one of the constants true or false.
Close Top Whether to close the top part of the cube. A boolean variable or one of the constants true or false.
Graphical Aspect
Line Color The color used for the lines of the element. The special value null draws the element without an edge. See the values for the Fill Color property.
Fill Color The color used to fill the element. The special value null draws an empty element. An Object variable of the class java.awt.Color or one of the predefined colors: black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow.

A color can also be specified providing its integer RGB coordinates (between 0 and 255), plus an optional transparency coordinate.

The default value is decided by the system.

Stroke The thickness for the lines of the element. Any constant or variable of type double or int. The default value is 1.

Object variables of the class  java.awt.Stroke are also accepted.

Resolution How to divide the element in small rectangles. Three integers separated by a comma, indicating the number of partitions in the X, Y, and Z directions, respectively.
Alternatively, a double value setting the maximum length allowed for the sides of the rectangles.
An Object variable of the class org.opensourcephysics.displayejs.Resolution is also accepted.
Displacement This is a factor that allows us to simulate that the element is located further from the observer than it actually is. This allows a better visualization of other elements that move along the surface This factor is set ussually to a value slightly bigger that one, such as 1.1. Any constant or variable of type double. The default value is 1.
Quick Transp The level of transparency to use when the element is drawn quickly (which can happen when the scene is rotated). Any constant or variable of type int.

The value must be in the range from 0 (transparent) to 255 (solid).

Advanced Color Scheme
Color Origin Defines the origin point for the computation of the color levels. A one-dimensional array of type double with three elements. One for each of the coordinates of the origin point.
Color Direction Defines the direction along which the gradient of colors takes place. A one-dimensional array of type double with three elements. One for each of the coordinates of the gradient of colors.
Color Levels Defines the number of levels that separate the zones with the same color. The number of levels must be one less than the number of colors. A one-dimensional array of type double providing the values for which a change of color takes place.
Color Fills Defines the colors to use at each side of the color leves. The number of colors must be one more than the number of levels. A one-dimensional array of type Object. Each element in the array must be the color to use in each of the zones delimited by the levels.

For the accepted values for the elements in the array, see the values for the Fill Color property. 

Threshold Below Whether to use the color of the level below for points right in the level of separation of two color zones. A boolean variable or one of the constants true or false.