frame.addWindowListener( new WindowAdapter() {
public void
windowClosing(WindowEvent we) {
player.stop( ); //
when user closes the
player.close( ); // application frame stop the player
System.exit(0); // and release its resources.
}
}
);
frame.setVisible(true);
player.start( );