Spec-Zone.ru › OpenJavaFX 24

Class Reflection

java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Reflection
public class Reflection extends Effect
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

Property Summary

Type Property Description
final DoubleProperty bottomOpacity
The bottom opacity value, which is the opacity of the reflection at its bottom extreme.
final DoubleProperty fraction
The fraction of the input that is visible in the reflection.
final ObjectProperty<Effect> input
The input for this Effect.
final DoubleProperty topOffset
The top offset adjustment, which is the distance between the bottom of the input and the top of the reflection.
final DoubleProperty topOpacity
The top opacity value, which is the opacity of the reflection at its top extreme.

Constructor Summary

Constructor Description
Reflection()
Creates a new instance of Reflection with default parameters.
Reflection(double topOffset, double fraction, double topOpacity, double bottomOpacity)
Creates a new instance of Reflection with the specified topOffset, fraction, topOpacity and bottomOpacity.

Method Summary

Modifier and Type Method Description
final DoubleProperty bottomOpacityProperty()
The bottom opacity value, which is the opacity of the reflection at its bottom extreme.
final DoubleProperty fractionProperty()
The fraction of the input that is visible in the reflection.
final double getBottomOpacity()
Gets the value of the bottomOpacity property.
final double getFraction()
Gets the value of the fraction property.
final Effect getInput()
Gets the value of the input property.
final double getTopOffset()
Gets the value of the topOffset property.
final double getTopOpacity()
Gets the value of the topOpacity property.
final ObjectProperty<Effect> inputProperty()
The input for this Effect.
final void setBottomOpacity(double value)
Sets the value of the bottomOpacity property.
final void setFraction(double value)
Sets the value of the fraction property.
final void setInput(Effect value)
Sets the value of the input property.
final void setTopOffset(double value)
Sets the value of the topOffset property.
final void setTopOpacity(double value)
Sets the value of the topOpacity property.
final DoubleProperty topOffsetProperty()
The top offset adjustment, which is the distance between the bottom of the input and the top of the reflection.
final DoubleProperty topOpacityProperty()
The top opacity value, which is the opacity of the reflection at its top extreme.

Methods declared in class java.lang.Object

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

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:
  • getInput()
  • setInput(Effect)
  • inputProperty()

topOffset

public final DoubleProperty topOffsetProperty
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
See Also:
  • getTopOffset()
  • setTopOffset(double)
  • topOffsetProperty()

topOpacity

public final DoubleProperty topOpacityProperty
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
See Also:
  • getTopOpacity()
  • setTopOpacity(double)
  • topOpacityProperty()

bottomOpacity

public final DoubleProperty bottomOpacityProperty
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
See Also:
  • getBottomOpacity()
  • setBottomOpacity(double)
  • bottomOpacityProperty()

fraction

public final DoubleProperty fractionProperty
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
See Also:
  • getFraction()
  • setFraction(double)
  • fractionProperty()

Constructor Details

Reflection

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

Reflection

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 - the distance between the bottom of the input and the top of the reflection
fraction - the fraction of the input that is visible in the reflection
topOpacity - the opacity of the reflection at its top extreme
bottomOpacity - the opacity of the reflection at its bottom extreme
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 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
Parameters:
value - the value for the input property
See Also:
  • getInput()
  • inputProperty()

getInput

public final Effect getInput()
Gets the value of the input property.
Property description:
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 value of the input property
See Also:
  • setInput(Effect)
  • inputProperty()

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 input property
See Also:
  • getInput()
  • setInput(Effect)

setTopOffset

public final void setTopOffset(double value)
Sets the value of the topOffset property.
Property description:
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
Parameters:
value - the value for the topOffset property
See Also:
  • getTopOffset()
  • topOffsetProperty()

getTopOffset

public final double getTopOffset()
Gets the value of the topOffset property.
Property description:
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
Returns:
the value of the topOffset property
See Also:
  • setTopOffset(double)
  • topOffsetProperty()

topOffsetProperty

public final DoubleProperty topOffsetProperty()
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
Returns:
the topOffset property
See Also:
  • getTopOffset()
  • setTopOffset(double)

setTopOpacity

public final void setTopOpacity(double value)
Sets the value of the topOpacity property.
Property description:
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
Parameters:
value - the value for the topOpacity property
See Also:
  • getTopOpacity()
  • topOpacityProperty()

getTopOpacity

public final double getTopOpacity()
Gets the value of the topOpacity property.
Property description:
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
Returns:
the value of the topOpacity property
See Also:
  • setTopOpacity(double)
  • topOpacityProperty()

topOpacityProperty

public final DoubleProperty topOpacityProperty()
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
Returns:
the topOpacity property
See Also:
  • getTopOpacity()
  • setTopOpacity(double)

setBottomOpacity

public final void setBottomOpacity(double value)
Sets the value of the bottomOpacity property.
Property description:
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
Parameters:
value - the value for the bottomOpacity property
See Also:
  • getBottomOpacity()
  • bottomOpacityProperty()

getBottomOpacity

public final double getBottomOpacity()
Gets the value of the bottomOpacity property.
Property description:
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
Returns:
the value of the bottomOpacity property
See Also:
  • setBottomOpacity(double)
  • bottomOpacityProperty()

bottomOpacityProperty

public final DoubleProperty bottomOpacityProperty()
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
Returns:
the bottomOpacity property
See Also:
  • getBottomOpacity()
  • setBottomOpacity(double)

setFraction

public final void setFraction(double value)
Sets the value of the fraction property.
Property description:
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
Parameters:
value - the value for the fraction property
See Also:
  • getFraction()
  • fractionProperty()

getFraction

public final double getFraction()
Gets the value of the fraction property.
Property description:
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
Returns:
the value of the fraction property
See Also:
  • setFraction(double)
  • fractionProperty()

fractionProperty

public final DoubleProperty fractionProperty()
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
Returns:
the fraction property
See Also:
  • getFraction()
  • setFraction(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