Code: Select all
JAVA:
public class NewMain extends Application {
@Override
public void start(Stage primaryStage) {
ComboBox comboBox = new ComboBox();
comboBox.getItems().addAll("Option 1", "Option 2", "Option 3");
comboBox.getStyleClass().add("yellowed");
VBox vbox = new VBox(comboBox);
Scene scene = new Scene(vbox, 400, 300);
scene.getStylesheets().add(NewMain.class.getResource("test.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
CSS:
.combo-box.yellowed {
-fx-background-color: yellow;
}
.combo-box-popup.yellowed > .list-view > .virtual-flow > .clipped-container > .sheet > .list-cell {
-fx-background-color: yellow;
}
Könnte jemand sagen, ob es eine Möglichkeit gibt, dem Popup einer bestimmten ComboBox eine Stilklasse hinzuzufügen?