Posts

Showing posts from May, 2015

GroupLayout for JavaFX 8: GroupLayoutPane

Image
I recently decided to do small gui application in JavaFX, and I'm very excited about it's capabilities and nice design. Compared to pure-Swing gui, JavaFX seems to be more consistent and extendable. But as usual, there's a fly in the oinment - default layouts are really horrible for anything except simplest setups. There are eight different layouts, all with incredible amount of hidden gotchas. Take VBox for example. By default, it doesn't expand children to fill all the provided width. There's an option for fixing that, of course. Okay, but now I want to spread VBox children vertically. Sure there is fillHeight property to give me that? Nope. Screw me. Maybe I can use GridPane for that? Yes, I can, but first I need to learn all the setValignment, setHgrow, and a bunch of other cryptic methods. And whatever I did, I was unable to place a canvas onto that grid and make it resize/redraw when the frame is resized. I really missed the old GroupLayout from Swing....