Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PropertyChange fires twice after task is cancelled  RSS feed

Eric Juneau
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a task that can get cancelled right away if some parameters are null. If this is so, the task is cancelled, and in propertyChange method, a JOptionPane comes up with a warning. However, it seems that the app is running so fast that the propertychange method is run twice, so two JOptionPanes appear with the same information. If I put in a time-wasting loop before the task is cancelled (ex. for(int i=0;i<10000;ii++){ System.out.println("");}), the propertyChange method is called only once. Is there something I'm doing wrong?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!