Shadow


Beside paint and paint effects, JavaFX also supports effect classes found in javafx.scene.effect.  The following shows how to apply a drop shadow effect on a rectangle:

def shadow = DropShadow { offsetX:5 offsetY:5 }
def rect = Rectangle {
    x:200 y:50 width:125 height:100
    fill:Color.BLUE
    arcHeight:10 arcWidth:10
    effect:shadow
}

The code above produces the figure shown below.


The materials on this website represent a small sample of content loosely based on the book JavaFX Application Development Cookbook.  The book offers far more content with over 80 recipes covering a range of topics from basics to advanced concepts.  

Buy the Book

You can get your copy of the book directly from the publisher. Click here to order!