• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how can show the data in database to jtable??

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.....
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use
ResultSetMetaData and ResultSet
to loop throug the resultset.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic