• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with Storing Data/Retrieving Data from Multiple Text Fields.  RSS feed

 
Jeff Zak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody..

I am trying to create a program that is essentially a parts list for a certain item. I've seen XML documents that do this but I thought it'd be neater to make one in Java. Basically, its a label with the part name, then three text fields representing "model/description", "weight", and "price" of said part name. For my purposes I'm going to need about 35 of these entries on my GUI, which is designed already. I'll also include my totalPrice, totalWeight, and some other stuff, but, my main questions is this.

What would be the best way to store and retrieve this data? In arrays?

Also, do you have any tutorials you can steer me to on a program similar to this? I've been re-acquainting myself with Java by the ProgrammingByDoing website and its helped more than Java in college did, but, its a bit limited with no lesson or book.



 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Zak wrote:What would be the best way to store and retrieve this data? In arrays?

Well, the first thing I'd do is define a Part class that encapsulates everything to do with a single part.

But in answer to your question: No, I'd avoid arrays.

But what you use in its place depends entirely on what you need to do with the data. Java has Lists, Sets, Maps and Queues and which one is the best only you can decide.

My suggestion would be to read this section of the tutorials before you write a single line of code; otherwise you could end up with a big re-write on your hands.

HIH

Winston
 
Jeff Zak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Winston..

Thanks for the suggestions. I did in fact find a much easier way to do what I wanted in the JTable of all things. I stumbled on a pretty good tutorial that will accomplish what I want, albeit with some modifications.

Thanks for all the help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!