Search code examples
stylesjavafxlook-and-feeljavafx-8java-8

How can I keep the JavaFX 7 skin with JavaFX 8?


JavaFX 8 introduces a new look and feel by default, but I want to keep the default JavaFX 7 type style for my application (whilst using Java 8.)

How do I achieve this?


Solution

  • Simply put:

    setUserAgentStylesheet(STYLESHEET_CASPIAN);
    

    ...as the first line of your program (in the start() method), or run it with the JVM flag -Djavafx.userAgentStylesheetUrl=caspian.

    Note the above method isn't present in JavaFX 2.x, so if you want to do this in code that compiles and runs on both Java 7 and 8, unfortunately the only way around it is via reflection.