Spec-Zone.ru › OpenJavaFX 24

Class Lighting

java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Lighting
public class Lighting extends Effect
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:

The visual effect of Lighting on text

Since:
JavaFX 2.0

Property Summary

Type Property Description
final ObjectProperty<Effect> bumpInput
The optional bump map input.
final ObjectProperty<Effect> contentInput
The content input for this Effect.
final DoubleProperty diffuseConstant
The diffuse constant.
final ObjectProperty<Light> light
The light source for this Lighting effect.
final DoubleProperty specularConstant
The specular constant.
final DoubleProperty specularExponent
The specular exponent.
final DoubleProperty surfaceScale
The surface scale factor.

Constructor Summary

Constructor 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

Modifier and Type Method Description
final ObjectProperty<Effect> bumpInputProperty()
The optional bump map input.
final ObjectProperty<Effect> contentInputProperty()
The content input for this Effect.
final DoubleProperty diffuseConstantProperty()
The diffuse constant.
final Effect getBumpInput()
Gets the value of the bumpInput property.
final Effect getContentInput()
Gets the value of the contentInput property.
final double getDiffuseConstant()
Gets the value of the diffuseConstant property.
final Light getLight()
Gets the value of the light property.
final double getSpecularConstant()
Gets the value of the specularConstant property.
final double getSpecularExponent()
Gets the value of the specularExponent property.
final double getSurfaceScale()
Gets the value of the surfaceScale property.
final ObjectProperty<Light> lightProperty()
The light source for this Lighting effect.
final void setBumpInput(Effect value)
Sets the value of the bumpInput property.
final void setContentInput(Effect value)
Sets the value of the contentInput property.
final void setDiffuseConstant(double value)
Sets the value of the diffuseConstant property.
final void setLight(Light value)
Sets the value of the light property.
final void setSpecularConstant(double value)
Sets the value of the specularConstant property.
final void setSpecularExponent(double value)
Sets the value of the specularExponent property.
final void setSurfaceScale(double value)
Sets the value of the surfaceScale property.
final DoubleProperty specularConstantProperty()
The specular constant.
final DoubleProperty specularExponentProperty()
The specular exponent.
final DoubleProperty surfaceScaleProperty()
The surface scale factor.

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Property Details

light

public final ObjectProperty<Light> lightProperty
The light source for this Lighting effect.
See Also:
  • getLight()
  • setLight(Light)
  • lightProperty()

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 to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used to generate a default bump map.
Default value:
a Shadow effect with a radius of 10
See Also:
  • getBumpInput()
  • setBumpInput(Effect)
  • bumpInputProperty()

contentInput

public final ObjectProperty<Effect> contentInputProperty
The content input for this Effect. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
See Also:
  • getContentInput()
  • setContentInput(Effect)
  • contentInputProperty()

diffuseConstant

public final DoubleProperty diffuseConstantProperty
The diffuse constant.
       Min: 0.0
       Max: 2.0
   Default: 1.0
  Identity: n/a
 
Default value:
1.0
See Also:
  • getDiffuseConstant()
  • setDiffuseConstant(double)
  • diffuseConstantProperty()

specularConstant

public final DoubleProperty specularConstantProperty
The specular constant.
       Min: 0.0
       Max: 2.0
   Default: 0.3
  Identity: n/a
 
Default value:
0.3
See Also:
  • getSpecularConstant()
  • setSpecularConstant(double)
  • specularConstantProperty()

specularExponent

public final DoubleProperty specularExponentProperty
The specular exponent.
       Min:  0.0
       Max: 40.0
   Default: 20.0
  Identity:  n/a
 
Default value:
20.0
See Also:
  • getSpecularExponent()
  • setSpecularExponent(double)
  • specularExponentProperty()

surfaceScale

public final DoubleProperty surfaceScaleProperty
The surface scale factor.
       Min:  0.0
       Max: 10.0
   Default:  1.5
  Identity:  n/a
 
