Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set JavaFX default skin

I noticed that when I run JavaFX application on JVM 7 and JVM 8 I get different default skins. How I can set the default skin to be same on every JVM?

like image 256
Peter Penzov Avatar asked Jun 25 '13 12:06

Peter Penzov


3 Answers

You can set the default skin:

@Override 
public void start(Stage stage) throws Exception {
    ....
    setUserAgentStylesheet(STYLESHEET_CASPIAN);
    ....
}

http://fxexperience.com/2013/01/modena-new-theme-for-javafx-8/

like image 122
user1285928 Avatar answered Nov 15 '22 07:11

user1285928


The default stylesheet for JavaFX 2 is caspian.css. You can find it in jfxrt.jar under com.sun.javafx.scene.control.skin.caspian. This changed with JavaFX 8 and I believe the default stylesheet is named modena.css. In order to get a common stylesheet, you will have to either define your own or copy one of the defaults into your project.

like image 22
OttPrime Avatar answered Nov 15 '22 07:11

OttPrime


You can also run with -Djavafx.userAgentStylesheetUrl=caspian on the command line.

like image 2
Brian Blonski Avatar answered Nov 15 '22 08:11

Brian Blonski