Layouts with constraint classes

Jonathan Giles jonathan.giles at
Sat Dec 1 19:30:20 PST 2012

There are a whole bunch of cool things we plan to do in JavaFX CSS, one 
of which is having a public API for read/write access to the CSS state 
of each Node (see [1], although note that it is no longer targeted at 
8.0, I believe). Some other things planned for future releases include 
support for custom CSS properties / pseudoclass states (8.0) and 
animation support (untargeted), etc.

I keep on telling people that this is in the plans - but no one seems to 
believe me :-) Personally this is something I've been wanting to get 
done for a long time now, so I'm very keen on seeing it too. I would 
recommend any further technical discussion be moved on to [1] though, as 
we're (as always) straying very far from the original topic.


-- Jonathan

On 2/12/2012 4:06 p.m., Daniel Zwolenski wrote:
> More or less. I would have liked a really nice type safe Style Java API much like the really nice type safe Node API and Animation API, etc. Then CSS would be more of a higher level way of interacting with it (like FXML is to Nodes). This would allow nicer styling direct in java code eg something like:
>      Style myStyle = new ButtonStyleBuilder().border(2).padding(10)
> And querying styles:
>     ButtonStyle style = StyleSheet.resolveStyleFor(my button);
>     style.getBorder().getWidth();
> Or whatever, you get the gist. It would obviously be a lot more complex than I imply here but I'm tapping on my phone.
> This would also open the door to people building their own non-CSS style languages that map onto the java (eg json) or I could even put my styles in XML along side the FXML files, etc. I have use cases, but the main thing is its easier for developers to get creative when it's in java (as we just saw with Tom's unique FXML use case).
> This is an old conversation though, I've kicked it around many times. I don't think it's something likely to change so maybe not worth burning your time on? I'd rather see that blog post you were talking about on how you got jfx working on android :)
> On 02/12/2012, at 1:26 PM, Richard Bair <richard.bair at> wrote:
>>> This whole thread is a great example where a clean underlying Java API with
>>> good separation of concerns between domains (in this case FXML and Java
>>> API) with appropriate glue in between can allow for the most flexibility
>>> and future variations and extensions.
>>> If only this same philosophy had been taken with CSS...
>> You mean not being able to style the UI controls except from CSS?

More information about the openjfx-dev mailing list