So I have some little project to make -> cash register software.
And i want to learn some JavaFX basics.
Design: I wanted to have top main menu and vertical side menu.
Started SceneBuilder and first I just thrown on it bunch of rectangles for menus and items.
And since I wanted some nice looking controls I decided to build my own.
Custom control menu
Basic idea is to use ToggleButtons and if there are more buttons than control width/height we need to hide them.
For hiding we use MenuButton with popup, that shows the rest of items.
- Getting size of control: when creating custom skin of control i couldn't get the size of it since 'If I understand correctly' parent calculates size after children are laid out.
So i used width/height property change listeners of control. I'm not sure if this is right approach.
control.widthProperty().addListener((c, oval, nval) -> fill(nval.doubleValue(), orientation));
For now I need to polish resizing of menu, because refreshing is binded to width and height property change of control and sometimes i don't get events if resizing window.
- styling : to make look that MenuButton is selected if item in it is selected I used PseudoClass
And the next thing is to make control for items, probably using Pagination.