java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Lighting
An effect that simulates a light source shining on the given content,
which can be used to give flat objects a more realistic, three-dimensional
appearance.
Example:
Light.Distant light = new Light.Distant();
light.setAzimuth(-135.0);
Lighting lighting = new Lighting();
lighting.setLight(light);
lighting.setSurfaceScale(5.0);
Text text = new Text();
text.setText("JavaFX!");
text.setFill(Color.STEELBLUE);
text.setFont(Font.font(null, FontWeight.BOLD, 60));
text.setX(10.0);
text.setY(10.0);
text.setTextOrigin(VPos.TOP);
text.setEffect(lighting);
The code above produces the following:
- Since:
- JavaFX 2.0
-
Property Summary
TypePropertyDescriptionfinal ObjectProperty<Effect>
The optional bump map input.final ObjectProperty<Effect>
The content input for thisEffect
.final DoubleProperty
The diffuse constant.final ObjectProperty<Light>
The light source for thisLighting
effect.final DoubleProperty
The specular constant.final DoubleProperty
The specular exponent.final DoubleProperty
The surface scale factor. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty<Effect>
The optional bump map input.final ObjectProperty<Effect>
The content input for thisEffect
.final DoubleProperty
The diffuse constant.final Effect
Gets the value of thebumpInput
property.final Effect
Gets the value of thecontentInput
property.final double
Gets the value of thediffuseConstant
property.final Light
getLight()
Gets the value of thelight
property.final double
Gets the value of thespecularConstant
property.final double
Gets the value of thespecularExponent
property.final double
Gets the value of thesurfaceScale
property.final ObjectProperty<Light>
The light source for thisLighting
effect.final void
setBumpInput
(Effect value) Sets the value of thebumpInput
property.final void
setContentInput
(Effect value) Sets the value of thecontentInput
property.final void
setDiffuseConstant
(double value) Sets the value of thediffuseConstant
property.final void
Sets the value of thelight
property.final void
setSpecularConstant
(double value) Sets the value of thespecularConstant
property.final void
setSpecularExponent
(double value) Sets the value of thespecularExponent
property.final void
setSurfaceScale
(double value) Sets the value of thesurfaceScale
property.final DoubleProperty
The specular constant.final DoubleProperty
The specular exponent.final DoubleProperty
The surface scale factor.
-
Property Details
-
light
The light source for thisLighting
effect.- See Also:
-
bumpInput
The optional bump map input. If not specified, a bump map will be automatically generated from the default input. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map.- Default value:
- a Shadow effect with a radius of 10
- See Also:
-
contentInput
The content input for thisEffect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- See Also:
-
diffuseConstant
The diffuse constant.Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
- See Also:
-
specularConstant
The specular constant.Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
- See Also:
-
specularExponent
The specular exponent.Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
- See Also:
-
surfaceScale
The surface scale factor.Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
- See Also:
-
-
Constructor Details
-
Lighting
public Lighting()Creates a new instance of Lighting with default parameters. -
Lighting
Creates a new instance of Lighting with the specified light.- Parameters:
light
- the light source for thisLighting
effect- Since:
- JavaFX 2.1
-
-
Method Details
-
setLight
Sets the value of thelight
property.- Property description:
- The light source for this
Lighting
effect. - Parameters:
value
- the value for thelight
property- See Also:
-
getLight
Gets the value of thelight
property.- Property description:
- The light source for this
Lighting
effect. - Returns:
- the value of the
light
property - See Also:
-
lightProperty
The light source for thisLighting
effect.- Returns:
- the
light
property - See Also:
-
setBumpInput
Sets the value of thebumpInput
property.- Property description:
- The optional bump map input.
If not specified, a bump map will be automatically generated
from the default input.
If set to
null
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map. - Default value:
- a Shadow effect with a radius of 10
- Parameters:
value
- the value for thebumpInput
property- See Also:
-
getBumpInput
Gets the value of thebumpInput
property.- Property description:
- The optional bump map input.
If not specified, a bump map will be automatically generated
from the default input.
If set to
null
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map. - Default value:
- a Shadow effect with a radius of 10
- Returns:
- the value of the
bumpInput
property - See Also:
-
bumpInputProperty
The optional bump map input. If not specified, a bump map will be automatically generated from the default input. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map.- Default value:
- a Shadow effect with a radius of 10
- Returns:
- the
bumpInput
property - See Also:
-
setContentInput
Sets the value of thecontentInput
property.- Property description:
- The content input for this
Effect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Parameters:
value
- the value for thecontentInput
property- See Also:
-
getContentInput
Gets the value of thecontentInput
property.- Property description:
- The content input for this
Effect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Returns:
- the value of the
contentInput
property - See Also:
-
contentInputProperty
The content input for thisEffect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- Returns:
- the
contentInput
property - See Also:
-
setDiffuseConstant
public final void setDiffuseConstant(double value) Sets the value of thediffuseConstant
property.- Property description:
- The diffuse constant.
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
- Parameters:
value
- the value for thediffuseConstant
property- See Also:
-
getDiffuseConstant
public final double getDiffuseConstant()Gets the value of thediffuseConstant
property.- Property description:
- The diffuse constant.
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
- Returns:
- the value of the
diffuseConstant
property - See Also:
-
diffuseConstantProperty
The diffuse constant.Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
- Returns:
- the
diffuseConstant
property - See Also:
-
setSpecularConstant
public final void setSpecularConstant(double value) Sets the value of thespecularConstant
property.- Property description:
- The specular constant.
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
- Parameters:
value
- the value for thespecularConstant
property- See Also:
-
getSpecularConstant
public final double getSpecularConstant()Gets the value of thespecularConstant
property.- Property description:
- The specular constant.
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
- Returns:
- the value of the
specularConstant
property - See Also:
-
specularConstantProperty
The specular constant.Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
- Returns:
- the
specularConstant
property - See Also:
-
setSpecularExponent
public final void setSpecularExponent(double value) Sets the value of thespecularExponent
property.- Property description:
- The specular exponent.
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
- Parameters:
value
- the value for thespecularExponent
property- See Also:
-
getSpecularExponent
public final double getSpecularExponent()Gets the value of thespecularExponent
property.- Property description:
- The specular exponent.
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
- Returns:
- the value of the
specularExponent
property - See Also:
-
specularExponentProperty
The specular exponent.Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
- Returns:
- the
specularExponent
property - See Also:
-
setSurfaceScale
public final void setSurfaceScale(double value) Sets the value of thesurfaceScale
property.- Property description:
- The surface scale factor.
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
- Parameters:
value
- the value for thesurfaceScale
property- See Also:
-
getSurfaceScale
public final double getSurfaceScale()Gets the value of thesurfaceScale
property.- Property description:
- The surface scale factor.
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
- Returns:
- the value of the
surfaceScale
property - See Also:
-
surfaceScaleProperty
The surface scale factor.Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
- Returns:
- the
surfaceScale
property - See Also:
-