I am creating a page (in JavaFX) and wanted to show the contents of the table in the Sqlite database that are stored as LinkedList<> in a code, in my JavaFx I have created TableView that's structure is identical to the ones that in database.
So here is my code:
@FXML
private TableView<Question> tableview;
@FXML
private TableColumn<Question, String> id;
@FXML
private TableColumn<Question, String> question;
LinkedList<Question> all = new LinkedList<Question>();
try {
//list_of_questions();
all = ConnectionProvider.allQuestions();
} catch (SQLException e) {
e.printStackTrace();
}
id.setCellValueFactory(new PropertyValueFactory<>("id"));
question.setCellValueFactory(new PropertyValueFactory<>("name"));
list.addAll(all);
tableview.setItems(list);
Here, method allQuestions of class ConnectionProvider returns LinkedList with data from the table in the database
So, I just want it to be visible in table-view
And also, I wanted to pass the value (quizId) from the previous page to the current page and am not sure how to do this, maybe I should use the constructors