Object Effect

One of the best thing about JavaFX is, it allows us to create objects effects easily. All we need is to define what kind of effects we want inside the object. Let see an example to have a more clear understanding on it.


Example
 






Click here to download the example

We are able to put multiple effects on an object. By using the keyword " input " we are able to input multiple effects. Lets observe a basic example.

Click here to download the example

This example create three buttons, a click of the button puts an effect on the image. We create a changeEffect variable so that we can use it to bind the effect.

The code above, we create a variable to hold the location of the image. Notice, we use "{__DIR__}" that is we are assuming the image is in the same directory as the source code.

Notice, the code above on the effect, we bind the changeEffect. What it does is every time the user clicks a button, it will change the effect of the image. Keep in mind that if we don't use the bind keyword, the effect of the image will not change.


Here we create three buttons, a click of the button will change the effect of the image. Notice, we have multiple effect when the user clicks of a button. We use the "input" keyword to help us accomplish the multiple effect.
 

 

  <JavaFX><JavaFX Example><Home>