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

Controls should be hardcoded to their default skin in case -fx-skin is not specified in CSS



    • Enhancement
    • Status: Closed
    • P2
    • Resolution: Fixed
    • 7u6
    • 8
    • javafx


      Right now, the best way to take over the CSS styling for a control is to remove the built-in CSS style class for the control and give it a custom style class or ID. Then from CSS you don't have to worry about overriding the built-in styles, you can just specify your own styling from scratch. This has a problem though, that the skin is not loaded because skins are only loaded via -fx-skin. This is problematic because the built in skins are private API (part of com.sun.javafx.scene.control.skin) and when people have to add:

      -fx-skin: com.sun.javafx.scene.control.skin

      to their CSS files, then they are explicitly depending on our com.sun implementation. Further, if we move these classes out of this package (say, into javafx.scene.control.skin) as a public API, then things have moved.

      What we can do is to hard-code the skin link into the Skins (we didnt' do this before because mobile had different skins, but this is no longer an issue, so we can just link directly to them). Then, if -fx-skin is not specified OR if -fx-skin points to a class we cannot load, then we simply fall back to the hard-coded skin creation. In this way, people using com.sun.javafx.scene.control.skin from their stylesheet today will still function even when we remove those classes, and people can avoid having to specify -fx-skin when they have customized the UI by removing the style class from the controls.


        Issue Links



              jasper Jasper Potts (Inactive)
              rbair Richard Bair (Inactive)
              1 Vote for this issue
              3 Start watching this issue