Element: DrawingPanel3D.
Icon:
Text: A 3D container for Drawables.
Description: A DrawingPanel3D is a special container to host drawable children. Even when it is considered a container, it cannot be used to host other type of elements.
Drawing panels 3D represent a region of the three-dimensional space and provide their own coordinate system, from the point (Minimum X, Minimum Y, Minimum Z) to (Maximum X, Maximum Y, Maximum Z). (Even though the scales can also be automatically adjusted.) They implement a basic mechanism for hidden-line removal that is very effective for simple configurations.
Drawing panels 3D are interactive, but is a way different to that of two-dimensional drawing panels.
Clicking and dragging the mouse over an empty area of the panel changes the scene viewpoint. Holding the left or right buttons of the mouse can make a difference in the way the scene is redrawn while rotating.
Holding the "Control" key while dragging the mouse pans the scene.
Holding the "Shift" key while dragging the mouse zooms the scene (positivele or negatively, depending on the motion of the mouse).
Holding the "Alt" key while clicking and dragging the mouse brings in a three-dimensional cursor that allows you to select a point in the 3D scene. The motion of this cursor follows the bidimensional motion of the mouse affecting only two spatial coordinates at a time. To force motion on precisely one of the coordinates, you will need to hold the corresponding key of the keyboard: X, Y or Z. When the cursor changes position, the actions associated to the properties "On Press", "On Drag" and "On Release", are invoked exactly as in the case of two-dimensional drawing panels.
Drawing panels 3D also respond to keyboard interaction. When the user click on them, they get focus so that hitting a keyboard key triggers a Key Action. The key pressed can be obtained through the Key Pressed property.
Table of properties |
||
Name | Description | Values accepted |
Scales | ||
Autoscale X | Whether to automatically compute the scale in the X axis. | A boolean variable or one of the constants true or false. |
Autoscale Y | Whether to automatically compute the scale in the Y axis. | A boolean variable or one of the constants true or false. |
Autoscale Z | Whether to automatically compute the scale in the Z axis. | A boolean variable or one of the constants true or false. |
Minimum X | The smallest value of the X coordinate that is visible in the panel. | A constant or variable of type double. |
Maximum X | The greatest value of the X coordinate that is visible in the panel. | A constant or variable of type double. |
Minimum Y | The smallest value of the Y coordinate that is visible in the panel. | A constant or variable of type double. |
Maximum Y | The greatest value of the Y coordinate that is visible in the panel. | A constant or variable of type double. |
Minimum Z | The smallest value of the Z coordinate that is visible in the panel. | A constant or variable of type double. |
Maximum Z | The greatest value of the Z coordinate that is visible in the panel. | A constant or variable of type double. |
Interaction | ||
X | The X coordinate of the position of the mouse. | A variable of type double. |
Y | The Y coordinate of the position of the mouse. | A variable of type double. |
Z | The Z coordinate of the position of the mouse. | A variable of type double. |
On Press | The action to invoke when the mouse is pressed on the panel. | The Java code to invoke for the action. |
On Drag | The action to invoke when the mouse is dragged on the panel. | The Java code to invoke for the action. |
On Release | The action to invoke when the mouse is released on the panel. | The Java code to invoke for the action. |
Mouse Enter | The action to invoke when the pointer enters the element. | The Java code to invoke for the action. |
Mouse Exit | The action to invoke when the pointer leaves the element. | The Java code to invoke for the action. |
Key Action | The action to invoke when any key is hit while the panel has focus. | The Java code to invoke for the action. |
Key Pressed | The integer code of the key pressed. | A variable of type int. |
Projection Mode |
||
Display Mode | The way to project the 3D scene on the display plane. | One of the following constants:
Integer constants and variables are also accepted, using any of the values indicated in the parentheses above. This allows chaniging the projection in run-time. |
Square | Whether to keep a 1:1 ratio between the horizontal and vertical coordinates (only in 2D modes). | A boolean variable or one of the constants true or false. |
Hide Lines | Whether to remove hidden-lines. | A boolean variable or one of the constants true or false. |
Quick Redraw | Whether to use a quick drawing mode when rotating the scene. | Una variable booleana o una de las constantes true o false. |
Alpha | The angle to rotate the scene horizontally before projecting it (only in 3D modes). | A constant or variable of type double for an angle in radians, or a constant or variable of type int for an angle in degrees. |
Beta | The angle to rotate the scene vertically before projecting it (only in 3D modes). | A constant or variable of type double for an angle in radians, or a constant or variable of type int for an angle in degrees. |
Hor. Disp. | The horizontal displacement of the center of the scene (in pixels). | A constant or variable of type int or double. |
Vert. Disp. | The vertical displacement of the center of the scene (in pixels). | A constant or variable of type int or double. |
Zoom | A magnifying factor for the scene. | A constant or variable of type double. |
Graphical Aspect |
||
Decoration | The type of default decoration for the scene. | One of the following constants:
Integer constants and variables are also accepted, using any of the values indicated in the parentheses above. |
Cursor | The type of cursor to use when locating a point. | Una de las constantes siguientes:
Puede usarse también uno de los números enteros indicados entre paréntesis. |
Coordinates | Whether to display the current coordinates of the mouse when the user clicks on the panel. | A boolean variable or one of the constants true or false. |
X Format | The format for the visualization of the X coordinate. | Any value acepted by the class java.text.DecimalFormat. See additional info. Default is "x=0.000". |
Y Format | The format for the visualization of the Y coordinate. | Any value acepted by the class java.text.DecimalFormat. See additional info. Default is "y=0.000". |
Z Format | The format for the visualization of the Z coordinate. | Any value acepted by the class java.text.DecimalFormat. See additional info. Default is "z=0.000". |
Visible | The visibility of the element. | A boolean variable or one of the constants true or false. |
Size | The size of the element. | An Object variable of the class java.awt.Dimension or the integer values for the width and the height, respectively, separated by a comma. |
Background | The color used for the background of the element and that of its children (unless they explicitely set their own value for this property). | 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. |
Foreground | The color used for any text displayed by the element or by its children (unless they explicitely set their own value for this property). | See the values for the Background property. |
Font | The font used for any text displayed by the element or by its children (unless they explicitely set their own value for this property). | An Object variable of the class java.awt.Font
or a set of family, style and size, separated by commas. The style
must be one of plain,
bold, italic, bold | italic. Example: Monospaced,italic,18.
The default value is decided by the system. |
Tooltip | The text displayed when the cursor lingers on top of the element. | Any constant or variable of type String. |