Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread problem

 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a JFrame and add button with ActionListener (I know how to perform an action on ActionEvent )

i used a thread to perform a task by following code snippet



PROBLEM:

But if user closes JFrame accidentally before executing myMethod() task will never performed.
I need to perform complete execution of myMethod() even user closes JFrame accidentally.
How do i do that? I'm an absolute beginner for Threads,Runnable ...

Thanks !!
 
Niraj Jha
Ranch Hand
Posts: 63
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you use a thread to perform the task?
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niraj Jha wrote:Why do you use a thread to perform the task?


Because i need to get a print using Jasper Reports.
It is painfully SLOW and unable to do anything till JasperViewer previews print.
So I decided to use thread for jasper Report printing process
 
madhava Thamata
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

try dispose method in window close action listeener

Thanks,
Madhava
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
madhava Thamata wrote:Hi,

try dispose method in window close action listeener

Thanks,
Madhava


Oh! I almost forget it.
Thanks for the posts guys!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic