• 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

creating a front end for a query which

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, after some research i think the answer to this is the Vector Class...
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic