• 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

What would be best solution?

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey everyone,

I have a booking sheet that I am making, for my portfolio mainly.

I was wanting to know the best way of storing the data that will be put into JTextAreas, I previously tried to do this to a normal file like myfile.ser.

but I want to be able to store the data so that there is structure, so could my java program save to something like excel, or CSV file? would this be a good easy option? or is there better ways of storing the data?

can someone point me in the direction on how to do this? or show me a link to some page that can explain it further?

davy
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you give us an idea of the content you want to save? Is the data itself structured, or is just the text that's displayed in the JTextAreas?

If the former, then there are any number of file formats that could be used, depending on how it is structured: XLS, CSV, XML, Properties files, ...
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey ulf,

well in the JTextAreas it will just be Strings I will save, and in my stats area just ints.

here is a pic of what I mean.


but I was wanting to save the per day, as I will need to use the stats at some point, I will have my date picking calendar get 2 dates and add all of the stats up between those dates picked.

thats why I was thinking either excel or CSV.
if so can Java do it?

davy
[ March 19, 2007: Message edited by: Davy Kelly ]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could certainly use CSV or XLS (some helpful libraries are linked here), but since the data isn't really tabular that would be a bit of a hack.

I might use XML, either creating it directly through one of the DOM libraries (JAXP, XOM, JDOM, dom4j, ...) or -if your data structures are amenable to that- by way of the java.beans.XMLEncoder/XMLDecoder class. Examples of that can be found here under "Serialization". Don't let the term "serialization" confuse you - they write and read XML.
[ March 19, 2007: Message edited by: Ulf Dittmer ]
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf,

thanks for your quick reply.

I dont know anything to do with Beans, so I think that would confuse me right now.

the strings would be amendable in the areas, say if someone cancels then they get taken out, or if they move their booking...

I looked at a couple of places, and most of them only give a certain amount of code (so I cant see what they are fully doing), or want me to purchase their app.

basically, I want to store the data, retrieve the data possibly amend the data & calculate some of the data.

davy
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic