Spec-Zone.ru › OpenJavaFX 24

Class Light.Spot

java.lang.Object
javafx.scene.effect.Light
javafx.scene.effect.Light.Point
javafx.scene.effect.Light.Spot
Enclosing class:
Light
public static class Light.Spot extends Light.Point
Represents a spot light source at a given position in 3D space, with configurable direction and focus.

Example:


 Light.Spot light = new Light.Spot();
 light.setX(150);
 light.setY(100);
 light.setZ(80);
 light.setPointsAtX(0);
 light.setPointsAtY(0);
 light.setPointsAtZ(-50);
 light.setSpecularExponent(2);

 Lighting lighting = new Lighting();
 lighting.setLight(light);
 lighting.setSurfaceScale(5.0);

 Text text = new Text();
 text.setText("Spot");
 text.setFill(Color.STEELBLUE);
 text.setFont(Font.font(null, FontWeight.BOLD, 80));
 text.setX(10.0);
 text.setY(10.0);
 text.setTextOrigin(VPos.TOP);
 text.setEffect(lighting);

 Rectangle rect = new Rectangle(200, 150);
 rect.setFill(Color.ALICEBLUE);
 rect.setEffect(lighting);
 

The code above produces the following:

The visual effect of spot Light
 on text

Since:
JavaFX 2.0

Nested Class Summary

Nested classes/interfaces declared in class javafx.scene.effect.Light

Light.Distant, Light.Point, Light.Spot

Property Summary

Type Property Description
final DoubleProperty pointsAtX
The x coordinate of the direction vector for this light.
final DoubleProperty pointsAtY
The y coordinate of the direction vector for this light.
final DoubleProperty pointsAtZ
The z coordinate of the direction vector for this light.
final DoubleProperty specularExponent
The specular exponent, which controls the focus of this light source.

Properties declared in class javafx.scene.effect.Light.Point

x, y, z

Properties declared in class javafx.scene.effect.Light

color

Constructor Summary

Constructor Description
Spot()
Creates a new instance of Spot light with default parameters.
Spot(double x, double y, double z, double specularExponent, Color color)
Creates a new instance of Spot light with the specified x, y, z, specularExponent, and color.

Method Summary

Modifier and Type Method Description
final double getPointsAtX()
Gets the value of the pointsAtX property.
final double getPointsAtY()
Gets the value of the pointsAtY property.
final double getPointsAtZ()
Gets the value of the pointsAtZ property.
final double getSpecularExponent()
Gets the value of the specularExponent property.
final DoubleProperty pointsAtXProperty()
The x coordinate of the direction vector for this light.
final DoubleProperty pointsAtYProperty()
The y coordinate of the direction vector for this light.
final DoubleProperty pointsAtZProperty()
The z coordinate of the direction vector for this light.
final void setPointsAtX(double value)
Sets the value of the pointsAtX property.
final void setPointsAtY(double value)
Sets the value of the pointsAtY property.
final void setPointsAtZ(double value)
Sets the value of the pointsAtZ property.
final void setSpecularExponent(double value)
Sets the value of the specularExponent property.
final DoubleProperty specularExponentProperty()
The specular exponent, which controls the focus of this light source.

Methods declared in class javafx.scene.effect.Light.Point

getX, getY, getZ, setX, setY, setZ, xProperty, yProperty, zProperty

Methods declared in class javafx.scene.effect.Light

colorProperty, getColor, setColor

Methods declared in class java.lang.Object

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

Property Details

pointsAtX

public final DoubleProperty pointsAtXProperty
The x coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
See Also:
  • getPointsAtX()
  • setPointsAtX(double)
  • pointsAtXProperty()

pointsAtY

public final DoubleProperty pointsAtYProperty
The y coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
See Also:
  • getPointsAtY()
  • setPointsAtY(double)
  • pointsAtYProperty()

pointsAtZ

public final DoubleProperty pointsAtZProperty
The z coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
See Also:
  • getPointsAtZ()
  • setPointsAtZ(double)
  • pointsAtZProperty()

