本文整理汇总了Java中javax.media.ControllerListener类的典型用法代码示例。如果您正苦于以下问题:Java ControllerListener类的具体用法?Java ControllerListener怎么用?Java ControllerListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ControllerListener类属于javax.media包,在下文中一共展示了ControllerListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JMFrame
import javax.media.ControllerListener; //导入依赖的package包/类
public JMFrame(Player player, String title) {
super(title, true, true, true, true);
getContentPane().setLayout( new BorderLayout() );
setSize(320, 10);
setLocation(50, 50);
setVisible(true);
mplayer = player;
mplayer.addControllerListener((ControllerListener) this);
mplayer.realize();
addInternalFrameListener( new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent ife) {
mplayer.close();
}
} );
}
示例2: createPlayer
import javax.media.ControllerListener; //导入依赖的package包/类
private static synchronized Player createPlayer(String mediaUri) {
try {
URL url = replaceJarUrlWithFileUrl(ResourceManager.getResource(mediaUri), mediaUri);
MediaLocator locator = new MediaLocator(url);
final Player mediaPlayer = Manager.createRealizedPlayer(locator);
// add a listener to put us in an infinite loop
mediaPlayer.addControllerListener(new ControllerListener() {
public void controllerUpdate(ControllerEvent evt) {
if(evt instanceof EndOfMediaEvent) {
mediaPlayer.setMediaTime(new Time(0));
mediaPlayer.start();
}
}
});
return mediaPlayer;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例3: dispatchEvent
import javax.media.ControllerListener; //导入依赖的package包/类
/**
* Dispatches an event on the current thread to all
* ControllerListeners of this Conroller. Exceptions are
* caught during the notification so that event processing can
* continue.
*/
private void dispatchEvent(ControllerEvent event) {
Vector l;
// Synchronize so that the listeners vector will not
// change while we are copying it
synchronized(listeners) {
l = (Vector)listeners.clone();
}
for(int i = 0; i < l.size(); i++ ) {
Object o = l.elementAt(i);
// Make sure this is a ControllerListener
if( o instanceof ControllerListener ) {
ControllerListener listener =
(ControllerListener)o;
try {
listener.controllerUpdate(event);
} catch(Exception e) {
System.err.println(
"Exception occurred during event dispatching:");
e.printStackTrace();
}
}
}
}
示例4: doAction
import javax.media.ControllerListener; //导入依赖的package包/类
protected void doAction() {
if (event instanceof PlaybackMarkEvent) {
((PlaybackListener)listener).markReached((PlaybackMarkEvent)event);
} else if (event instanceof PlaybackPlayItemEvent) {
((PlaybackListener)listener).playItemReached((PlaybackPlayItemEvent)event);
} else if (event instanceof ServiceContextEvent) {
((ServiceContextListener)listener).receiveServiceContextEvent((ServiceContextEvent)event);
} else if (event instanceof UOMaskTableChangedEvent) {
((UOMaskTableListener)listener).receiveUOMaskTableChangedEvent((UOMaskTableChangedEvent)event);
} else if (event instanceof UOMaskedEvent) {
((UOMaskTableListener)listener).receiveUOMaskedEvent((UOMaskedEvent)event);
} else if (event instanceof PiPStatusEvent) {
((PiPStatusListener)listener).piPStatusChange((PiPStatusEvent)event);
} else if (event instanceof PanningChangeEvent) {
((PanningChangeListener)listener).panningChange((PanningChangeEvent)event);
} else if (event instanceof AngleChangeEvent) {
((AngleChangeListener)listener).angleChange((AngleChangeEvent)event);
} else if (event instanceof MediaSelectEvent) {
((MediaSelectListener)listener).selectionComplete((MediaSelectEvent)event);
} else if (event instanceof GainChangeEvent) {
((GainChangeListener)listener).gainChange((GainChangeEvent)event);
} else if (event instanceof ControllerEvent) {
((ControllerListener)listener).controllerUpdate((ControllerEvent)event);
} else if (event instanceof ResourceStatusEvent) {
((ResourceStatusListener)listener).statusChanged((ResourceStatusEvent)event);
} else if (event instanceof AppsDatabaseEvent) {
AppsDatabaseEvent dbevent = (AppsDatabaseEvent)event;
AppsDatabaseEventListener dblistener = (AppsDatabaseEventListener)listener;
switch (dbevent.getEventId()) {
case AppsDatabaseEvent.APP_ADDED:
dblistener.entryAdded(dbevent);
break;
case AppsDatabaseEvent.APP_CHANGED:
dblistener.entryChanged(dbevent);
break;
case AppsDatabaseEvent.APP_DELETED:
dblistener.entryRemoved(dbevent);
break;
case AppsDatabaseEvent.NEW_DATABASE:
dblistener.newDatabase(dbevent);
break;
}
} else if (event instanceof SubtitleAvailableEvent || event instanceof SubtitleNotAvailableEvent ||
event instanceof SubtitleNotSelectedEvent || event instanceof SubtitleSelectedEvent) {
((SubtitleListener)listener).subtitleStatusChanged((EventObject)event);
} else if (event instanceof VideoFormatEvent) {
((VideoFormatListener)listener).receiveVideoFormatEvent((VideoFormatEvent)event);
} else if (event instanceof PSR102Status) {
((StatusListener)listener).receive(((PSR102Status)event).value);
} else {
System.err.println("Unknown event type: " + event.getClass().getName());
}
}
示例5: addControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
public void addControllerListener(ControllerListener listener) {
listeners.add(listener);
}
示例6: removeControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
public void removeControllerListener(ControllerListener listener) {
listeners.remove(listener);
}
示例7: addControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
public void addControllerListener(ControllerListener listener) {
synchronized (listeners) {
listeners.add(listener);
}
}
示例8: removeControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
public void removeControllerListener(ControllerListener listener) {
synchronized (listeners) {
listeners.remove(listener);
}
}
示例9: addControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
public void addControllerListener (ControllerListener listener) {
listeners.addElement(listener);
}
示例10: addControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
/**
* Specify a ControllerListener to which this Controller will
* send events.
*
* @param listener
* The listener to which the Controller will post
* events.
*/
public void addControllerListener(ControllerListener listener) {
synchronized(listeners) {
if(! listeners.contains(listener) ) {
listeners.addElement(listener);
}
}
}
示例11: removeControllerListener
import javax.media.ControllerListener; //导入依赖的package包/类
/**
* Remove the specified listener from this Controller's
* listener list.
*
* @param listener
* The listener that has been receiving events
* from this Controller.
*
*/
public void removeControllerListener(ControllerListener listener) {
synchronized(listeners) {
listeners.removeElement(listener);
}
}