Default value:
1.5
See Also:
  • getSurfaceScale()
  • setSurfaceScale(double)
  • surfaceScaleProperty()

Constructor Details

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 this Lighting effect
Since:
JavaFX 2.1

Method Details

setLight

public final void setLight(Light value)
Sets the value of the light property.
Property description:
The light source for this Lighting effect.
Parameters:
value - the value for the light property
See Also:
  • getLight()
  • lightProperty()

getLight

public final Light getLight()
Gets the value of the light property.
Property description:
The light source for this Lighting effect.
Returns:
the value of the light property
See Also:
  • setLight(Light)
  • lightProperty()

lightProperty

public final ObjectProperty<Light> lightProperty()
The light source for this Lighting effect.
Returns:
the light property
See Also:
  • getLight()
  • setLight(Light)

setBumpInput

public final void setBumpInput(Effect value)
Sets the value of the bumpInput 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 the Node to which the Effect 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 the bumpInput property
See Also:
  • getBumpInput()
  • bumpInputProperty()

getBumpInput

public final Effect getBumpInput()
Gets the value of the bumpInput 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 the Node to which the Effect 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:
  • setBumpInput(Effect)
  • bumpInputProperty()

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 to null, or left unspecified, a graphical image of the Node to which the Effect 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:
  • getBumpInput()
  • setBumpInput(Effect)

setContentInput

public final void setContentInput(Effect value)
Sets the value of the contentInput property.
Property description:
The content input for this Effect. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Parameters:
value - the value for the contentInput property
See Also:
  • getContentInput()
  • contentInputProperty()

getContentInput

public final Effect getContentInput()
Gets the value of the contentInput property.
Property description:
The content input for this Effect. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Returns:
the value of the contentInput property
See Also:
  • setContentInput(Effect)
  • contentInputProperty()

contentInputProperty

public final ObjectProperty<Effect> contentInputProperty()
The content input for this Effect. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Returns:
the contentInput property
See Also:
  • getContentInput()
  • setContentInput(Effect)

setDiffuseConstant

public final void setDiffuseConstant(double value)
Sets the value of the diffuseConstant 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 the diffuseConstant property
See Also:
  • getDiffuseConstant()
  • diffuseConstantProperty()

getDiffuseConstant

public final double getDiffuseConstant()
Gets the value of the diffuseConstant 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:
  • setDiffuseConstant(double)
  • diffuseConstantProperty()

diffuseConstantProperty

public final DoubleProperty 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:
  • getDiffuseConstant()
  • setDiffuseConstant(double)

setSpecularConstant

public final void setSpecularConstant(double value)
Sets the value of the specularConstant 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 the specularConstant property
See Also:
  • getSpecularConstant()
  • specularConstantProperty()

getSpecularConstant

public final double getSpecularConstant()
Gets the value of the specularConstant 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:
  • setSpecularConstant(double)
  • specularConstantProperty()

specularConstantProperty

public final DoubleProperty 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:
  • getSpecularConstant()
  • setSpecularConstant(double)

setSpecularExponent

public final void setSpecularExponent(double value)
Sets the value of the specularExponent 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 the specularExponent property
See Also:
  • getSpecularExponent()
  • specularExponentProperty()

getSpecularExponent

public final double getSpecularExponent()
Gets the value of the specularExponent 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:
  • setSpecularExponent(double)
  • specularExponentProperty()

specularExponentProperty

public final DoubleProperty 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:
  • getSpecularExponent()
  • setSpecularExponent(double)

setSurfaceScale

public final void setSurfaceScale(double value)
Sets the value of the surfaceScale 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 the surfaceScale property
See Also:
  • getSurfaceScale()
  • surfaceScaleProperty()

getSurfaceScale

public final double getSurfaceScale()
Gets the value of the surfaceScale 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:
  • setSurfaceScale(double)
  • surfaceScaleProperty()

surfaceScaleProperty

public final DoubleProperty 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:
  • getSurfaceScale()
  • setSurfaceScale(double)

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 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.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API