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

QualityAdapter

public class QualityAdapter extends Object implements ActionListener, QualityControl

Fields Summary
protected float
preferredValue
protected float
minValue
protected float
maxValue
protected float
value
protected boolean
settable
protected boolean
isTSsupported
protected SliderComp
sliderComp
private float
scale
Constructors Summary
public QualityAdapter(float preferred, float min, float max, boolean settable)


          
			    
        this(preferred,min,max,false,settable);
    
public QualityAdapter(float preferred, float min, float max, boolean isTSsupported, boolean settable)

	preferredValue = preferred;
	minValue = min;
	maxValue = max;
	value = preferred;
	this.settable = settable;
	this.isTSsupported = isTSsupported;
    
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent ae)

	float newValue = sliderComp.getFloatValue() / scale;
	setQuality(newValue);
    
public java.awt.ComponentgetControlComponent()

	if (sliderComp == null) {

	    sliderComp = new SliderComp(getName(),
					minValue * scale,
					maxValue * scale,
					value * scale);
	    sliderComp.setActionListener(this);
	}
	return sliderComp;
    
protected java.lang.StringgetName()

	return "Quality";
    
public floatgetPreferredQuality()

	return preferredValue;
    
public floatgetQuality()

	return value;
    
public booleanisTemporalSpatialTradeoffSupported()

	return isTSsupported;
    
public floatsetQuality(float newValue)

	if (newValue < minValue)
	    newValue = minValue;
	else if (newValue > maxValue)
	    newValue = maxValue;

//	if (newValue != value) {
	    value = newValue;
	    if (sliderComp != null) {
		sliderComp.setValue(value * scale);
	    }
//	}

	if (settable)
	    return value;
	else
	    return -1;