This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Not seeing names recorded from JOptionPane in array

 
Ranch Hand
Posts: 105
3
Chrome Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, so what im trying to do is create a button that allows the player of my game to enter the number of players they want competing in their tournament. Then they enter the names of the contenders which gets recorded and stored in an array for use later. I created a playerList method to check if it was recording the names correctly, but it keeps returning null without any names. Im intending to use these names later to set up matches between players for advancement in the tournament, so this is a vital part of my project. If anyone could help it would be much appreciated. Thanks and have a great day!



This is the code i consider important to this part of the project. If you need it, I can post the rest of the code for the class, but that code does not effect what I am trying to do here.
 
Marshal
Posts: 69763
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth are you using applets? They are obsolete. Nobody uses them any more.
Why are you using an actionPerformed method to add action listeners to components? Add the listeners straight off in the init method.
You are confusing things by using the same identifier for a List and for a method. But that method is marked void. All the things about new frames in that method look bad. Please write down with a pencil exactly how you are entering names. Write down where those names are going and what status their recipient has.
 
I promise I will be the best, most loyal friend ever! All for this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic