Layouts with constraint classes

Daniel Zwolenski zonski at gmail.com
Sat Dec 1 19:06:32 PST 2012


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 oracle.com> 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