Top Description Inners Fields Constructors Methods
javafx.scene.effect

public abstract Class Light

extends Object
Class Inheritance
Known Direct Subclasses
javafx.scene.effect.Light.Distant, javafx.scene.effect.Light.Point
Imports
javafx.beans.property.BooleanProperty, .DoubleProperty, .DoublePropertyBase, .ObjectProperty, .ObjectPropertyBase, .SimpleBooleanProperty, javafx.scene.paint.Color, com.sun.javafx.util.Utils, com.sun.javafx.tk.Toolkit

The abstract base class for all light implementations.
Since
JavaFX 2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Light.Distant

Represents a distant light source.

public static class
Light.Point

Represents a light source at a given position in 3D space.

public static class
Light.Spot

Represents a spot light source at a given position in 3D space, with configurable direction and focus.

Field Summary

Modifier and TypeField and Description
private ObjectProperty<Color>
color

The color of the light source.

private BooleanProperty
private Light

Constructor Summary

AccessConstructor and Description
protected
Light()

Creates a new Light.

Method Summary

Modifier and TypeMethod and Description
pack-priv final void
public final ObjectProperty<Color>
pack-priv abstract Light
pack-priv final BooleanProperty
public final Color
private Color
pack-priv Light
pack-priv boolean
pack-priv final void
public final void
setColor(Color value)

private void
setEffectDirty(boolean value)

pack-priv void
sync()

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

colorback to summary
private ObjectProperty<Color> color

The color of the light source.

      Min: n/a
      Max: n/a
  Default: Color.WHITE
 Identity: n/a
Default Value
WHITE
effectDirtyback to summary
private BooleanProperty effectDirty
peerback to summary
private Light peer

Constructor Detail

Lightback to summary
protected Light()

Creates a new Light.

Method Detail

clearDirtyback to summary
pack-priv final void clearDirty()
colorPropertyback to summary
public final ObjectProperty<Color> colorProperty()
createPeerback to summary
pack-priv abstract Light createPeer()
effectDirtyPropertyback to summary
pack-priv final BooleanProperty effectDirtyProperty()
getColorback to summary
public final Color getColor()
getColorInternalback to summary
private Color getColorInternal()
getPeerback to summary
pack-priv Light getPeer()
isEffectDirtyback to summary
pack-priv boolean isEffectDirty()
markDirtyback to summary
pack-priv final void markDirty()
setColorback to summary
public final void setColor(Color value)
setEffectDirtyback to summary
private void setEffectDirty(boolean value)
syncback to summary
pack-priv void sync()
updateback to summary
pack-priv void update()
javafx.scene.effect back to summary

public Class Light.Distant

extends Light
Class Inheritance

Represents a distant light source.

Example:

Light.Distant light = new Light.Distant();
light.setAzimuth(45.0);
light.setElevation(30.0);

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

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

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

The code above produces the following:

The visual effect of distant
Light on text

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private DoubleProperty
azimuth

The azimuth of the light.

private DoubleProperty
elevation

The elevation of the light.

Constructor Summary

AccessConstructor and Description
public
Distant()

Creates a new instance of Distant light with default parameters.

public
Distant(double
the azimuth of the light
azimuth
,
double
the elevation of the light
elevation
,
Color
the color of the light
color
)

Creates a new instance of Distant light with the specified azimuth, elevation, and color.

Method Summary

Modifier and TypeMethod and Description
public final DoubleProperty
pack-priv DistantLight
public final DoubleProperty
public final double
public final double
public final void
setAzimuth(double value)

public final void
setElevation(double value)

pack-priv void
Inherited from javafx.scene.effect.Light:
clearDirtycolorPropertyeffectDirtyPropertygetColorgetPeerisEffectDirtymarkDirtysetColorsync

Field Detail

azimuthback to summary
private DoubleProperty azimuth

The azimuth of the light. The azimuth is the direction angle for the light source on the XY plane, in degrees.

      Min:  n/a
      Max:  n/a
  Default: 45.0
 Identity:  n/a
Default Value
45.0
elevationback to summary
private DoubleProperty elevation

The elevation of the light. The elevation is the direction angle for the light source on the YZ plane, in degrees.

      Min:  n/a
      Max:  n/a
  Default: 45.0
 Identity:  n/a
Default Value
45.0

Constructor Detail

Distantback to summary
public Distant()

Creates a new instance of Distant light with default parameters.

Distantback to summary
public Distant(double azimuth, double elevation, Color color)

Creates a new instance of Distant light with the specified azimuth, elevation, and color.

Parameters
azimuth:double

the azimuth of the light

elevation:double

the elevation of the light

color:Color

the color of the light

Since
JavaFX 2.1

Method Detail

azimuthPropertyback to summary
public final DoubleProperty azimuthProperty()
createPeerback to summary
pack-priv DistantLight createPeer()

Implements abstract javafx.scene.effect.Light.createPeer.

Annotations
@Override
elevationPropertyback to summary
public final DoubleProperty elevationProperty()
getAzimuthback to summary
public final double getAzimuth()
getElevationback to summary
public final double getElevation()
setAzimuthback to summary
public final void setAzimuth(double value)
setElevationback to summary
public final void setElevation(double value)
updateback to summary
pack-priv void update()

Overrides javafx.scene.effect.Light.update.

Annotations
@Override
javafx.scene.effect back to summary

public Class Light.Point

extends Light
Class Inheritance
Known Direct Subclasses
javafx.scene.effect.Light.Spot

Represents a light source at a given position in 3D space.

Example:

Light.Point light = new Light.Point();
light.setX(100);
light.setY(100);
light.setZ(50);

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

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

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

The code above produces the following:

The visual effect of point
Light on text

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private DoubleProperty
x

The x coordinate of the light position.

