Results 1 to 5 of 5
  1. #1
    JOHNINALBANY is offline Member
    Join Date
    Nov 2010
    Posts
    17
    Rep Power
    0

    Default Pausing an application

    I have an application that saves a big picture in my hard drive. This operation takes a while. I need java to pause for at least half a second after the save statement before moving forward. According to what I have read online, it appears that I need to stop the thread. Unfortunately I do not know much about threads. All I know is that my application is initialized with the below code:

    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

    public void run() {
    new HMR52().setVisible(true);
    }
    });
    }

    How can I temporarily pause my application until the picture has been entirely saved?

    Thanks
    Last edited by JOHNINALBANY; 08-23-2013 at 03:48 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Pausing an application

    I think you may get better advice if you explain why you think you need to pause the application after the save is complete.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Pausing an application

    use Thread.sleep(long millis) ...

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Pausing an application

    Quote Originally Posted by allaudin View Post
    use Thread.sleep(long millis) ...
    Usually bad advice in the context of a GUI application.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    JOHNINALBANY is offline Member
    Join Date
    Nov 2010
    Posts
    17
    Rep Power
    0

    Default Re: Pausing an application

    Thanks for your reply

    I need to stop the application because jasper reports is invoked right after the picture is saved. Since it takes long time for the picture to be generated and saved, jasper reports triggers an error when it fails to find the picture.

Similar Threads

  1. Pausing a method till Threads finish
    By Sutured in forum New To Java
    Replies: 0
    Last Post: 03-27-2013, 06:40 PM
  2. Pausing and starting a loop when a button is pressed.
    By xan.amini in forum New To Java
    Replies: 16
    Last Post: 08-11-2011, 08:15 AM
  3. pausing loops?
    By louiedogg418 in forum New To Java
    Replies: 8
    Last Post: 07-05-2011, 11:29 PM
  4. Pausing a Thread
    By Lord Voldemort in forum New To Java
    Replies: 14
    Last Post: 05-22-2011, 04:45 AM
  5. Pausing game when user minimizes window
    By tecno40 in forum Java Applets
    Replies: 1
    Last Post: 12-29-2010, 05:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •