FileDocCategorySizeDatePackage
FrameRateAdapter.javaAPI DocJMF 2.1.1e3058Mon May 12 12:20:56 BST 2003com.sun.media.controls

FrameRateAdapter

public class FrameRateAdapter extends Object implements ActionListener, Reparentable, FrameRateControl

Fields Summary
protected float
value
protected float
min
protected float
max
protected TextComp
textComp
protected boolean
settable
protected Object
owner
Constructors Summary
public FrameRateAdapter(float initialFrameRate, float minFrameRate, float maxFrameRate, boolean settable)


        
			        
	value = initialFrameRate;
	min = minFrameRate;
	max = maxFrameRate;
	this.settable = settable;
    
public FrameRateAdapter(Object owner, float initialFrameRate, float minFrameRate, float maxFrameRate, boolean settable)

	this(initialFrameRate, minFrameRate, maxFrameRate, settable);
	this.owner = owner;
    
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent ae)

    System.out.println("fra:");
	float newFrameRate = textComp.getFloatValue();
	setFrameRate(newFrameRate);
    
public java.awt.ComponentgetControlComponent()

	if (textComp == null) {
	    textComp = new TextComp(getName(), value+"", 2, settable);
	    textComp.setActionListener(this);
	}
	return textComp;
    
public floatgetFrameRate()
Returns the current frame rate. Returns -1 if it is unknown.

return
the frame rate in frames per second.

	return value;
    
public floatgetMaxSupportedFrameRate()
Returns the maximum frame rate. Returns -1 if it is unknown.

return
the maximum frame rate in frames per second.

	return max;
    
protected java.lang.StringgetName()

	return "Frame Rate";
    
public java.lang.ObjectgetOwner()

	if (owner == null)
	    return this;
	else
	    return owner;
    
public floatgetPreferredFrameRate()
Returns the default frame rate. Returns -1 if it is unknown.

return
the default frame rate in frames per second.

	return min;
    
public voidsetEnabled(boolean enable)

	if (textComp != null)
	    textComp.setEnabled(enable);
    
public floatsetFrameRate(float newFrameRate)
Sets the frame rate. Returns -1 if it is unknown or it is not controllable.

param
newFrameRate the requested new frame rate
return
the actual frame rate in frames per second.

	if (settable) {
	    if (newFrameRate < min)
		newFrameRate = min;
	    else if (newFrameRate > max)
		newFrameRate = max;
//	    if (newFrameRate != value) {
		value = newFrameRate;
		if (textComp != null) {
		    textComp.setValue(Float.toString(value));
		}
//	    }
	    return value;
	} else
	    return -1;
    
public voidsetOwner(java.lang.Object newOwner)

	owner = newOwner;