Skip to main content

Binding ShadowFilter attribute doesn´t work

3 replies [Last post]
jose_jfx
Offline
Joined: 2007-12-07
Points: 0

I´m trying to bind distance attribute in ShadowFilter object but it doesn´t work. When I bind another attribute like Rect:x works fine, but binding ShadowFilter attributes dont change values dynamically.
Code:

<br />
import javafx.ui.*;<br />
import javafx.ui.canvas.*;<br />
import javafx.ui.filter.*;</p>
<p>class classone extends CompositeNode {</p>
<p>}</p>
<p>class anotherclass {<br />
    attribute height: Number;<br />
}</p>
<p>attribute anotherclass.height = 0;</p>
<p>function classone.composeNode() =<br />
Group {<br />
    var mydistance:anotherclass = new anotherclass()    </p>
<p>    onMouseClicked: operation(e)<br />
    {<br />
        mydistance.height++;<br />
    }</p>
<p>    content:<br />
        [Rect {<br />
            cursor: HAND<br />
            selectable: true<br />
            x: 10<br />
            y: 10<br />
            width: 100<br />
            height: 50<br />
            fill: Color {<br />
            	blue: 0.8<br />
                green: 0.8<br />
                red: 0.8<br />
            }<br />
        },<br />
        Text {<br />
            content: "hello"<br />
            x: 25<br />
            y: 20<br />
            filter:<br />
                [ShadowFilter {distance: bind mydistance.height, x: 5, y: -5, ShadowColor: black}]<br />
        }<br />
        ]<br />
};</p>
<p>Canvas {<br />
    content:<br />
    [classone]<br />
}<br />

Any idea will be appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jose_jfx
Offline
Joined: 2007-12-07
Points: 0

Ok, I will find another form to make down and up button effect when users click it.

Thanks for your response.

alexsch
Offline
Joined: 2007-07-12
Points: 0

I think that you could do it using two rectangles and their color and opacity attributes.

alexsch
Offline
Joined: 2007-07-12
Points: 0

It seems that triggers are missed for the ShadowFilter class attributes:
https://openjfx.dev.java.net/source/browse/openjfx/trunk/src/javafx/java...

So it should be a bug in JavaFX Script API.