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

JOptionPane freezes !  RSS feed

 
Hetal Seth
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I am using a JOptionPane during a dragndrop (DnD) operation. In my application, if either the source or the target is an invalid object, then i pop up
JOptionPane.showMessageDialog(null, "Invalid Operation", "Alert", JOptionPane.INFORMATION_MESSAGE);
The message pops up and the entire application freezes ! You can't even click the 'ok' button.
Any clues ?
Appreciate ur assistance.
Hetal Seth
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
During what part of the dnd operation do you open this window?
Are their no exceptions thrown?
 
John Smith
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've come across this problem before. Check out this statement from http://java.sun.com/products/jfc/tsc/articles/dragndrop/

A bug prevents the dialog from being shown directly in the drop() method, so SwingUtilities.invokeLater() is used to show the dialog on the next leg of the event dispatch thread.
 
Hetal Seth
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friend,
thanx a lot for ur valuable info. infact i was usin the SwingUtilities.invokeLater() in the drop() method. this solves my curiousness.
thanx,
hetal
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!