Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When cell selection is enabled in TableView then selection color is different #108

Open
PavelTurk opened this issue Aug 24, 2024 · 0 comments
Labels
bug Something isn't working needs investigation

Comments

@PavelTurk
Copy link

This is code:

public class JavaFxTest10 extends Application {

    private static record Student (int id, int mark) {};

    private TableView<Student> table = new TableView<>(FXCollections.observableList(
            List.of(new Student(1, 3), new Student(2, 4), new Student(3, 5))));

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        Application.setUserAgentStylesheet(new Dracula().getUserAgentStylesheet());

        var idColumn = new TableColumn<Student, Integer>("Id");
        idColumn.setCellValueFactory((data) ->  new ReadOnlyObjectWrapper<>(data.getValue().id()));
        var markColumn = new TableColumn<Student, Integer>("Mark");
        markColumn.setCellValueFactory((data) ->  new ReadOnlyObjectWrapper<>(data.getValue().mark()));
        table.getColumns().addAll(idColumn, markColumn);
        table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        table.getSelectionModel().setCellSelectionEnabled(true);

        VBox root = new VBox(new TextField(), table);
        var scene = new Scene(root, 400, 300);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

If you run it with AtlantaFX you will get this result:

Peek 2024-08-24 20-25

If cell selection is disabled then you will get this result:

Peek 2024-08-24 20-31

As you see selection color is different in both cases. However in pure JavaFX selection color is always the same:

Peek 2024-08-24 20-25b

Is this a bug I misunderstand something?

@mkpaz mkpaz added bug Something isn't working needs investigation labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation
Projects
None yet
Development

No branches or pull requests

2 participants