Answer the question
In order to leave comments, you need to log in
Why doesn't the code below work?
This code works, displays data in a table.
public class FilterController{
@FXML
public TableView<DataFilter> tableView;
@FXML
public TableColumn<DataFilter, String> columnWord;
@FXML
public TableColumn<DataFilter, Integer> columnFrequency;
@FXML
public void initialize() {
columnWord.setCellValueFactory(new PropertyValueFactory<DataFilter, String>("word"));
columnFrequency.setCellValueFactory(new PropertyValueFactory<DataFilter, Integer>("number"));
tableView.setItems(data());
}
ObservableList<DataFilter> data(){
ObservableList<DataFilter> list = FXCollections.observableArrayList();
list.add(new DataFilter("город", 1));
return list;
}
}
public class FilterController{
@FXML
public TableView<DataFilter> tableView;
@FXML
public TableColumn<DataFilter, String> columnWord;
@FXML
public TableColumn<DataFilter, Integer> columnFrequency;
@FXML
public void initialize() {
columnWord.setCellValueFactory(new PropertyValueFactory<DataFilter, String>("word"));
columnFrequency.setCellValueFactory(new PropertyValueFactory<DataFilter, Integer>("number"));
tableView.setItems(data());
}
ObservableList<DataFilter> data(){
ObservableList<DataFilter> list = FXCollections.observableArrayList();
Filter filter = new Filter();
return filter.observableList();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question