This discussion is archived
3 Replies Latest reply: Nov 19, 2012 1:33 PM by David Grieve RSS

Setting node properties by CSS?

Tobi Newbie
Currently Being Moderated
Is it possible to set any node property by CSS? Can I introduce my own property and than set in my CSS file?
  • 1. Re: Setting node properties by CSS?
    jsmith Guru
    Currently Being Moderated
    I think that setting node properties is what fxml and java code is for, not css.
  • 2. Re: Setting node properties by CSS?
    Tobi Newbie
    Currently Being Moderated
    Yes but there are some cases where it would be better to set a property in pure CSS. Please think of a CheckBox which is skinned for different target platforms. A checkbox on Desktop windows contains of a rectangle and a mark. But the Checkbox (Toggle button) on iOS (iPhone, iPad) has a label "ON" / "OFF" in the background of the checkbox. So it would be good to set the text property of a node (e.g.)

    Because JavaFX CSS does not support setting any node property I have to include the "ON"/"OFF" as background image...the point is: It's not scalable (no SVG).

    http://css3wizardry.com/2011/12/18/ios-5-style-switch-control/
  • 3. Re: Setting node properties by CSS?
    David Grieve Pro
    Currently Being Moderated
    See http://docs.oracle.com/javafx/2/api/index.html for a list of properties that can be set via css.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points