• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing threading issue

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
before I ask my question, I want to note that I know having code is almost mandatory for any real help,
but I want to refrain from adding code this time because it's a lot of code, and it is somewhat in an "in between" state.

Moving on...

I wrote a hangman game a few days ago, and it works fine on command line (or eclipse).
However, I am currently working on a GUI for the game. The way the game works
is it gets a user guess (a letter), and it checks if it's part of the word that has to be guessed.
The issue I'm facing is, when I guess the first guess, the game runs fine,
when I guess the second guess, the game runs fine, but after that, any more guesses don't get processed.
However, when I run the game in debug mode, any number of guesses work fine, and the game runs fine.
Moreover, the only thread that stops running when I encounter a breakpoint is main...
is it possible that there's some sort of threading issue, and I should make main sleep?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you say, you haven't shown us any code. But if you're writing a Swing GUI and you're using threads for the problem you described, then you're doing it wrong. The GUI for that should be fairly simple, and the only requirement is for the code to respond to the user entering a letter. Which doesn't require you to write any multi-threading code.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch
There is a section about threads in the Java Tutorials.
 
reply
    Bookmark Topic Watch Topic
  • New Topic