Friday, May 18, 2012

JavaFX 2.0 Layouts: StackPane

This is the fourth tutorial in  JavaFX 2.0 Layout series. It's about StackPane layout. The StackPane layout pane places all of the nodes within a single stack with each new node added on top of the previous node. This layout model provides an easy way to overlay text on a shape or image or to overlap common shapes to create a complex shape.

This will be a very short example, and as you can  look above,  this is  how our little example will look in the end. As you can see there is a label there, and a button over that label, simple like that.

Below is the code of our example.

Check other tutorials from JavaFX Layout series by clicking on the image above.
javafx 2 layout

If you like this, and other JavaFX 2 tutorials on this blog, you can follow me on sites bellow to be informed about new JavaFX tutorials.

Twitter Facebook Google Plus LinkedIn RSS Feed Email

If you have any commentsquestions, and anything like that, please feel free to  leave  a comment below, or at least if you like this tutorial you can SHARE it with your friends.


  1. StackPane block all mouse event for the lower/under layers.

    What is the solution for permit all the layers to receive the mouse events ?


  2. Ronan: Pass the MouseEvent through.