Results 1 to 4 of 4
  1. #1
    Denis2k11 is offline Member
    Join Date
    Oct 2012
    Posts
    35
    Rep Power
    0

    Question Passing ArrayList<String> elements to an Object[] array to use them in a menu?

    I want to write a program that will read in dates from a file and then store them in an ArrayList of string type. I want to then take them out of the arraylist and put them in an Object[] menu to use them in a JOptionPane menu. Is this possible at all?? Can someone give me a sample or some tips? Thanks Guys!

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,058
    Rep Power
    5

    Default Re: Passing ArrayList<String> elements to an Object[] array to use them in a menu?

    Get in the habit of using standard Java naming conventions!

  3. #3
    Denis2k11 is offline Member
    Join Date
    Oct 2012
    Posts
    35
    Rep Power
    0

    Default Re: Passing ArrayList<String> elements to an Object[] array to use them in a menu?

    Um, I still don't understand.
    Java Code:
    public class theDates
    {
    	public static void main(String[]args) throws IOException
    	{
    		String results = "";
    		Payment findDates = new Payment();
                    String PropertyID = "1";
    //Finds all the dates associated with a specified PropertyID
    		ArrayList<String> Dates = (findDates.getDates(PropertyID));
    		Object[] dateSelection = {};
    //Want to know if it is possible to but the arraylist elements into the dateSelection array so I can use them as menu options???
    		Object select = JOptionPane.showInputDialog(null,"Please pick the first date: ", "Main Menu", 3, null, dateSelection, dateSelection[0]);
    	}
    }

  4. #4
    Denis2k11 is offline Member
    Join Date
    Oct 2012
    Posts
    35
    Rep Power
    0

    Default Re: Passing ArrayList<String> elements to an Object[] array to use them in a menu?

    Wait, I got it!! Thanks so much! :D

Similar Threads

  1. Replies: 2
    Last Post: 02-13-2012, 06:39 AM
  2. Replies: 15
    Last Post: 08-19-2011, 03:08 AM
  3. Passing an object or string array as byte[]
    By AedonetLIRA in forum Advanced Java
    Replies: 0
    Last Post: 11-03-2010, 11:33 PM
  4. Get value of a String into elements of an Array.
    By mainy in forum New To Java
    Replies: 1
    Last Post: 08-01-2009, 09:17 PM
  5. Adding elements to an Object Array
    By aneesahamedaa in forum New To Java
    Replies: 4
    Last Post: 09-07-2008, 03:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •