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

CSS @import statement not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u20
    • javafx
    • Windows 7 x64, Java build 1.8.0_20-b26

      I'm using Java build 1.8.0_20-b26. According to the CSS Reference Guide for JavaFX 8, "Beginning with JavaFX 8u20, the CSS @import is also partially supported". Reference: http://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#introatrules

      I'm questioning this because I have not succeeded in importing one CSS file from another CSS file.

      I have a .fxml file created in Scene Builder, whose root node references a stylesheet Main.css. Main.css uses some looked-up colors which are named in Theme.css.

      If, in Scene Builder, I make the root node reference both Main.css and Theme.css, all the styling is correct. If I make the root node reference only Main.css, then add Themes.css in code after the FXML has been parsed, all the styling is correct.

      However, if the root node references only Main.css, and Main.css tries to import Theme.css via an @import statement, the Theme.css styling is not picked up.

      Thinking this was a path issue I've tried every possible path for the @import statement:

      @import "Theme.css";
      @import "/Theme.css";
      @import "./Theme.css";
      @import "styles/Theme.css";
      @import "/styles/Theme.css";
      @import "./styles/Theme.css";
      @import "C:/Users/jf334/Documents/EclipseWorkspace/iNotesMonitor/src/main/resources/styles/Theme.css";
      @import "file://C:/Users/jf334/Documents/EclipseWorkspace/iNotesMonitor/src/main/resources/styles/Theme.css";

      @import url( "Theme.css" );
      @import url( "/Theme.css" );
      @import url( "./Theme.css" );
      @import url( "styles/Theme.css" );
      @import url( "/styles/Theme.css" );
      @import url( "./styles/Theme.css" );
      @import url( "C:/Users/jf334/Documents/EclipseWorkspace/iNotesMonitor/src/main/resources/styles/Theme.css" );
      @import url( "file://C:/Users/jf334/Documents/EclipseWorkspace/iNotesMonitor/src/main/resources/styles/Theme.css" );

      None of these cause any debug output, they just don't work.

      Am I just missing something? If the CSS @import statement is "partially-supported" in JFX 8u20 like the CSS reference says it is, what does this support entail and how do I correctly format the statement such that it works?

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: