Class Shadow
java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Shadow
public class Shadow extends Effect
An effect which creates a monochrome duplicate of an input with blurry edges. This effect is primarily used along with its default black color for purposes of combining it with the original to create a shadow. It can also be used with a light color and combined with an original to create a glow effect. The
DropShadow effect is a utility effect which automatically combines this Shadow effect with an original graphic for ease of adding a shadow to an existing scene graph Node with a single effect.- Since:
- JavaFX 2.0
Property Summary
| Type | Property | Description |
|---|---|---|
final ObjectProperty |
blurType |
The algorithm used to blur the shadow. |
final ObjectProperty |
color |
The shadow Color. |
final DoubleProperty |
height |
The vertical size of the shadow blur kernel. |
final ObjectProperty |
input |
The input for this Effect. |
final DoubleProperty |
radius |
The radius of the shadow blur kernel. |
final DoubleProperty |
width |
The horizontal size of the shadow blur kernel. |
Constructor Summary
| Constructor | Description |
|---|---|
Shadow() |
Creates a new instance of Shadow with default parameters. |
Shadow |
Creates a new instance of Shadow with specified radius and color. |
Shadow |
Creates a new instance of Shadow with the specified blurType, color, radius. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final ObjectProperty |
blurTypeProperty() |
The algorithm used to blur the shadow. |
final ObjectProperty |
colorProperty() |
The shadow Color. |
final BlurType |
getBlurType() |
Gets the value of the blurType property. |
final Color |
getColor() |
Gets the value of the color property. |
final double |
getHeight() |
Gets the value of the height property. |
final Effect |
getInput() |
Gets the value of the input property. |
final double |
getRadius() |
Gets the value of the radius property. |
final double |
getWidth() |
Gets the value of the width property. |
final DoubleProperty |
heightProperty() |
The vertical size of the shadow blur kernel. |
final ObjectProperty |
inputProperty() |
The input for this Effect. |
final DoubleProperty |
radiusProperty() |
The radius of the shadow blur kernel. |
final void |
setBlurType |
Sets the value of the blurType property. |
final void |
setColor |
Sets the value of the color property. |
final void |
setHeight |
Sets the value of the height property. |
final void |
setInput |
Sets the value of the input property. |
final void |
setRadius |
Sets the value of the radius property. |
final void |
setWidth |
Sets the value of the width property. |
final DoubleProperty |
widthProperty() |
The horizontal size of the shadow blur kernel. |
Property Details
input
public final ObjectProperty<Effect> inputProperty
The 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:
radius
public final DoubleProperty radiusProperty
The radius of the shadow blur kernel. This attribute controls the distance that the shadow is spread to each side of the source pixels. Setting the radius is equivalent to setting both the
width and height attributes to a value of (2 * radius + 1).
Min: 0.0
Max: 127.0
Default: 10.0
Identity: 0.0
- Default value:
- 10.0
- See Also:
width
public final DoubleProperty widthProperty
The horizontal size of the shadow blur kernel. This attribute controls the horizontal size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0 are not distributed beyond the original pixel and so have no blurring effect on the shadow.
Min: 0.0
Max: 255.0
Default: 21.0
Identity: <1.0
- Default value:
- 21.0
- See Also:
height
public final DoubleProperty heightProperty
The vertical size of the shadow blur kernel. This attribute controls the vertical size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0 are not distributed beyond the original pixel and so have no blurring effect on the shadow.
Min: 0.0
Max: 255.0
Default: 21.0
Identity: <1.0
- Default value:
- 21.0
- See Also:
blurType
public final ObjectProperty<BlurType> blurTypeProperty
The algorithm used to blur the shadow.
Min: n/a
Max: n/a
Default: BlurType.THREE_PASS_BOX
Identity: n/a
- Default value:
- THREE_PASS_BOX
- See Also:
color
public final ObjectProperty<Color> colorProperty
The shadow
Color.
Min: n/a
Max: n/a
Default: Color.BLACK
Identity: n/a
- Default value:
- BLACK
- See Also:
Constructor Details
Shadow
public Shadow()
Creates a new instance of Shadow with default parameters.
Shadow
public Shadow(double radius, Color color)
Creates a new instance of Shadow with specified radius and color.
- Parameters:
-
radius- the radius of the shadow blur kernel -
color- the shadowColor - Since:
- JavaFX 2.1
Shadow
public Shadow(BlurType blurType, Color color, double radius)
Creates a new instance of Shadow with the specified blurType, color, radius.
- Parameters:
-
blurType- the algorithm used to blur the shadow -
color- the shadowColor -
radius- the radius of the shadow blur kernel - Since:
- JavaFX 2.1
Method Details
setInput
public final void setInput(Effect value)
Sets the value of the
input property.- Property description:
- The 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
- Parameters:
-
value- the value for theinputproperty - See Also:
getInput
public final Effect getInput()
Gets the value of the
input property.- Property description:
- The 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
- Returns:
- the value of the
inputproperty - See Also:
inputProperty
public final ObjectProperty<Effect> inputProperty()
The 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
inputproperty - See Also:
setRadius
public final void setRadius(double value)
Sets the value of the
radius property.- Property description:
- The radius of the shadow blur kernel. This attribute controls the distance that the shadow is spread to each side of the source pixels. Setting the radius is equivalent to setting both the
widthandheightattributes to a value of(2 * radius + 1).Min: 0.0 Max: 127.0 Default: 10.0 Identity: 0.0 - Default value:
- 10.0
- Parameters:
-
value- the value for theradiusproperty - See Also:
getRadius
public final double getRadius()
Gets the value of the
radius property.- Property description:
- The radius of the shadow blur kernel. This attribute controls the distance that the shadow is spread to each side of the source pixels. Setting the radius is equivalent to setting both the
widthandheightattributes to a value of(2 * radius + 1).Min: 0.0 Max: 127.0 Default: 10.0 Identity: 0.0 - Default value:
- 10.0
- Returns:
- the value of the
radiusproperty - See Also:
radiusProperty
public final DoubleProperty radiusProperty()
The radius of the shadow blur kernel. This attribute controls the distance that the shadow is spread to each side of the source pixels. Setting the radius is equivalent to setting both the
width and height attributes to a value of (2 * radius + 1).
Min: 0.0
Max: 127.0
Default: 10.0
Identity: 0.0
- Default value:
- 10.0
- Returns:
- the
radiusproperty - See Also:
setWidth
public final void setWidth(double value)
Sets the value of the
width property.- Property description:
- The horizontal size of the shadow blur kernel. This attribute controls the horizontal size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0are not distributed beyond the original pixel and so have no blurring effect on the shadow.Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0 - Default value:
- 21.0
- Parameters:
-
value- the value for thewidthproperty - See Also:
getWidth
public final double getWidth()
Gets the value of the
width property.- Property description:
- The horizontal size of the shadow blur kernel. This attribute controls the horizontal size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0are not distributed beyond the original pixel and so have no blurring effect on the shadow.Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0 - Default value:
- 21.0
- Returns:
- the value of the
widthproperty - See Also:
widthProperty
public final DoubleProperty widthProperty()
The horizontal size of the shadow blur kernel. This attribute controls the horizontal size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0 are not distributed beyond the original pixel and so have no blurring effect on the shadow.
Min: 0.0
Max: 255.0
Default: 21.0
Identity: <1.0
- Default value:
- 21.0
- Returns:
- the
widthproperty - See Also:
setHeight
public final void setHeight(double value)
Sets the value of the
height property.- Property description:
- The vertical size of the shadow blur kernel. This attribute controls the vertical size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0are not distributed beyond the original pixel and so have no blurring effect on the shadow.Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0 - Default value:
- 21.0
- Parameters:
-
value- the value for theheightproperty - See Also:
getHeight
public final double getHeight()
Gets the value of the
height property.- Property description:
- The vertical size of the shadow blur kernel. This attribute controls the vertical size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0are not distributed beyond the original pixel and so have no blurring effect on the shadow.Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0 - Default value:
- 21.0
- Returns:
- the value of the
heightproperty - See Also:
heightProperty
public final DoubleProperty heightProperty()
The vertical size of the shadow blur kernel. This attribute controls the vertical size of the total area over which the shadow of a single pixel is distributed by the blur algorithm. Values less than
1.0 are not distributed beyond the original pixel and so have no blurring effect on the shadow.
Min: 0.0
Max: 255.0
Default: 21.0
Identity: <1.0
- Default value:
- 21.0
- Returns:
- the
heightproperty - See Also:
setBlurType
public final void setBlurType(BlurType value)
Sets the value of the
blurType property.- Property description:
- The algorithm used to blur the shadow.
Min: n/a Max: n/a Default: BlurType.THREE_PASS_BOX Identity: n/a - Default value:
- THREE_PASS_BOX
- Parameters:
-
value- the value for theblurTypeproperty - See Also:
getBlurType
public final BlurType getBlurType()
Gets the value of the
blurType property.- Property description:
- The algorithm used to blur the shadow.
Min: n/a Max: n/a Default: BlurType.THREE_PASS_BOX Identity: n/a - Default value:
- THREE_PASS_BOX
- Returns:
- the value of the
blurTypeproperty - See Also:
blurTypeProperty
public final ObjectProperty<BlurType> blurTypeProperty()
The algorithm used to blur the shadow.
Min: n/a
Max: n/a
Default: BlurType.THREE_PASS_BOX
Identity: n/a
- Default value:
- THREE_PASS_BOX
- Returns:
- the
blurTypeproperty - See Also:
setColor
public final void setColor(Color value)
Sets the value of the
color property.- Property description:
- The shadow
Color.Min: n/a Max: n/a Default: Color.BLACK Identity: n/a - Default value:
- BLACK
- Parameters:
-
value- the value for thecolorproperty - See Also:
getColor
public final Color getColor()
Gets the value of the
color property.- Property description:
- The shadow
Color.Min: n/a Max: n/a Default: Color.BLACK Identity: n/a - Default value:
- BLACK
- Returns:
- the value of the
colorproperty - See Also:
colorProperty
public final ObjectProperty<Color> colorProperty()
The shadow
Color.
Min: n/a
Max: n/a
Default: Color.BLACK
Identity: n/a
- Default value:
- BLACK
- Returns:
- the
colorproperty - 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.