In my javaFX 2.0 app, I need to replace a component which is used awt.CardLayout. Cardlayout has a functionality as a stack which displays the top component in stack. And also we can manually configure which is to be displayed.
In javaFX 2.0, there is a layout called StackPane. But It doesn't seems like Cardlayout.
Another option is to use a
StackPane
and set the visibility of all but the curentPane
tofalse
. Not ideal, but another way of thinking about the problemThere is no CardLayout, but you can use TabPane or simply switch groups:
Using metasim's answer, here is the full code (also made the buttons act more like toggle buttons):