• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple Swing question about event handling threads  RSS feed

 
Leroy J Brown
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I understand this but I'd like to make sure.
The book I'm currently working with is talking about event handles in the run-time library thread and I made a little test app to show teach myself about event handlers and exactly what mouse/key window events will cause what interface required methods to be handled in what way.


So what I believe the author is saying is that all my System.out.println(x) calls are actually being evaluated by a run-time library thread and I should ensure that when I'm writing real apps what is in the event handler method should be a very short call to a method outside to ensure that all my logic is being run in one of my threads. Does that sound accurate?
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what I believe the author is saying is that all my System.out.println(x) calls are actually being evaluated by a run-time library thread and I should ensure that when I'm writing real apps what is in the event handler method should be a very short call to a method outside to ensure that all my logic is being run in one of my threads. Does that sound accurate?
I'm not sure what you mean here. My guess is that they are talking about running things on and off of the EDT, the event dispatch thread, and that if you have any time or CPU-consuming activities, that they be called in a background thread and not in the EDT. For example:

 
Leroy J Brown
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats it exactly. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!