Would like to change the color of a controls FX PopOver title which is set to always be on. I would like to do this in CSS, where I have already changed the background color. I have tried a couple of different options under .popover.
This is an example with the CSS of the last thing I tried:
public class HelloPopOver extends Application {
@Override
public void start(Stage primaryStage) {
//Build PopOver look and feel
Label lblName = new Label("John Doe");
Label lblStreet = new Label("123 Hello Street");
Label lblCityStateZip = new Label("MadeUpCity, XX 55555");
VBox vBox = new VBox(lblName, lblStreet, lblCityStateZip);
//Create PopOver and add look and feel
PopOver popOver = new PopOver(vBox);
// I always want to see my header
popOver.setHeaderAlwaysVisible(true);
Label label = new Label("Mouse mouse over me");
label.setOnMouseEntered(mouseEvent -> {
popOver.show(label);
((Parent)popOver.getSkin().getNode()).getStylesheets().add(getClass().getResource("Style.css").toExternalForm());
});
StackPane root = new StackPane();
root.getChildren().add(label);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
And the CSS:
.popover > .border {
-fx-stroke-width: 0.5;
-fx-fill: rgba(200,200,200, 1);
-fx-text-fill: red; /* This doesn't work, but is what I am looking for */
}
.popover > .label {
-fx-text-fill: red; /* This doesn't work, but is what I am looking for */
}
How can CSS change the title color to red?