private DoubleProperty
y

The y coordinate of the light position.

private DoubleProperty
z

The z coordinate of the light position.

Constructor Summary

AccessConstructor and Description
public
Point()

Creates a new instance of Point light with default parameters.

public
Point(double
the x coordinate of the light position
x
,
double
the y coordinate of the light position
y
,
double
the z coordinate of the light position
z
,
Color
the color of the light
color
)

Creates a new instance of Point light with the specified x, y, x, and color.

Method Summary

Modifier and TypeMethod and Description
pack-priv PointLight
public final double
getX()

public final double
getY()

public final double
getZ()

public final void
setX(double value)

public final void
setY(double value)

public final void
setZ(double value)

pack-priv void
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
Inherited from javafx.scene.effect.Light:
clearDirtycolorPropertyeffectDirtyPropertygetColorgetPeerisEffectDirtymarkDirtysetColorsync

Field Detail

xback to summary
private DoubleProperty x

The x coordinate of the light position.

      Min: n/a
      Max: n/a
  Default: 0.0
 Identity: n/a
Default Value
0.0
yback to summary
private DoubleProperty y

The y coordinate of the light position.

      Min: n/a
      Max: n/a
  Default: 0.0
 Identity: n/a
Default Value
0.0
zback to summary
private DoubleProperty z

The z coordinate of the light position.

      Min: n/a
      Max: n/a
  Default: 0.0
 Identity: n/a
Default Value
0.0

Constructor Detail

Pointback to summary
public Point()

Creates a new instance of Point light with default parameters.

Pointback to summary
public Point(double x, double y, double z, Color color)

Creates a new instance of Point light with the specified x, y, x, and color.

Parameters
x:double

the x coordinate of the light position

y:double

the y coordinate of the light position

z:double

the z coordinate of the light position

color:Color

the color of the light

Since
JavaFX 2.1

Method Detail

createPeerback to summary
pack-priv PointLight createPeer()

Implements abstract javafx.scene.effect.Light.createPeer.

Annotations
@Override
getXback to summary
public final double getX()
getYback to summary
public final double getY()
getZback to summary
public final double getZ()
setXback to summary
public final void setX(double value)
setYback to summary
public final void setY(double value)
setZback to summary
public final void setZ(double value)
updateback to summary
pack-priv void update()

Overrides javafx.scene.effect.Light.update.

Annotations
@Override
xPropertyback to summary
public final DoubleProperty xProperty()
yPropertyback to summary
public final DoubleProperty yProperty()
zPropertyback to summary
public final DoubleProperty zProperty()
javafx.scene.effect back to summary

public Class Light.Spot

extends Point
Class Inheritance

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

Field Summary

Modifier and TypeField and Description
private DoubleProperty
pointsAtX

The x coordinate of the direction vector for this light.

private DoubleProperty
pointsAtY

The y coordinate of the direction vector for this light.

private DoubleProperty
pointsAtZ

The z coordinate of the direction vector for this light.

private DoubleProperty
specularExponent

The specular exponent, which controls the focus of this light source.

Constructor Summary

AccessConstructor and Description
public
Spot()

Creates a new instance of Spot light with default parameters.

public
Spot(double
the x coordinate of the light position
x
,
double
the y coordinate of the light position
y
,
double
the z coordinate of the light position
z
,
double
the specular exponent, which controls the focus of the light source
specularExponent
,
Color
the color of the light
color
)

Creates a new instance of Spot light with the specified x, y, z, specularExponent, and color.

Method Summary

Modifier and TypeMethod and Description
pack-priv SpotLight
public final double
public final double
public final double
public final double
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final void
setPointsAtX(double value)

public final void
setPointsAtY(double value)

public final void
setPointsAtZ(double value)

public final void
setSpecularExponent(double value)

public final DoubleProperty
pack-priv void
Inherited from javafx.scene.effect.Light.Point:
getXgetYgetZsetXsetYsetZxPropertyyPropertyzProperty

Field Detail

pointsAtXback to summary
private DoubleProperty pointsAtX

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
pointsAtYback to summary
private DoubleProperty pointsAtY

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
pointsAtZback to summary
private DoubleProperty pointsAtZ

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
specularExponentback to summary
private DoubleProperty specularExponent

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

Constructor Detail

Spotback to summary
public Spot()

Creates a new instance of Spot light with default parameters.

Spotback to summary
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:double

the x coordinate of the light position

y:double

the y coordinate of the light position

z:double

the z coordinate of the light position

specularExponent:double

the specular exponent, which controls the focus of the light source

color:Color

the color of the light

Since
JavaFX 2.1

Method Detail

createPeerback to summary
pack-priv SpotLight createPeer()

Overrides javafx.scene.effect.Light.Point.createPeer.

Annotations
@Override
getPointsAtXback to summary
public final double getPointsAtX()
getPointsAtYback to summary
public final double getPointsAtY()
getPointsAtZback to summary
public final double getPointsAtZ()
getSpecularExponentback to summary
public final double getSpecularExponent()
pointsAtXPropertyback to summary
public final DoubleProperty pointsAtXProperty()
pointsAtYPropertyback to summary
public final DoubleProperty pointsAtYProperty()
pointsAtZPropertyback to summary
public final DoubleProperty pointsAtZProperty()
setPointsAtXback to summary
public final void setPointsAtX(double value)
setPointsAtYback to summary
public final void setPointsAtY(double value)
setPointsAtZback to summary
public final void setPointsAtZ(double value)
setSpecularExponentback to summary
public final void setSpecularExponent(double value)
specularExponentPropertyback to summary
public final DoubleProperty specularExponentProperty()
updateback to summary
pack-priv void update()

Overrides javafx.scene.effect.Light.Point.update.

Annotations
@Override