• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JTable to view a database table

 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write a Swing application that accesses a database via JDBC. I found the following expcerpt in the API docs for JTable:

The "TableExample" directory in the demo area of the source distribution gives a number of complete examples of JTable usage, covering how the JTable can be used to provide an editable view of data taken from a database and how to modify the columns in the display to use specialized renderers and editors.


What is the "source distribution" this mentions? Is this a separate download from the J2SE JDK? If it is included with the standard download, where would I find the "TableExample" directory? I'm not currently at my development machine so it's difficult for me to look for it atm.

If anyone can tell me where to find this example, that would be great!

Layne
 
Scott Delap
author
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd actually look into the JDNC project

https://jdnc.dev.java.net

if you want something to quickly get a view of database data in a table. Otherwise, you'll need to write some JDBC yourself and convert the results to fit into a TableModel. Searching for jdbc and JTable or TableModel should come up with some code pretty quickly.

Scott Delap
ClientJava.com
Desktop Java Live
 
Premal Panchal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

go to the following directory which is in the folder of J2SDK...means in the folder that has been created while installing j2sdk...

folder path is:<ur j2sdkfolder>\demo\jfc\TableExample

In this folder u have find one folder with SRC which contains the code...it is the "source distribution"...I hope this will help you.

Regards,

Premal Panchal
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Premal Panchal:
Hi,

go to the following directory which is in the folder of J2SDK...means in the folder that has been created while installing j2sdk...

folder path is:<ur j2sdkfolder>\demo\jfc\TableExample

In this folder u have find one folder with SRC which contains the code...it is the "source distribution"...I hope this will help you.

Regards,

Premal Panchal


Thanks. I found it. It's a little over my head at the moment, but I'll study it more when I have a chance. ATM, I'm working on another part of the project, so I'll get back to this soon (I hope).

Layne
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott Delap:
I'd actually look into the JDNC project

https://jdnc.dev.java.net

if you want something to quickly get a view of database data in a table. Otherwise, you'll need to write some JDBC yourself and convert the results to fit into a TableModel. Searching for jdbc and JTable or TableModel should come up with some code pretty quickly.

Scott Delap
ClientJava.com
Desktop Java Live


Okay, I'll check it out.

Thanks,

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic