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

CSS not reloaded when loaded through FXML

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      $ java -version
      java version "1.8.0_20-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.20-b12, mixed mode)

      Description

      The project has two (main) files hosted on a webserver http://localhost:8080/
      - login.fxml
      - login.css

      The FXML references the CSS file as:
          <stylesheets>
              <URL value="@login.css"/>
          </stylesheets>

      The FXMLLoader is created pointing to the remote URL "http://localhost:8080/login.fxml". JavaFX loads correctly both the FXML structure and the CSS.

      The application has a button that removes the created Node, and calls FXMLLoader again, causing a reload of the FXML/CSS (and other resources). Most changes are correctly processed, like FXML structures and inline style. The problem occurs when the CSS file is updated on the server, and due to perhaps a problem inside StyleManager, the CSS cache is not correctly cleaned.

      To test, there is a sample FXML and CSS application here: https://github.com/brunoborges/webfx/tree/master/webfx-samples/src/main/webapp/login

      Javascript-based FXML controller is loaded correctly as well. The problem is limited to the CSS file not being picked up with the new changes.

        Attachments

          Activity

            People

            Assignee:
            dgrieve David Grieve
            Reporter:
            bborges Bruno Borges (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: