• 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

Using JTable to view a database table

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic