File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Storing user input into 2-d Array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Storing user input into 2-d Array" Watch "Storing user input into 2-d Array" New topic
Author

Storing user input into 2-d Array

John Rhoter
Greenhorn

Joined: Jul 15, 2010
Posts: 1
Hello,

I'm trying to store two decimal numbers that the user will input into a two-dimensional array. The entire program is a GUI so, I'm only posting a little of the code

The problem I'm having is getting the user input to append to the next line in the text box.

Example, user enters "1" and "2" and presses the action button, then enters "3" and "4" In the output text box it should read as:

1 2
3 4

But right now it overwrites my number output.

Thanks in advance for the help!

Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 490


It appears to me you are updating everything right, you are just not appending the right values. Also where do you read in the data? You could be only reading from the user once.

Hunter


"If the facts don't fit the theory, get new facts" --Albert Einstein
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32830
    
    4
Welcome to the Ranch

And I shall be pedantic and remind you there is no such thing as a 2D array in Java; there are only arrays of arrays.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32830
    
    4
Thank you for the PM; if you look up arrays in the Java™ Tutorials, you find a "multidimensional array" is actually an array of arrays.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Storing user input into 2-d Array
 
Similar Threads
For Each Loop
Building Array with jButton
Binary to Decimal conversion
2D Array problem
Problem with Email Program in TCP