Swing GUI - Image contain id# of database element
Posted on 2003-03-26
Okay, I wasn't sure how to title my question but I think that one fits. What I am trying to do is query a database (Oracle) and select the id#, first name and last name of users. I can do this with a simple SQL statement. I then want to display all the current contacts in the list but first and last name (alphabetically by last name) and beside those names there are icons which say View, Edit, Delete.
Bill Adams VIEW EDIT DELETE
John Doe VIEW EDIT DELETE
Bob Zee VIEW EDIT DELETE
I understand how to access the names and know how to print the data off into a normal terminal screen by using a very basic while loop.
System.out.println(resultSet.getString(1) + " " +
and that prints the names just fine. I believe I have an idea on how to do that with the GUI as well but haven't fully tested it out. What I need to know is how do I set it up so that the same 3 images appear for all the names but so that each image is uniquely identified to the name it appears beside. I was thinking of doing this with the id# but I know that images cannot hold this other information. Another idea I had was to store the images in the database along with the names but this would be an extreme waste of space because all rows in the database would contain the same image.
I need it so that if I click on VIEW for instance for the name John Doe I would get all of the information from the database that is listed under John Doe.
Any help would be great. Thanks.
Let me know if I didn't make any sense I'll try to explain better.