本文整理汇总了Java中javax.media.RateChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java RateChangeEvent类的具体用法?Java RateChangeEvent怎么用?Java RateChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RateChangeEvent类属于javax.media包,在下文中一共展示了RateChangeEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: controllerUpdate
import javax.media.RateChangeEvent; //导入依赖的package包/类
/**
* Listen for RateChangeEvents or MediaTimeSetEvents and
* notify the StopTimeMonitor thread to recalculate its wait
* time. Also listen for StartEvents and StopEvents so that
* the monitor will know whether the controller is playing.
*
* @param e
* The ControllerEvent
*/
public synchronized void controllerUpdate(ControllerEvent e) {
if( e instanceof StopTimeChangeEvent ||
e instanceof RateChangeEvent ||
e instanceof MediaTimeSetEvent ||
e instanceof StartEvent ||
(e instanceof StopEvent && ! (e instanceof DeallocateEvent) ) )
{
wokenUp = true;
notifyAll();
}
}
示例2: setRate
import javax.media.RateChangeEvent; //导入依赖的package包/类
/**
* Set the temporal scale factor. The argument
* <i>suggests</i> the scale factor to use.
* <p>
* The <tt>setRate</tt> method returns the actual rate set
* by the <tt>Clock</tt>. <tt>Clocks</tt> should set
* their rate as close to the requested value as possible, but
* are not required to set the rate to the exact value of any
* argument other than 1.0. A <tt>Clock</tt> is only
* guaranteed to set its rate exactly to 1.0.
*
* @param rate
* The temporal scale factor (rate) to set.
*
* @exception NotRealizedError
* If the Controller is not Realized.
*
* @exception ClockStartedError
* If the Controller is Started.
*
* @return The actual rate set.
*
*/
public synchronized float setRate(float rate) {
if( currentState == Unrealized ||
currentState == Realizing )
{
throw new NotRealizedError(
"Cannot set rate on an Unrealized Controller.");
}
// Save the current rate
float oldRate = getRate();
// Enforce superclass reqs
float superRate = super.setRate(rate);
// Set the rate in the subclass
float subRate = doSetRate(superRate);
// If the rate has changed since setting in the
// superclass, set it agagin
if( rate != 1.0F && superRate != subRate ) {
superRate = super.setRate(subRate);
// If it has changed again, give up and set to the
// only rate guaranteed to be accepted
if( superRate != subRate ) {
return setRate(1.0F);
}
}
// If the rate has changed, commit it and post an event.
if(superRate != oldRate) {
postEvent( new RateChangeEvent(this, superRate) );
}
return superRate;
}
示例3: doRateChanged
import javax.media.RateChangeEvent; //导入依赖的package包/类
protected void doRateChanged(float rate) {
if (this.rate != rate) {
this.rate = rate;
notifyListeners(new RateChangeEvent(this, rate));
}
}
示例4: doSetRate
import javax.media.RateChangeEvent; //导入依赖的package包/类
protected void doSetRate(Float factor) {
if (rate != factor.floatValue()) {
rate = factor.floatValue();
notifyListeners(new RateChangeEvent(this, rate));
}
}
示例5: controllerUpdate
import javax.media.RateChangeEvent; //导入依赖的package包/类
/**
* Listens for changes in the Controller's rate, so that it
* can be reflected in the Rate TextField.
*
* @param e
* The generated ControllerEvent. This event is
* ignored if it is not a RateChangeEvent.
*/
public void controllerUpdate(ControllerEvent e) {
if( e.getSourceController() == controller &&
e instanceof RateChangeEvent)
{
SwingUtilities.invokeLater(new LoadRateThread());
}
}