DOC

3348.docjava

By Jessica Taylor,2014-10-15 23:02
12 views 0
3348.docjava

    由于程序的原因:本文件未被完整保存。

    首页 ? 研究文集 ? Java GUI

    SWT+JMF乱真windows播放器 Zergling 原创 (参与分;12866:专家分;115) 发表;2003-07-22 21:03 更新;2003-07-23

     14:48 版本;1.0 阅读;5784

    SWT的最大好处是windows具有窗口风格:把SWTJMF结合使用:windows的外框:java的播放器:你觉得

    我这个想法如何~

    如果你要运行我的代码:你必须安装JMF2.1.1e并且将swtjar文件导入(记得要将swt-win32-2135.dll

    在执行路径下)

    1. import java.awt.BorderLayout;

    2. import java.awt.Component;

    3. import java.awt.Panel;

    4. import java.io.IOException;

    5. import java.net.MalformedURLException;

    6. import java.net.URL;

    7.

    8. import javax.media.ConfigureCompleteEvent; 9. import javax.media.ControllerEvent;

    10.import javax.media.ControllerListener;

    11.import javax.media.EndOfMediaEvent; 12.import javax.media.Manager;

    13.import javax.media.NoPlayerException;

    14.import javax.media.Player;

    15.import javax.media.RealizeCompleteEvent; 16.

    17.import org.eclipse.jface.window.Window; 18.import org.eclipse.swt.SWT;

    19.import org.eclipse.swt.internal.awt.win32.SWT_AWT; 20.import org.eclipse.swt.widgets.Display; 21.import org.eclipse.swt.widgets.Shell;

    22.

    23./**

    24. * @author

    25. * <a >刘洋</a>

    26. * 2003-7-17 19:34:38

    27. */

    28.public class SWTPlayer implements ControllerListener { 29.

    30. public static void main(String[] args) { 31. SWTPlayer sp = new SWTPlayer(); 32. sp.play();

33. }

    34. private boolean configured =false; 35. private boolean realized = false; 36. Player player;

    37. Panel panel;

    38. public void play(){

    39. Display display = new Display (); 40. Shell shell = new Shell(display,SWT.MAX); 41. shell.setSize(320,240);

    42. shell.setText("你好SWT");

    43. panel = SWT_AWT.new_Panel(shell); 44. URL url = null;

    45. try {

    46. url = new URL("file:/D:/video/jboss.mpeg");

    47. } catch (MalformedURLException e) { 48. e.printStackTrace();

    49. }

    50. try