import import import import import import import import import import

java.lang.*; java.net.*; java.util.*; java.awt.*; java.awt.event.*; java.io.*; javax.swing.*; javax.media.*; javax.media.format.*; javax.media.protocol.*;

class SPA extends JFrame implements ControllerListener { Player player = null; Panel panel = null; String filename; FileDialog fd; Component comp; public void SPA() { setLayout(null); panel = new Panel(); panel.setLayout(new FlowLayout()); add(panel); panel.setBounds(0, 0, 320, 240); } void play() { try { System.out.println("FileDialog"); fd = new FileDialog(this, "Select File", FileDialog.LOAD); fd.show(); filename = fd.getDirectory() + fd.getFile(); player = Manager.createPlayer(new MediaLocator("file:///" + filename)); } catch (Exception e) { } player.addControllerListener(this); player.start(); } public synchronized void controllerUpdate(ControllerEvent event) { if (event instanceof RealizeCompleteEvent) { if ((comp = player.getVisualComponent()) != null) add ("Center", comp); if ((comp = player.getControlPanelComponent()) != null) add("South", comp); validate(); } } public static void main(String args[])throws Exception { System.out.println("In Start of main"); SPA myFrame = new SPA();

}

myFrame.show(); myFrame.setSize(640, 480); myFrame.play(); }

Sign up to vote on this title
UsefulNot useful