egor10_4
egor10_4

Reputation: 402

JavaFX TableView select row in Controller.initialize() is not drawn on application start

I try to select a row in a TableView in Controller.initialize() method like this:

public class Controller {
public void initialize() {
 ...
 ObservableList<Operation> rows = FXCollections.observableArrayList(row1, row2);

 table.setItems(rows);
 table.getSelectionModel().select(row1);
 }
}

The application starts and the table row is unselected. If I touch scroll bar the selection appears. And stopping in debug mode during startup I can see it is actually selected.

What is wrong? How that can be fixed?

Upvotes: 0

Views: 138

Answers (1)

egor10_4
egor10_4

Reputation: 402

It were .css rules that specify the same color for an inactive (unfocused) selected row.

Upvotes: 0

Related Questions