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

StyleManager cant load CSS file with name main.css

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 7u6
    • javafx
    • jdk 1.7.0_10 windows 64 bit and java fx sdk 2.2

      When i try add stylesheet with name main.css to Scene, I got following warning:

       WARNING: com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged Resource "main.css" not found.

      and style not applied.

      When renamed main.css to style.css, works fine.

      A bit of source code:

      public class MainClass extends Application {

          public static void main(String[] args) {
              Application.launch(MainClass.class, args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              BorderPane borderPane = new BorderPane();

              Scene scene = new Scene(borderPane);
              stage.setScene(scene);
              stage.show();
              scene.getStylesheets().add("main.css");
          }
      }

      If "main" is reserved word, you need made specify it in a javadoc

            dgrieve David Grieve
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: