This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

event dispatching thread  RSS feed

 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what whould happen if i painted the gui not using the event dispatching thread? for example, textArea.setText ("asdfsad") is called in a user thread but not using SwingUtility.invokeLater (..).
 
Rob Spoor
Sheriff
Posts: 21044
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing is not thread-safe (apart from some small exceptions like JTextArea.append), so the results are unpredictable and your application will probably contain several bugs.
 
luri ron
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks. follow up a design question:
if we need to put every gui update on the event dispatching thread, would this be a performance issue.
for example, if one component in the gui receives 10-20 updates every second and other components are updated through user's actions. in this case, should we seperate these 2 type of updates for better performance?
 
Rob Spoor
Sheriff
Posts: 21044
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How could you separate these? In the end, both need to be executed on the EDT.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!