• Post Reply Bookmark Topic Watch Topic
  • New Topic

how can show the data in database to jtable??

 
Soo Samuel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because not same with the textflied and other....
and because many column and row of jatable
wat comand should use and how to fix it.....
need help.....
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soo,
If you installed the entire JDK, you have an example of this -- in the "demo\jfc\TableExample" subdirectory.

Good Luck,
Avi.
 
Soo Samuel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank so much....
except that jtable example also got other example there....
install so long now jz know...haha
 
Soo Samuel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i c though example olreli...
but all the thing not me want once....
how show the data from the database to jtable with many column and row....
help help pls pls....
 
Joe Myn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use
ResultSetMetaData and ResultSet
to loop throug the resultset.
 
Dave Mace
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One approach you can take is to write your own class extending AbstractTableModel which will be used as the model for your JTable. If you do extend this class, there are 3 methods that need to be overwritten:

public int getRowCount();
public int getColumnCount();
public Object getValueAt(int row, int column);

Also this model is where you will handle making cells non-editable...changing cell renderers so that you can do things like implement JComboBox instead of the default renderer, etc etc.

Do a quick google on AbstractTableModel and you'll find plenty of resources.

David
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!