File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JOptionPane and ArraySize not known Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JOptionPane and ArraySize not known" Watch "JOptionPane and ArraySize not known" New topic

JOptionPane and ArraySize not known

Maureen Charlton
Ranch Hand

Joined: Oct 04, 2004
Posts: 218
If I was to use JOptionPane to get user input, with the opportunity to type exit when the user has finished entering their data, And I wanted to store the data they had input in an array would I have to use a dynamic array? (As I would need the array to grow in size to accommodate the number of user input items to initialise the size of the array).

Or is their an alternative?

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If you want to implement this yourself, it looks like you are on the right track. In that case, you don't need "import java.util.ArrayList". Alternatively, you can use ArrayList which already does this magic for you without any effort on your part.


Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: JOptionPane and ArraySize not known
It's not a secret anymore!