Answer the question
In order to leave comments, you need to log in
How to display data in the table of a new window?
The controller of the main class, in which a new window is called by clicking on the button:
it passes the text from the text field
public void actionFilter(ActionEvent actionEvent) {
Filter filter = new Filter(loadTextArea.getText());
filter.print();
FilterMain filterMain = new FilterMain();
try {
filterMain.start(new Stage());
} catch (Exception ignored) {
}
}
@FXML
public TableView<Filter> tableView;
@FXML
public TableColumn<Filter, String> columnWord;
@FXML
public TableColumn<Filter, Integer> columnFrequency;
@Override
public void initialize(URL location, ResourceBundle resources) {
columnWord.setCellValueFactory(new PropertyValueFactory<>("word"));
columnFrequency.setCellValueFactory(new PropertyValueFactory<>("number"));
tableView.setItems(filters());
}
private ObservableList<Filter> filters(){
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