Top Description Fields Constructors Methods
javafx.scene.effect

public Class Reflection

extends Effect
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .DoublePropertyBase, .ObjectProperty, javafx.scene.Node, com.sun.javafx.util.Utils, com.sun.javafx.effect.EffectDirtyBits, com.sun.javafx.geom.BaseBounds, com.sun.javafx.geom.transform.BaseTransform, com.sun.javafx.scene.BoundsAccessor

An effect that renders a reflected version of the input below the actual input content.

Note that the reflection of a Node with a Reflection effect installed will not respond to mouse events or the containment methods on the Node.

Example:

Reflection reflection = new Reflection();
reflection.setFraction(0.7);

Text text = new Text();
text.setX(10.0);
text.setY(50.0);
text.setCache(true);
text.setText("Reflections on JavaFX...");
text.setFill(Color.web("0x3b596d"));
text.setFont(Font.font(null, FontWeight.BOLD, 40));
text.setEffect(reflection);

The code above produces the following:

The visual effect of Reflection on text

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private DoubleProperty
bottomOpacity

The bottom opacity value, which is the opacity of the reflection at its bottom extreme.

private DoubleProperty
fraction

The fraction of the input that is visible in the reflection.

private ObjectProperty<Effect>
input

The input for this Effect.

private DoubleProperty
topOffset

The top offset adjustment, which is the distance between the bottom of the input and the top of the reflection.

private DoubleProperty
topOpacity

The top opacity value, which is the opacity of the reflection at its top extreme.

Constructor Summary

AccessConstructor and Description
public
Reflection()

Creates a new instance of Reflection with default parameters.

public
Reflection(double
the distance between the bottom of the input and the top of the reflection
topOffset
,
double
the fraction of the input that is visible in the reflection
fraction
,
double
the opacity of the reflection at its top extreme
topOpacity
,
double
the opacity of the reflection at its bottom extreme
bottomOpacity
)

Creates a new instance of Reflection with the specified topOffset, fraction, topOpacity and bottomOpacity.

Method Summary

Modifier and TypeMethod and Description
public final DoubleProperty
pack-priv boolean
pack-priv Effect
copy()

Implements abstract javafx.scene.effect.Effect.copy.

pack-priv Reflection
public final DoubleProperty
public final double
pack-priv BaseBounds
getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)

Implements abstract javafx.scene.effect.Effect.getBounds.

Returns bounds of given node with applied effect.

private float
private float
private float
public final double
public final Effect
public final double
public final double
public final ObjectProperty<Effect>
public final void
setBottomOpacity(double value)

public final void
setFraction(double value)

public final void
public final void
setTopOffset(double value)

public final void
setTopOpacity(double value)

public final DoubleProperty
public final DoubleProperty
pack-priv void
Inherited from javafx.scene.effect.Effect:
containsCycleseffectBoundsChangedgetInputBoundsgetKernelSizegetPeergetShadowBoundsmarkDirtysynctransformBounds

Field Detail

bottomOpacityback to summary
private DoubleProperty bottomOpacity

The bottom opacity value, which is the opacity of the reflection at its bottom extreme.

      Min: 0.0
      Max: 1.0
  Default: 0.0
 Identity: 1.0
Default Value
0.0
fractionback to summary
private DoubleProperty fraction

The fraction of the input that is visible in the reflection. For example, a value of 0.5 means that only the bottom half of the input will be visible in the reflection.

      Min: 0.0
      Max: 1.0
  Default: 0.75
 Identity: 1.0
Default Value
0.75
inputback to summary
private ObjectProperty<Effect> input

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
topOffsetback to summary
private DoubleProperty topOffset

The top offset adjustment, which is the distance between the bottom of the input and the top of the reflection.

      Min: n/a
      Max: n/a
  Default: 0.0
 Identity: 0.0
Default Value
0.0
topOpacityback to summary
private DoubleProperty topOpacity

The top opacity value, which is the opacity of the reflection at its top extreme.

      Min: 0.0
      Max: 1.0
  Default: 0.5
 Identity: 1.0
Default Value
0.5

Constructor Detail

Reflectionback to summary
public Reflection()

Creates a new instance of Reflection with default parameters.

Reflectionback to summary
public Reflection(double topOffset, double fraction, double topOpacity, double bottomOpacity)

Creates a new instance of Reflection with the specified topOffset, fraction, topOpacity and bottomOpacity.

Parameters
topOffset:double

the distance between the bottom of the input and the top of the reflection

fraction:double

the fraction of the input that is visible in the reflection

topOpacity:double

the opacity of the reflection at its top extreme

bottomOpacity:double

the opacity of the reflection at its bottom extreme

Since
JavaFX 2.1

Method Detail

bottomOpacityPropertyback to summary
public final DoubleProperty bottomOpacityProperty()
checkChainContainsback to summary
pack-priv boolean checkChainContains(Effect e)

Implements abstract javafx.scene.effect.Effect.checkChainContains.

Annotations
@Override
copyback to summary
pack-priv Effect copy()

Implements abstract javafx.scene.effect.Effect.copy.

Annotations
@Override
createPeerback to summary
pack-priv Reflection createPeer()

Implements abstract javafx.scene.effect.Effect.createPeer.

Annotations
@Override
fractionPropertyback to summary
public final DoubleProperty fractionProperty()
getBottomOpacityback to summary
public final double getBottomOpacity()
getBoundsback to summary
pack-priv BaseBounds getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)

Implements abstract javafx.scene.effect.Effect.getBounds.

Doc from javafx.scene.effect.Effect.getBounds.

Returns bounds of given node with applied effect. We *never* pass null in as a bounds. This method will NOT take a null bounds object. The returned value may be the same bounds object passed in, or it may be a new object.

Annotations
@Override
getClampedBottomOpacityback to summary
private float getClampedBottomOpacity()
getClampedFractionback to summary
private float getClampedFraction()
getClampedTopOpacityback to summary
private float getClampedTopOpacity()
getFractionback to summary
public final double getFraction()
getInputback to summary
public final Effect getInput()
getTopOffsetback to summary
public final double getTopOffset()
getTopOpacityback to summary
public final double getTopOpacity()
inputPropertyback to summary
public final ObjectProperty<Effect> inputProperty()
setBottomOpacityback to summary
public final void setBottomOpacity(double value)
setFractionback to summary
public final void setFraction(double value)
setInputback to summary
public final void setInput(Effect value)
setTopOffsetback to summary
public final void setTopOffset(double value)
setTopOpacityback to summary
public final void setTopOpacity(double value)
topOffsetPropertyback to summary
public final DoubleProperty topOffsetProperty()
topOpacityPropertyback to summary
public final DoubleProperty topOpacityProperty()
updateback to summary
pack-priv void update()

Implements abstract javafx.scene.effect.Effect.update.

Annotations
@Override