This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unknown Exception in SwingGraphics!  RSS feed

 
Ashish Chopra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While running a code that draws up a display using swing, I am getting the following exception. Has anyone faced this problem before?

Nothing in this exception even remotely relates to my code. Please help!!!

The only clue i have is that this happens during display updates, that are done in a seperate thread.



TIA
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threads and Swing can be tricky. It's possible that you are trying to update a components view when that component has gone out of scope, been destroyed, is being updated by the EDT or something like that. Although the stacktrace makes no mention of your code, it would be helpful to have a bit more information.

When exactly does this happen? When you press a button? If it's durring an action, what is taking place during this action. And maybe some relivant source code like where you spawn the new thread, etc would be very helpful.
 
Ashish Chopra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The crux of the problem is that I am unable to reproduce it with the same scenario twice.

No there are no button click involved. What happens is that the display is invoked by the data model controller class in a thread & is notified that there is a model update. The display controller class then updates the display by getting values from the model & putting them up on the display.

I am not sure if this gives you some hint, as I can't post the code here(for official reasons). I hope u understand.
 
sayan maity
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use SwingUtilities.invokeLater() method. Try this out I think it can solve your problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!