specularExponent

public final DoubleProperty specularExponentProperty
The specular exponent, which controls the focus of this light source.
       Min: 0.0
       Max: 4.0
   Default: 1.0
  Identity: 1.0
 
Default value:
1.0
See Also:
  • getSpecularExponent()
  • setSpecularExponent(double)
  • specularExponentProperty()

Constructor Details

Spot

public Spot()
Creates a new instance of Spot light with default parameters.

Spot

public Spot(double x, double y, double z, double specularExponent, Color color)
Creates a new instance of Spot light with the specified x, y, z, specularExponent, and color.
Parameters:
x - the x coordinate of the light position
y - the y coordinate of the light position
z - the z coordinate of the light position
specularExponent - the specular exponent, which controls the focus of the light source
color - the color of the light
Since:
JavaFX 2.1

Method Details

setPointsAtX

public final void setPointsAtX(double value)
Sets the value of the pointsAtX property.
Property description:
The x coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Parameters:
value - the value for the pointsAtX property
See Also:
  • getPointsAtX()
  • pointsAtXProperty()

getPointsAtX

public final double getPointsAtX()
Gets the value of the pointsAtX property.
Property description:
The x coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Returns:
the value of the pointsAtX property
See Also:
  • setPointsAtX(double)
  • pointsAtXProperty()

pointsAtXProperty

public final DoubleProperty pointsAtXProperty()
The x coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Returns:
the pointsAtX property
See Also:
  • getPointsAtX()
  • setPointsAtX(double)

setPointsAtY

public final void setPointsAtY(double value)
Sets the value of the pointsAtY property.
Property description:
The y coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Parameters:
value - the value for the pointsAtY property
See Also:
  • getPointsAtY()
  • pointsAtYProperty()

getPointsAtY

public final double getPointsAtY()
Gets the value of the pointsAtY property.
Property description:
The y coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Returns:
the value of the pointsAtY property
See Also:
  • setPointsAtY(double)
  • pointsAtYProperty()

pointsAtYProperty

public final DoubleProperty pointsAtYProperty()
The y coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Returns:
the pointsAtY property
See Also:
  • getPointsAtY()
  • setPointsAtY(double)

setPointsAtZ

public final void setPointsAtZ(double value)
Sets the value of the pointsAtZ property.
Property description:
The z coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Parameters:
value - the value for the pointsAtZ property
See Also:
  • getPointsAtZ()
  • pointsAtZProperty()

getPointsAtZ

public final double getPointsAtZ()
Gets the value of the pointsAtZ property.
Property description:
The z coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Returns:
the value of the pointsAtZ property
See Also:
  • setPointsAtZ(double)
  • pointsAtZProperty()

pointsAtZProperty

public final DoubleProperty pointsAtZProperty()
The z coordinate of the direction vector for this light.
       Min: n/a
       Max: n/a
   Default: 0.0
  Identity: n/a
 
Default value:
0.0
Returns:
the pointsAtZ property
See Also:
  • getPointsAtZ()
  • setPointsAtZ(double)

setSpecularExponent

public final void setSpecularExponent(double value)
Sets the value of the specularExponent property.
Property description:
The specular exponent, which controls the focus of this light source.
       Min: 0.0
       Max: 4.0
   Default: 1.0
  Identity: 1.0
 
Default value:
1.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, which controls the focus of this light source.
       Min: 0.0
       Max: 4.0
   Default: 1.0
  Identity: 1.0
 
Default value:
1.0
Returns:
the value of the specularExponent property
See Also:
  • setSpecularExponent(double)
  • specularExponentProperty()

specularExponentProperty

public final DoubleProperty specularExponentProperty()
The specular exponent, which controls the focus of this light source.
       Min: 0.0
       Max: 4.0
   Default: 1.0
  Identity: 1.0
 
Default value:
1.0
Returns:
the specularExponent property
See Also:
  • getSpecularExponent()
  • setSpecularExponent(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