mkpaz / atlantafx

Modern JavaFX CSS theme collection with additional controls.
https://mkpaz.github.io/atlantafx
MIT License
791 stars 64 forks source link

DatePicker style issues #70

Closed barmat80 closed 1 year ago

barmat80 commented 1 year ago

Using all themes, DatePicker always renders quite different from AtlantaFX Sampler, but I can't understand why,

datepicker

Below my code (partially copied from the Sampler):

var today = LocalDate.now(ZoneId.systemDefault());
var datePicker = new DatePicker(today);
datePicker.setEditable(false);
datePicker.setPrefWidth(200);

var vbox = new VBox();
vbox.getChildren().add(datePicker);

var scene = new Scene(vbox, 300, 300);
scene.getStylesheets().add(Main.class.getResource("css/nord-light.css").toExternalForm());
primaryStage.setScene(scene);

Am I missing something or doing something wrong?

PS: Something similar happens also with TableView...

mkpaz commented 1 year ago

You haven't set up the theme properly, so your nodes are receiving styles from both Modena and AtlantaFX.

scene.getStylesheets().add(Main.class.getResource("css/nord-light.css").toExternalForm());

You should use the setUserAgentStylesheet() method exactly as specified on the front page.

Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
// or
Application.setUserAgentStylesheet(/* path to the CSS file */);