Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8128082

CSS Stylesheet When Changing Scenes

XMLWordPrintable

      Creating a scene, setting the stylesheet, and setting the scene in the stage works, but when I create another scene, set the stylesheet, and set the scene in the stage again the CSS styling stops working.

      This is how I set the stylesheet:
      scene.getStylesheets().add("/stylesheets/main.css");

      This is how I set the scene:
      stage.setScene(scene);
      stage.setVisible(true);

      I have a simple application that has a splash screen and then it transitions to a primary dashboard. The splash screen shows up with proper styling (based on the CSS), but when I change the scene to the dashboard the CSS settings are not applied and everything appears unstyled. If i change the order in which the scenes are displayed (Dashboard before Splash screen) then the Dashboard shows up properly, but the Splash screen does not.

            dgrieve David Grieve
            jvjfx Juan V. (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: