GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes JList data from a database - 2 columns - 1 column hidden Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList data from a database - 2 columns - 1 column hidden" Watch "JList data from a database - 2 columns - 1 column hidden" New topic
Author

JList data from a database - 2 columns - 1 column hidden

Stephen Boston
Ranch Hand

Joined: Jul 14, 2005
Posts: 165
Hi gang.

I'm working on a application that uses a JList to hold a result of a query to a database. What I'd like the JList to show is the names of the query result with the record number of the result as a hidden value in the JList.

Example

query result holds:

1,project 1
2,project 2
16, project 3

JList displays
project 1
project 2
project 3

Selecting the item in the JList will allow the program to pull the first column that is not visible and use it to make another query to the database.

Is this possible in Java using JList? Or is there a differnt component that I should be using?

Thanks!

Steve


Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
try this (click on any item in the JList to display the full data)

Stephen Boston
Ranch Hand

Joined: Jul 14, 2005
Posts: 165
Michael,

You are, without a doubt, my hero!

That is exactly what I was looking for.

Thank you very much!

Steve
 
GeeCON Prague 2014
 
subject: JList data from a database - 2 columns - 1 column hidden