我有一个运行 VLCJ 的小程序(http://code.google.com/p/vlcj/)——基本上是在一个小程序中嵌入一个 VLC 播放器。在 Eclipse 中运行时,它运行良好,但我无法关闭调试小程序窗口或以某种方式终止它。我想知道,这是为什么呢?代码中是否有任何内容阻止它停止调试?我必须重新启动 eclipse 才能让它退出。我很确定你不需要添加 destroy() 来启用调试窗口的关闭。
谢谢
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Frame;
import javax.swing.JApplet;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import com.sun.jna.NativeLibrary;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
public class Main extends JApplet {
/**
* @param args
*/
/* entry point */
public void init() {
String file = "110825-155446.wmv"; // only 2-3 seconds clip for minimum storage
runVideo(file);
}
/* runs the video file */
public void runVideo(String file) {
setSize(400,300);
setLayout(new BorderLayout());
Canvas vs = new Canvas();
add(vs,BorderLayout.CENTER);
setVisible(true);
MediaPlayerFactory factory = new MediaPlayerFactory();
EmbeddedMediaPlayer mediaPlayer = factory.newEmbeddedMediaPlayer();
mediaPlayer.setVideoSurface(factory.newVideoSurface(vs));
mediaPlayer.playMedia(file);
try {
Thread.currentThread().join();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}