Answer the question
In order to leave comments, you need to log in
Saving user actions in java program?
Hello. I'll start with a banality in java newbie)). I started working on one project, the essence of which is to store user data received from a text field (JTextField) in a table (JTable). There are three fields, a table and an "Add" button, the user fills in the fields and presses the button, the data is instantly displayed in the table and saved to a file. But of course, if you close the program and run it again, all received data disappears. And well, Java gurus direct me to useful resources, I have already rummaged through the entire Internet!
Answer the question
In order to leave comments, you need to log in
Good afternoon!
1) Let's start with the fact that you need to select the database in which you will store the data. For example sqlite.
https://www.sqlite.org/index.html
2) You need a driver to work with the database of your choice. In java - jdbc.
https://github.com/xerial/sqlite-jdbc
For convenience, you can master ORM technology and study hibernate or mybatis, etc. You can take at least - ormlite.
3) Next, you get the information entered by the user, if necessary, validate it and write it to the database.
4) At the next start of the application, the data in the JTable is filled from the database.
https://www.youtube.com/watch?v=jpGn8rd_3Sc
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question