aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Using JTable to view a database table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Using JTable to view a database table" Watch "Using JTable to view a database table" New topic
Author

Using JTable to view a database table

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
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


Java API Documentation
The Java Tutorial
Scott Delap
author
Ranch Hand

Joined: Apr 05, 2005
Posts: 73
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

Joined: May 09, 2005
Posts: 6
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

Joined: Dec 06, 2001
Posts: 3061
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

Joined: Dec 06, 2001
Posts: 3061
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using JTable to view a database table