I'm currently experimenting with JavaFx 8 and its different Panes.
So I want to implement a hidden Pane with a visible Button which follows a set of rules, for example:
- The Pane can be placed in 4 positions within its parent: TOP_CENTER, BOTTOM_CENTER, RIGHT_CENTER, LEFT_CENTER; in which the button is placed on top-most or left-most border of the Pane.
- The Pane is mostly hidden and only the button is visible. If the user clicks on the button, the Pane slides-in. On clicking again, the Pane slides-out again.
- The background of Pane and Button should be non-transparent, so that its content differs from the main content from parent.
Now follows ASCII-art... ;)
+------------+ +------------+
| | | |
| +-| | +-+-------+
| |X| (The **X** is the button, | |X|#######|
| +-| which now was clicked =>) | +-+#######|
| | | |#######|
| | | |#######|
| | | +-------+
+------------+ +------------+
My current state is having a StackPane
as parent/container and placing a BorderPane
with Button
on the left and another control centered, which acts as hidden content.
The BorderPane
is aligned with StackPane.setAlignment(borderPane, Pos.CENTER_RIGHT)
. The preferred height and width properties are bound to a factor of its parent's (but shown always at the same) size... Also backgrounds are transparent...
Any ideas?