Reputation: 18521
I would like to present a database table in my Swing app.
Very simple table, it should display data that consists of one or a few tables in the database.
The user should be able to add, delete and update the table and then press save.
(not mandatory, it could just save each time he changes values )
Upvotes: 0
Views: 1630
Reputation: 52185
Usually a JTable is used to render database data in a table format, you can see how here.
It is also recommended that you split your GUI and Database access logic into separate classes. Also, it might be a good idea to execute Database operations on a thread which is not the Event Dispatcher Thread (EDT) since this might make your application's UI hang.
With regards to database access, you can use and ORM framework such as Hibernate. It will allow you to connect to your database and retrieve information regardless of what database you are using. You can also change your underlying database at any point in time without you having to rewrite your SQL queries to fit the Database engine you are using.
You can use JFrames to create forms with which you can add and/or remove data.
Upvotes: 4