I make an application on JavaFX. SQLite database.
There is a table "category1" and fields in it: "ID", "question, answer"
In the main window, I have two labels. When I start the application, I fill the database. My application has the function of adding texts, deleting, or editing. The number of rows in the base SQlite will constantly change.
I need to save the text from each column to an array (any list from the collection framework) The text from the question column is associated with the text from the "answer" column for each row in the table.
If I press, for example, the number 1 on the keyboard, then one random question from the array should appear in the first label, and the corresponding answer should appear in another label. After the texts appear, they must be removed from the array. In other words, every time I click on the number 1, different random questions from the table should appear in the labels, but there should not be duplicates. Therefore, I want to remove them from the array immediately.
If I close the program and open it again, the arrays should be filled with questions automatically from the table.
How to create arrays for texts from a SQLite table that will be automatically updated?
Labels:
@FXML private Label lb_randomCard, lb_randomCardBack; 