JavaFX DropShadow Effect

This effect is similar to the shadow effect. However, in DropShadow, the duplicate of the node is displayed behind the original node with the specified size and color. The class javafx.scene.effect.DropShadow is represents the DropShadow effect. We just need to instantiate this class in order to generate an appropriate effect.

Properties

The properties of the class along with the setter methods are described in the following table.

PropertyDescriptionSetter Methods
blurTypeThis represents the algorithm used to blur the shadow.setBlurType(BlurType value)
setBlurType(BlurType value)The color of the shadow blur kernel. This property is of color type.setColor(Color value)
heightThis represents the height of the shadow blur kernel. This property is of double type.setHeight(Double value)
inputThis represents the input for the effect.setInput(Effect value)
offsetXThis represents the X coordinate of the shadow offset. This properly is of double type.setOffsetX(Double value)
offsetYThis represents the Y coordinate of the shadow offset. This property is of double type.setOffsetY(Double value)
RadiusThis represents the radius of the shadow blur kernel.setRadius(Double value)
SpreadIt represents the spread of the shadow blur kernel. Is is of double type.setSpread(Double value)
WidthIt represents the width of the shadow blur kernel.setWidth(double value)

Constructors

The class contains four constructors

  1. public DropShadow() : It creates the instance with the default parameters.
  2. public DropShadow(double radius, Color color) : It creates the instance with the specified radius and color values.
  3. public DropShadow(double radius, double offsetX, double offsetY, Color color) : It creates the instance with the specified radius, offset and color values.
  4. public DropShadow(BlurType blurtype, Color color, double radius, double spread, double offsetX, double offsetY) : It creates the instance with the specified BlurType, color, radius, spread and offset values.

Example:


JavaFX DropShadow Effect



Latest Courses