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 2 of 2

Thread: How do I add a String array to a list in jFrame (java)?

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

    Default How do I add a String array to a list in jFrame (java)?

    public void showList(){
    List1.removeAll();
    for (int i = 0 ; i < fictional_characters.length ; i++)
    {
    String value = fictional_characters[i];
    List1.add (fictional_characters[i]); //THIS LINE DISPLAYS AN ERROR SAYING "no suitable method found for add(String)"
    }
    }

  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: How do I add a String array to a list in jFrame (java)?

    Can you post the declaration for the variable: List1?
    What does the API doc say for the add method?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Count occurrence of a string in an array list
    By Parth Raval in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 1st, 2014, 12:04 AM
  2. [SOLVED] Game problem: java.lang.IndexOutOfBoundsException with array list
    By The_pizzaguy in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 23rd, 2013, 11:30 AM
  3. Convert List<Set<String>> to string array
    By shatlav in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 4th, 2013, 08:16 AM
  4. [SOLVED] Sorting an object array using string variables from a string array
    By Shadud in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 26th, 2012, 05:50 PM
  5. Please help me figure out how to work with a linked list in a JFrame. Agh!
    By BloomingNutria in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 12th, 2012, 12:53 PM