简体   繁体   中英

Java: Retrieving data from Database and load in JTable

I know how to retrieve data (just text in a table) from a database in Java and how to show it in the console. But I want to load it in a JTable. Is there a good (modern) way (tutorial), without using Vectors?

查看本教程: 如何使用表

Seems your question is similar with these two questions:

How to fill data in a JTable with database?

Displaying data from database in JTable

Check out GlazedLists it comes with ready made TableModels that are based on modern collection interfaces.

http://www.glazedlists.com/

If you don't want to use an extra library. You can easily implement your own javax.swing.table.TableModel . I like to implement TableModel and java.util.List so I'm working with just a simple List, and hooking up any List easily.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM