-
Bug
-
Resolution: Not an Issue
-
P3
-
8u40
-
Java 8 U40 b02
The code below doesn't allow to get Modena yellow-on-black look (you get no styling at all).
I call setUserAgentStylesheet on a SubScene and provide a CSS file that imports two other CSS files which are all stored in the same folder on disk.
modena.css and yellowOnBlack.css are directly copied from the FX rt repository.
The issue isn't linked to the use of a SubScene: doing the same setUserAgentStylesheet call directly on the Scene gives the same user experience.
Attached zip is the full NetBeans project.
public class CSSImport extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override public void start(Stage stage) {
stage.setTitle("CSSImport : SubScene case");
Scene scene = new Scene(new Group(), 600, 450);
scene.setFill(Color.LIGHTGREEN);
VBox subSceneRoot = new VBox(5, new Label("Modena yellowOnBlack style button in a SubScene"), new Button("YELLOW-ON-BLACK"));
subSceneRoot.setStyle("-fx-border-color: white; -fx-alignment: center;");
SubScene mySubScene = new SubScene(subSceneRoot, 450, 100);
// Line below gives Modena look, just fine !
// mySubScene.setUserAgentStylesheet("cssimport/modena.css");
// Line below doesn't give the expected yellow-on-black Modena
mySubScene.setUserAgentStylesheet("cssimport/modena-highContrast-yellowOnBlack.css");
mySubScene.setLayoutX(25);
mySubScene.setLayoutY(210);
((Group)scene.getRoot()).getChildren().addAll(mySubScene);
stage.setScene(scene);
stage.show();
}
}
/* modena-highContrast-yellowOnBlack */
@import “modena.css";
@import “yellowOnBlack.css”;
I call setUserAgentStylesheet on a SubScene and provide a CSS file that imports two other CSS files which are all stored in the same folder on disk.
modena.css and yellowOnBlack.css are directly copied from the FX rt repository.
The issue isn't linked to the use of a SubScene: doing the same setUserAgentStylesheet call directly on the Scene gives the same user experience.
Attached zip is the full NetBeans project.
public class CSSImport extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override public void start(Stage stage) {
stage.setTitle("CSSImport : SubScene case");
Scene scene = new Scene(new Group(), 600, 450);
scene.setFill(Color.LIGHTGREEN);
VBox subSceneRoot = new VBox(5, new Label("Modena yellowOnBlack style button in a SubScene"), new Button("YELLOW-ON-BLACK"));
subSceneRoot.setStyle("-fx-border-color: white; -fx-alignment: center;");
SubScene mySubScene = new SubScene(subSceneRoot, 450, 100);
// Line below gives Modena look, just fine !
// mySubScene.setUserAgentStylesheet("cssimport/modena.css");
// Line below doesn't give the expected yellow-on-black Modena
mySubScene.setUserAgentStylesheet("cssimport/modena-highContrast-yellowOnBlack.css");
mySubScene.setLayoutX(25);
mySubScene.setLayoutY(210);
((Group)scene.getRoot()).getChildren().addAll(mySubScene);
stage.setScene(scene);
stage.show();
}
}
/* modena-highContrast-yellowOnBlack */
@import “modena.css";
@import “yellowOnBlack.css”;
- blocks
-
JDK-8098434 Group theme css in single css files
- Resolved
- relates to
-
JDK-8097832 [CSS] Changing user_agent stylesheet on scene or subscene
- Resolved
-
JDK-8097789 [CSS] Add ability to resolve the URL given with an @import statement relative to the FX runtime
- Resolved