So in windows 10 you have the windows menu with the icons on the left side:
When Hover the left side the menu expands and text is show
The expanded part is overlaying the content.
In my application I want to create that kind of design using Javafx and SceneBuilder.
I managed to design the button like when I hover the button it will expand and show the text but, I don't know how to expand the whole pane which contain the button. I put my buttons in VBox and give the same condition which I gave for my button expand design but, it doesn't work.
Any help would be appreciated, especially examples.
Simplistically, you can use a
MenuButton
with apopupSide
ofSide.TOP
. It may not be exactly what you are after. In particular, there is no "Toggle when Hovered" functionality.The example does not exactly match how the Windows button and menus are working. The Windows start button has lots of stuff going on (and I think it can also be configured to work different ways). You probably don't want all of that functionality. For example, the Windows button displays two menus side by side on pressing the button, one with the icons for various actions and another with an alphabetical application list. The UI is optimized to be able to display both unless you hover on the icons on left side, in which case it removes the right alphabetical list and displays the text for the icons instead. But if you only need to display one menu list (likely) then you may as well display both the icons and text for the left side menu at the same time, which is what the example I provided does.
My example is in code, but most of the stuff will translate to FXML and SceneBuilder if you wish to use that. Most of the icons I used are provided in this question.
When I tried this, there was a slight bug for JavaFX 21, OS X, in that the pop-up menu did not appear in the correct location the very first time I clicked on it (it displayed fine on subsequent clicks). Your outcome may vary depending on your JavaFX version.