Adam Bien's Weblog
JavaFX 2.0 CSS Reference
All JavaFX 2 components can be styled with CSS 3. The CSS JavaFX 2 reference is available here: http://docs.oracle.com/javafx/2.0/api/javafx/scene/doc-files/cssref.html. To activate your custom CSS you only have to add a resource containing the CSS styles to the javafx.scene.Scene:
Scene scene = ...
scene.getStylesheets().add(this.getClass().getResource("javafxrocks.css").toExternalForm());
stage.setScene(scene);
stage.show();
Posted at 09:35AM Jan 13, 2012 by Adam Bien in RIA / Java FX | Comments[1] | Views/Hits: 2165
*NEW* Workshop: "Real World Java EE 6/7 Bootstrap" and book: Real World Java EE Night Hacks--Dissecting the Business Tier Tweet Follow @AdamBien



Careful, this may not work if your net your NetBeans project properties to "Binary Encode JavaFX CSS Files" (in Project Properties->Build->Packaging).
If this is the case you'll have to look for the file "javafxrocks.bss" instead (".css" => ".bss").
You may want to modify your code to check if URL returned when seeking "javafxrocks.css" is null and if it's the case then search for "javafxrocks.bss" instead. This way it should work in both settings.
Posted by Fabrice Bouyé on January 16, 2012 at 12:34 AM CET #