arrays

Isit possible to store the grand totals of an order into an array? my program processes food orders and displays the grand total into a JTextArea, i want all of the grand totals generated to be saved into a file how would i do this using an array? i thought about adding some sort of listener to the JTextArea would this work?

[333 byte] By [lozengera] at [2007-11-26 19:51:38]
# 1
You can put whatever you want into an array. But why to you want to put a total--a single value--into an array?
jverda at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...
# 2
http://www.i-am-bored.com/bored_link.cfm?link_id=10355
jverda at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...
# 3
all i need to do is record all of the grand totals generated and save them into a file, so they can be viewed at a later date. how would i get the array to store the values from the JTextArea though?
lozengera at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...
# 4

That's kind of a run-on paragraph.

Let's summarize:

1. Arrays or collections can hold most anything you can dream of.

2. What is your goal? Is it to use an array or to save data to a file?

Realize that the second doesn't necessarily imply the first.

3. Getting numerical information from a JTextArea seems to be putting

the cart before the horse. How did the data get there? I think it will

make more sense to acquire the data directly and leave theJTextArea to its own devices.

Comments?

DrLaszloJamfa at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...
# 5
> http://www.i-am-bored.com/bored_link.cfm?link_id=10355Crazy Frog is the Everyman of our time.
DrLaszloJamfa at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...
# 6
yeh my goal is to store all of the grand totals into a file by using an array.the grand total is coming from my " double total sum" the total sum is what outputs the grand total into the JTextArea
lozengera at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...
# 7

> yeh my goal is to store all of the grand totals into

> a file by using an array.

If you store all of the grand totals into a file without using an array,

will you have failed?

> the grand total is coming from my " double total sum"

> the total sum is what outputs the grand total into

> the JTextArea

You can get text from a text area simply by:

String text = theTextArea.getText();

but I still claim that there are easier and better ways to do it --

like get the data from whatever object put the results in the text area.

DrLaszloJamfa at 2007-7-9 22:41:51 > top of Java-index,Java Essentials,New To Java...