Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Stephen Boston
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this (click on any item in the JList to display the full data)

 
Stephen Boston
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,

You are, without a doubt, my hero!

That is exactly what I was looking for.

Thank you very much!

Steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic