Class Lighting
- javafx.scene.effect.Effect
-
- javafx.scene.effect.Lighting
public class Lighting extends Effect
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
All MethodsInstance MethodsConcrete Methods Type Property and Description ObjectProperty<Effect>bumpInputThe optional bump map input.ObjectProperty<Effect>contentInputThe content input for thisEffect.DoublePropertydiffuseConstantThe diffuse constant.ObjectProperty<Light>lightThe light source for thisLightingeffect.DoublePropertyspecularConstantThe specular constant.DoublePropertyspecularExponentThe specular exponent.DoublePropertysurfaceScaleThe surface scale factor.
-
Constructor Summary
Constructors Constructor and Description Lighting()Creates a new instance of Lighting with default parameters.Lighting(Light light)Creates a new instance of Lighting with the specified light.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description ObjectProperty<Effect>bumpInputProperty()The optional bump map input.ObjectProperty<Effect>contentInputProperty()The content input for thisEffect.DoublePropertydiffuseConstantProperty()The diffuse constant.EffectgetBumpInput()Gets the value of the property bumpInput.EffectgetContentInput()Gets the value of the property contentInput.doublegetDiffuseConstant()Gets the value of the property diffuseConstant.LightgetLight()Gets the value of the property light.doublegetSpecularConstant()Gets the value of the property specularConstant.doublegetSpecularExponent()Gets the value of the property specularExponent.doublegetSurfaceScale()Gets the value of the property surfaceScale.ObjectProperty<Light>lightProperty()The light source for thisLightingeffect.voidsetBumpInput(Effect value)Sets the value of the property bumpInput.voidsetContentInput(Effect value)Sets the value of the property contentInput.voidsetDiffuseConstant(double value)Sets the value of the property diffuseConstant.voidsetLight(Light value)Sets the value of the property light.voidsetSpecularConstant(double value)Sets the value of the property specularConstant.voidsetSpecularExponent(double value)Sets the value of the property specularExponent.voidsetSurfaceScale(double value)Sets the value of the property surfaceScale.DoublePropertyspecularConstantProperty()The specular constant.DoublePropertyspecularExponentProperty()The specular exponent.DoublePropertysurfaceScaleProperty()The surface scale factor.
-
Property Detail
-
light
public final ObjectProperty<Light> lightProperty
The light source for thisLightingeffect.See Also:
-
bumpInput
public final ObjectProperty<Effect> 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 theNodeto which theEffectis attached will be used to generate a default bump map.Default value:
a Shadow effect with a radius of 10
See Also:
-
contentInput
public final ObjectProperty<Effect> contentInputProperty
The content input for thisEffect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.Default value:
null
See Also:
-
diffuseConstant
public final DoubleProperty diffuseConstantProperty
The diffuse constant.Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/aDefault value:
1.0
See Also:
-
specularConstant
public final DoubleProperty specularConstantProperty
The specular constant.Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/aDefault value:
0.3
See Also:
-
specularExponent
public final DoubleProperty specularExponentProperty
The specular exponent.Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/aDefault value:
20.0
See Also:
-
surfaceScale
public final DoubleProperty surfaceScaleProperty
The surface scale factor.Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/aDefault value:
1.5
See Also:
-
-
Constructor Detail
-
Lighting
public Lighting()
Creates a new instance of Lighting with default parameters.
-
Lighting
public Lighting(Light light)
Creates a new instance of Lighting with the specified light.Parameters:
light- the light source for thisLightingeffectSince:
JavaFX 2.1
-
-
Method Detail
-
setLight
public final void setLight(Light value)
Sets the value of the property light.Property description:
The light source for this
Lightingeffect.
-
getLight
public final Light getLight()
Gets the value of the property light.Property description:
The light source for this
Lightingeffect.
-
lightProperty
public final ObjectProperty<Light> lightProperty()
The light source for thisLightingeffect.See Also:
-
setBumpInput
public final void setBumpInput(Effect value)
Sets the value of the property bumpInput.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 theNodeto which theEffectis attached will be used to generate a default bump map.Default value:
a Shadow effect with a radius of 10
-
getBumpInput
public final Effect getBumpInput()
Gets the value of the property bumpInput.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 theNodeto which theEffectis attached will be used to generate a default bump map.Default value:
a Shadow effect with a radius of 10
-
bumpInputProperty
public final ObjectProperty<Effect> 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 theNodeto which theEffectis attached will be used to generate a default bump map.Default value:
a Shadow effect with a radius of 10
See Also:
-
setContentInput
public final void setContentInput(Effect value)
Sets the value of the property contentInput.Property description:
The content input for this
Effect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.Default value:
null
-
getContentInput
public final Effect getContentInput()
Gets the value of the property contentInput.Property description:
The content input for this
Effect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.Default value:
null
-
contentInputProperty
public final ObjectProperty<Effect> contentInputProperty()
The content input for thisEffect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.Default value:
null
See Also:
-
setDiffuseConstant
public final void setDiffuseConstant(double value)
Sets the value of the property diffuseConstant.Property description:
The diffuse constant.
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/aDefault value:
1.0
-
getDiffuseConstant
public final double getDiffuseConstant()
Gets the value of the property diffuseConstant.Property description:
The diffuse constant.
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/aDefault value:
1.0
-
diffuseConstantProperty
public final DoubleProperty diffuseConstantProperty()
The diffuse constant.Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/aDefault value:
1.0
See Also:
-
setSpecularConstant
public final void setSpecularConstant(double value)
Sets the value of the property specularConstant.Property description:
The specular constant.
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/aDefault value:
0.3
-
getSpecularConstant
public final double getSpecularConstant()
Gets the value of the property specularConstant.Property description:
The specular constant.
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/aDefault value:
0.3
-
specularConstantProperty
public final DoubleProperty specularConstantProperty()
The specular constant.Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/aDefault value:
0.3
See Also:
-
setSpecularExponent
public final void setSpecularExponent(double value)
Sets the value of the property specularExponent.Property description:
The specular exponent.
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/aDefault value:
20.0
-
getSpecularExponent
public final double getSpecularExponent()
Gets the value of the property specularExponent.Property description:
The specular exponent.
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/aDefault value:
20.0
-
specularExponentProperty
public final DoubleProperty specularExponentProperty()
The specular exponent.Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/aDefault value:
20.0
See Also:
-
setSurfaceScale
public final void setSurfaceScale(double value)
Sets the value of the property surfaceScale.Property description:
The surface scale factor.
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/aDefault value:
1.5
-
getSurfaceScale
public final double getSurfaceScale()
Gets the value of the property surfaceScale.Property description:
The surface scale factor.
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/aDefault value:
1.5
-
surfaceScaleProperty
public final DoubleProperty surfaceScaleProperty()
The surface scale factor.Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/aDefault value:
1.5
See Also:
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.