日期:2014-05-20 浏览次数:20914 次
package com.test.media;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FileDialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import javax.media.CannotRealizeException;
import javax.media.ControllerEvent;
import javax.media.ControllerListener;
import javax.media.EndOfMediaEvent;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.PrefetchCompleteEvent;
import javax.media.RealizeCompleteEvent;
import javax.media.Time;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class TestPlayer extends JFrame implements ActionListener,ControllerListener{
/**
*
*/
private static final long serialVersionUID = 1L;
private Player player;//播放器
private Component visual;//播放器组建
private Component control;//控制组建
private JMenu fileMenu;//文件菜单
private JMenuItem open;//打开文件菜单项
private JMenuItem exit;//退出菜单项
private JMenuBar menuBar;//菜单栏
public TestPlayer()
{
fileMenu=new JMenu("文件");
open=new JMenuItem("打开");