• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread problem

 
Ranch Hand
Posts: 143
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!
 
Ranch Hand
Posts: 63
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you use a thread to perform the task?
 
Lakshan Dissanayake
Ranch Hand
Posts: 143
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

try dispose method in window close action listeener

Thanks,
Madhava
 
Lakshan Dissanayake
Ranch Hand
Posts: 143
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic