Results 1 to 2 of 2
  1. #1
    barusk is offline Member
    Join Date
    Feb 2009
    Rep Power

    Default Halt applet processes.

    Small problem that is probably easy. If there is a process running in an applet which takes awhile to complete. is there a way i could halt the process, by clicking some gray space on my frame? is there anyway that this could be done. i've done some research on halting processes, but i haven't gotten any headway in this. if anyone could help please do.
    thanks in advance.

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Cambridge, UK
    Rep Power


    A structure similar to this:
    Java Code:
    public class Job extends Thread {
        volatile boolean stopped = false;
        public void run() {
            for (int i; i<lim; i++) {
                if (stopped) break;
                // do stuff
            // clean up
    Clicking the button can then set stopped to true, allowing controlled termination of the process. If the computation you are doing cannot be characterised by some kind of loop then you just have to check it periodically. This is the simplest way of doing it, there are many ways to make it better, using different kinds of synchronisation and access patterns. If you want to return intermediate values, then use a SwingWorker.

Similar Threads

  1. Too many java.exe processes due to netbeans
    By abhishek.jain in forum NetBeans
    Replies: 7
    Last Post: 12-29-2009, 01:52 PM
  2. Calling another applet on click of button in one applet
    By niteshwar.bhardwaj in forum Java 2D
    Replies: 1
    Last Post: 02-19-2009, 12:54 PM
  3. need applet help !
    By fadiRU in forum Java Applets
    Replies: 2
    Last Post: 02-08-2009, 02:29 AM
  4. netbeans processes don´t die
    By karlen in forum NetBeans
    Replies: 0
    Last Post: 06-11-2007, 09:55 PM
  5. Replies: 4
    Last Post: 06-08-2007, 06:15 AM

Posting Permissions

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