Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multithreading with text input and Swing

 
Martin Ivanov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,
I have a lot of problems with the threads. I have a task: you have a textarea and 3 threads : the first one gets the chars, the second - the words, the third - the sentences. My problem is that it should be done in real time - as long as the user inputs, in the same the three thread must do their job and print in 3 windows. I made it - but the problem is that the threads runs only after hitting enter when you finish writing text.
Can you give me some help how can I do it ? Thanks
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is most likely a swing question, and you didn't TellTheDetails so anything I suggest is just a guess. Provide more info if this doesn't apply.

You are probably using an ActionListener to listen for changes in the text area, if you want to listen to every key press you should either use a key listener or key bindings on the text area.
http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html
http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic