• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating a front end for a query which

 
Max Vandenburg
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

This is my first ever post. so here we go...
Im trying to get "names of customer" from a "customer" table and displayed them in a GUI. where it will display the first record, and when i click the "next" button it will display the next record...

what i have done:
- i've created a simple testing GUI which has a JLabel, 2 JButton (for Previous and Next button), and a JTextField to display the customer name itself.

- i've also made a connection to the database, i.e. create connection, register the driver, create resultset, metadata etc.

this is where im stuck:
- so far by using this statement i can print out the list of names


Im guessing, instead of printing this values to the console, i want them to be stored in some kind of array... so i would have to create an String array beforehand and store it there... the problem is that i need to know what the arraysize (i.e. the number of records is in the table) before i can use the array. so get the size of the array,i would have to go thru the same method above but instead of printing it out, i add an "int" counter which i, then use for my array... as you can see this method is messy...

anyone got any idea/best practices on how to approach this problem? basically i want to the result from my query somewhere, where later, i can use display them in my JTextField?
[ April 04, 2006: Message edited by: Bear Bibeault ]
 
Max Vandenburg
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, after some research i think the answer to this is the Vector Class...
 
stu derby
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Firman Drage:
Ok, after some research i think the answer to this is the Vector Class...



... or any of the other Collection types, using one that has ordering if you need an ordered list.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic