For anyone not familiar with JRubyFX, check it out. The tl;dr is that JRubyFX allows you to harness the power of 3 things:
Really, JRubyFX is the glue that binds JRuby with JavaFX. And I love it. Love it.
Now what is JavaFX? JavaFX is the GUI toolkit that is meant to entirely replace the old, hideous Java thick client applications. While it doesn’t look entirely native, it really does go a long way (compared to swing). Because we are writing ruby, the code is just so expressive and easy to understand (actual Brakeman Pro code):
So what’s going on here?
text()creates a text element, one of the most basic controls. Guess what it does?
- Inside of the block passed to
text(), we add a style_class. JavaFX has a CSS-like language to style things as you would a website. The code inside the block is implicitly called on the newly created object.
- JavaFX has a nice binding API so as elements resize the page, you have great control over how other controls react. In this case, we wrap the text based on the width of the
drawerwhich is just an element that will essentially wrap everything in the end.
- Now we take our
textobjects and throw them into a
vboxis just a control that will position it’s children elements in a vertical sequential list.
So that’s the high level overview, hopefully this will serve as a good post for future JRubyFX related posts.