0

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?

kleopatra
  • 50,242
  • 28
  • 96
  • 201
Evgenij Reznik
  • 16,978
  • 34
  • 97
  • 170
  • 2
    Please research your topic before asking a question; there are many tutorials out there which can be found with a simple Google search. – Dennis Jan 06 '12 at 04:18
  • duplicated at http://stackoverflow.com/questions/8774481/filling-object-data/8774505 and http://stackoverflow.com/questions/8775076/jtablejdbc-easiest-way – alf Jan 08 '12 at 11:05

3 Answers3

3

Check out this tutorial: How to Use Tables

Jason Braucht
  • 2,350
  • 19
  • 31
Eve Freeman
  • 31,420
  • 2
  • 83
  • 97
2

Seems your question is similar with these two questions:

How to fill data in a JTable with database?

Displaying data from database in JTable

Community
  • 1
  • 1
Haoming Zhang
  • 2,448
  • 2
  • 24
  • 31
0

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.

chubbsondubs
  • 36,075
  • 24
  • 100
  • 134