Question

I want my program to terminate itself once the movie played has ended, using system.exit(0).

is there a way of doing that?

I dont want to use Timer.

Was it helpful?

Solution 2

Got it!

    player.addControllerListener(new ControllerListener()

    { 

      public void controllerUpdate(ControllerEvent e) 

      {   

      if (e instanceof EndOfMediaEvent) 

        {   

        System.exit(0); 

        }

      } 

    } 

OTHER TIPS

The OP posted this answer as a comment.

 player.addControllerListener(new ControllerListener() {
     public void controllerUpdate(ControllerEvent e) { 
        if (e instanceof EndOfMediaEvent) { 
            System.exit(0); 
        }
     }
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top