|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.binding.adapter.BoundedRangeAdapter
public final class BoundedRangeAdapter
Converts a ValueModel to the BoundedRangeModel
interface.
Honors an upper and lower bound and returns the adapter's minimum
in case the subject value is null
.
Example:
int minSaturation = 0; int maxSaturation = 255; PresentationModel pm = new PresentationModel(settings); ValueModel saturationModel = pm.getModel("saturation"); JSlider saturationSlider = new JSlider( new BoundedRangeAdapter(saturationModel, 0, minSaturation, maxSaturation));
JSlider
,
Serialized FormConstructor Summary | |
---|---|
BoundedRangeAdapter(ValueModel subject,
int extent,
int min,
int max)
Constructs a BoundedRangeAdapter on the given subject using the specified extend, minimum and maximum values. |
Method Summary | |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener. |
protected void |
fireStateChanged()
Runs each ChangeListeners stateChanged() method. |
int |
getExtent()
Returns this model's extent. |
int |
getMaximum()
Returns this model's upper bound, the maximum. |
int |
getMinimum()
Returns this model's lower bound, the minimum. |
int |
getValue()
Returns the current subject value, or the minimum if the subject value is null . |
boolean |
getValueIsAdjusting()
Returns true if the value is in the process of changing as a result of actions being taken by the user. |
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener. |
void |
setExtent(int n)
Sets the extent to n. |
void |
setMaximum(int n)
Sets the maximum to n. |
void |
setMinimum(int n)
Sets the minimum to n. |
void |
setRangeProperties(int newValue,
int newExtent,
int newMin,
int newMax,
boolean adjusting)
Sets all of the BoundedRangeModel properties after forcing the arguments to obey the usual constraints: |
void |
setValue(int n)
Sets the current value of the model. |
void |
setValueIsAdjusting(boolean b)
Sets the valueIsAdjusting property. |
java.lang.String |
toString()
Returns a string that displays all of the BoundedRangeModel properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BoundedRangeAdapter(ValueModel subject, int extent, int min, int max)
subject
- the underlying ValueModel that provides the valueextent
- the extent to be setmin
- the minimum to be setmax
- the maximum to be set
java.lang.IllegalArgumentException
- if the following constraints aren't
satisfied: min <= initial subject value <= value+extent <= max
Method Detail |
---|
public int getExtent()
getExtent
in interface javax.swing.BoundedRangeModel
setExtent(int)
,
BoundedRangeModel.getExtent()
public int getMaximum()
getMaximum
in interface javax.swing.BoundedRangeModel
setMaximum(int)
,
BoundedRangeModel.getMaximum()
public int getMinimum()
getMinimum
in interface javax.swing.BoundedRangeModel
setMinimum(int)
,
BoundedRangeModel.getMinimum()
public int getValue()
null
.
getValue
in interface javax.swing.BoundedRangeModel
setValue(int)
,
BoundedRangeModel.getValue()
public boolean getValueIsAdjusting()
getValueIsAdjusting
in interface javax.swing.BoundedRangeModel
setValue(int)
,
BoundedRangeModel.getValueIsAdjusting()
public void setExtent(int n)
minimum <= value <= value+extent <= maximum
setExtent
in interface javax.swing.BoundedRangeModel
n
- the new extent before ensuring a non-negative numberBoundedRangeModel.setExtent(int)
public void setMaximum(int n)
minimum <= value <= value+extent <= maximum
setMaximum
in interface javax.swing.BoundedRangeModel
n
- the new maximum before ensuring this adapter's constraintsBoundedRangeModel.setMaximum(int)
public void setMinimum(int n)
minimum <= value <= value+extent <= maximum
setMinimum
in interface javax.swing.BoundedRangeModel
n
- the new minimum before ensuring constraintsgetMinimum()
,
BoundedRangeModel.setMinimum(int)
public void setRangeProperties(int newValue, int newExtent, int newMin, int newMax, boolean adjusting)
minimum <= value <= value+extent <= maximum
At most, one ChangeEvent is generated.
setRangeProperties
in interface javax.swing.BoundedRangeModel
newValue
- the value to be setnewExtent
- the extent to be setnewMin
- the minimum to be setnewMax
- the maximum to be setadjusting
- true if there are other pending changesBoundedRangeModel.setRangeProperties(int, int, int, int, boolean)
,
setValue(int)
,
setExtent(int)
,
setMinimum(int)
,
setMaximum(int)
,
setValueIsAdjusting(boolean)
public void setValue(int n)
minimum <= value <= value+extent <= maximum
setValue
in interface javax.swing.BoundedRangeModel
n
- the new value before ensuring constraintsBoundedRangeModel.setValue(int)
public void setValueIsAdjusting(boolean b)
setValueIsAdjusting
in interface javax.swing.BoundedRangeModel
b
- the new valuegetValueIsAdjusting()
,
setValue(int)
,
BoundedRangeModel.setValueIsAdjusting(boolean)
public void addChangeListener(javax.swing.event.ChangeListener l)
addChangeListener
in interface javax.swing.BoundedRangeModel
l
- the ChangeListener to addremoveChangeListener(ChangeListener)
,
BoundedRangeModel.addChangeListener(ChangeListener)
public void removeChangeListener(javax.swing.event.ChangeListener l)
removeChangeListener
in interface javax.swing.BoundedRangeModel
l
- the ChangeListener to removeaddChangeListener(ChangeListener)
,
BoundedRangeModel.removeChangeListener(ChangeListener)
protected void fireStateChanged()
setRangeProperties(int, int, int, int, boolean)
,
EventListenerList
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |