soundFile = f;
// prepare a dialog to display while playing
JOptionPane pane = new JOptionPane ("Playing " + f.getName(),
JOptionPane.PLAIN_MESSAGE);
playingDialog = pane.createDialog (null, "JMF Sound");
playingDialog.pack();
// get a player
MediaLocator mediaLocator =
new MediaLocator(soundFile.toURL());
Player player =
Manager.createRealizedPlayer (mediaLocator);
player.addControllerListener (this);
player.start();
playingDialog.setVisible(true);