I've this style sheet:
.scene {
/* My own color names */
textcolor: darkgreen;
}
.label {
-fx-text-fill: textcolor;
}
.styled-button {
-fx-text-fill: white !important;
-fx-font-size: 23;
}
but my button color is green, not white.
Source code:
package org.sepix.javafx.csstheming;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class SmallCSS extends Stage {
String style = "/org/sepix/javafx/csstheming/styles/small.css";
/*
.scene {
textcolor: darkgreen;
}
.label {
-fx-text-fill: textcolor;
}
.styled-button {
-fx-text-fill: white !important;
-fx-font-size: 23;
}
*/
public SmallCSS() {
VBox vbox = new VBox();
Scene scene = new Scene (vbox);
scene.getStylesheets().add (style);
Label label = new Label("A Label");
Button button = new Button("Button");
button.getStyleClass().add("styled-button");
vbox.getChildren().addAll(label, button);
setScene(scene);
}
}
.scene {
/* My own color names */
textcolor: darkgreen;
}
.label {
-fx-text-fill: textcolor;
}
.styled-button {
-fx-text-fill: white !important;
-fx-font-size: 23;
}
but my button color is green, not white.
Source code:
package org.sepix.javafx.csstheming;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class SmallCSS extends Stage {
String style = "/org/sepix/javafx/csstheming/styles/small.css";
/*
.scene {
textcolor: darkgreen;
}
.label {
-fx-text-fill: textcolor;
}
.styled-button {
-fx-text-fill: white !important;
-fx-font-size: 23;
}
*/
public SmallCSS() {
VBox vbox = new VBox();
Scene scene = new Scene (vbox);
scene.getStylesheets().add (style);
Label label = new Label("A Label");
Button button = new Button("Button");
button.getStyleClass().add("styled-button");
vbox.getChildren().addAll(label, button);
setScene(scene);
}
}
- duplicates
-
JDK-8113693 !important present in Author CSS doesn't supercede style property
-
- Closed
-