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
  • 51,061
  • 28
  • 99
  • 211
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
  • 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,358
  • 19
  • 31
Eve Freeman
  • 32,467
  • 4
  • 86
  • 101
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,672
  • 2
  • 28
  • 32
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
  • 37,646
  • 24
  • 106
  • 138