Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Simple Swing question about event handling threads

 
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?
 
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.
 
Nothing? Or something? Like this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic