views:

269

answers:

1

I have a project with a jTable called AchTable, that is like this:

+-------+------+
| File  | Type |
+-------+------+
|       |      |
|       |      |
|       |      |
+--------------+

And I have a mySQL table that is like the same, then I want to know how could I populate the jTable.

+1  A: 

So what is the problem, creating a table or creating an SQL query?

Read the section from the Swing tutorial on How to Use Tables.

Read the tutorial on JDBC Database Access.

Put the two together and you've got your problem solved. That is first create your query and create a ResultSet. Then you use the meta data to get the column names. Then you loop through the ResultSet and add rows of data to your table. You can use a DefaultTableModel for this.

camickr