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.

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32

Thread: Components?

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,582
    Thanks
    49
    Thanked 2,233 Times in 2,205 Posts

    Default Re: Components?

    read a certain line of an ArrayList...
    What variable is the ArrayList that you are trying to get data from? Using []s is for arrays.
    An ArrayList is a class which means you need to use its methods to get to its contents.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Re: Components?

    I'm converting ints to strings to add to an array list and then trying to read the line of the arraylist to convert it back to an int. What method should I use to get the int/string?
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)

  3. #28
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,582
    Thanks
    49
    Thanked 2,233 Times in 2,205 Posts

    Default Re: Components?

    For int to String see the String class's value of method or the Integer class's toString method.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #29
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Re: Components?

    I'm already using toString, the problem is reading the string from the ArrayList. I'm thinking the toArray() method might be the answer, but it seems like it wastes resources.
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,582
    Thanks
    49
    Thanked 2,233 Times in 2,205 Posts

    Default Re: Components?

    the problem is reading the string from the ArrayList.
    Please post the code you are having trouble with and describe what the problem is.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Re: Components?

    Nevermind, I saw a method in the suggested endings list in Eclipse called ".get(index)". Apparantly Arraylist.get(index) was exactly what I needed! Thanks for all the help you guys!
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,582
    Thanks
    49
    Thanked 2,233 Times in 2,205 Posts

    Default Re: Components?

    Reading the API doc for the classes you are using can make writing code easier.
    See post #26.
    If you don't understand my answer, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Layout components...help please
    By alphasil in forum AWT / Java Swing
    Replies: 6
    Last Post: January 26th, 2012, 07:28 AM
  2. Components I add to JApplet won't appear!
    By austin.rose94 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 6th, 2012, 10:47 AM
  3. Laying out components.
    By newbie in forum AWT / Java Swing
    Replies: 1
    Last Post: August 14th, 2011, 04:37 AM
  4. how to position gui components
    By programmer1 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 11th, 2011, 12:45 PM
  5. Interaction between components.
    By SyntheticD in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 9th, 2011, 06:32 PM