Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: [Beginner]

  1. #1
    Junior Member
    Join Date
    Oct 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [Beginner]

    can s
    Last edited by adem2660; October 3rd, 2014 at 05:22 PM. Reason: typo


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: [Beginner] Populate JComboBox with ArrayList

    I need it to do is to populate the drop down list in the JComboBox with the hotel information
    The code populates the JComboBox from the hotelArr array OK for me.
    I've defined it like this for testing:
    		Object[] hotelArr = {"line 1", "line 2", "line 3"}; // getHotelInfo() };
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Oct 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: [Beginner] Populate JComboBox with ArrayList

    Quote Originally Posted by Norm View Post
    The code populates the JComboBox from the hotelArr array OK for me.
    I've defined it like this for testing:
    		Object[] hotelArr = {"line 1", "line 2", "line 3"}; // getHotelInfo() };

    I think I might've misunderstood you.

    That piece of code you just provided me with only adds "line 1", "line 2", "line 3" to the list. It doesn't take anything from the getHotelInfo? (but then again, that's commented out).

    It should take the information that is stored in my ArrayList and put it there instead of handwritten text (i.e. "line 1" etc).

    Thanks for answer, though!

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: [Beginner] Populate JComboBox with ArrayList

    I can print out the content of the ArrayList perfectly fine, but when I try to do it in my GUI class it just prints empty brackets "[]"
    Please copy what is printed out and paste it here.

    --- Update ---

    Also posted at: [Beginner] Populate JComboBox With ArrayList. - Java | Dream.In.Code

    Please read: http://www.javaprogrammingforums.com...s-posting.html
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. how do i populate jcombobox from mysql query?
    By ankit1122 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 13th, 2014, 05:15 AM
  2. Populate an array?
    By javaman1 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 20th, 2014, 05:37 PM
  3. Help making and iterating through ArrayList (Java Beginner)
    By Sammis in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 20th, 2013, 06:58 AM
  4. Why I populate 2 times the same jTable
    By tomrey in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 20th, 2013, 01:28 PM
  5. Why I populate 2 times the same jtable
    By tomrey in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 20th, 2013, 01:22 PM

Tags for this Thread