CSS on javaFX

Pedro Duque Vieira pedro.duquevieira at gmail.com
Sun Apr 15 10:03:44 PDT 2012

I should have elaborated more on that sentence.
Yes CSS is not a "programming language" nor is it intended to be, it tries
to be a language to describe the visual part of interfaces separating the
structure of a document (HTML) from its appearance (the CSS part). Problem
is that for more elaborated interfaces, the looks start to have a logic,
which CSS fails to provide. That's when HTML web developers start to use
javascript, toggling HTML elements class's,

I think CSS is a reasonable language to describe visual interfaces, but I
think we can do much better. We have to remind ourselves of its origins, it
appeared in the context of HTML to solve problems caused by its model, it
didn't come up as a language on its own.

One thing we can not naturally do today, that we would be able to do if we
had an object model of the css properties is animating those properties. We
will be able to do it eventually when CSS3 animations come to JavaFX, but
on the meantime we can't, at least not on a natural, straight forward way.

In conclusion I think CSS should not THE way to describe visual interfaces
on JavaFX, rather I think it should be one more way of doing it, that is,
we should also be able to accomplish the same by using Java or some other
language without having to parse CSS strings.

On Sun, Apr 15, 2012 at 2:15 PM, Stephen Winnall <steve at winnall.ch> wrote:

> On 14 Apr 2012, at 02:20, Pedro Duque Vieira wrote:
> CSS isn't even a language it lacks lots of common language constructs.
> That depends on what you understand as a "language".
> I would agree that CSS is not a programming language, but it is not
> intended to be. Nor is XML for that matter. Both CSS and XML are data
> description languages and - as such - capture the state of the described
> data at the point where the CSS or XML is loaded (by
> Scene.getStylesheets.add() or FXMLLoader.load() etc).
> The provision of "common language constructs" is what scripting languages
> provide. We have enough of those already without adding scripting
> constructs to CSS and XML. In the context of JavaFX, it may make more sense
> to use Java itself.
> I agree that Zonski's proposal is interesting. In the XML world there is
> data binding, which allows you to create mapping from XML schemas to Java
> Beans. Something similar for CSS would be very useful.
> Steve

Pedro Duque Vieira

More information about the openjfx-dev mailing list