How to get a popup Dialog<T> to inherit styles from main app?

Pete Moss peatmoss84 at gmail.com
Sat Nov 1 15:08:59 UTC 2014


I am just getting started using the Dialog<T> class and I noticed that my
dialog content is not picking up styles that I've added to a global style
sheet in my app. I suspect because Dialog's HeavyweightDialog is creating a
new Stage.

In my Main class I have:

    Scene scene = new Scene(root, 600, 500, Color.YELLOW);
    String s = Main.class.getResource("ui/styles.css").toExternalForm();
    scene.getStylesheets().add(s);

How can I get that stylesheet applied to the scene graph in my popup
dialog? At what point in the lifecycle of my dialog can I do this?

Thanks.


More information about the openjfx-dev mailing list