< prev index next >
src/java.desktop/share/classes/javax/swing/DefaultBoundedRangeModel.java
Print this page
*** 36,46 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author David Kloba
* @author Hans Muller
* @see BoundedRangeModel
--- 36,46 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author David Kloba
* @author Hans Muller
* @see BoundedRangeModel
*** 48,58 ****
*/
@SuppressWarnings("serial") // Same-version serialization only
public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable
{
/**
! * Only one <code>ChangeEvent</code> is needed per model instance since the
* event's only (read-only) state is the source property. The source
* of events generated here is always "this".
*/
protected transient ChangeEvent changeEvent = null;
--- 48,58 ----
*/
@SuppressWarnings("serial") // Same-version serialization only
public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable
{
/**
! * Only one {@code ChangeEvent} is needed per model instance since the
* event's only (read-only) state is the source property. The source
* of events generated here is always "this".
*/
protected transient ChangeEvent changeEvent = null;
*** 68,91 ****
/**
* Initializes all of the properties with default values.
* Those values are:
* <ul>
! * <li><code>value</code> = 0
! * <li><code>extent</code> = 0
! * <li><code>minimum</code> = 0
! * <li><code>maximum</code> = 100
! * <li><code>adjusting</code> = false
* </ul>
*/
public DefaultBoundedRangeModel() {
}
/**
* Initializes value, extent, minimum and maximum. Adjusting is false.
! * Throws an <code>IllegalArgumentException</code> if the following
* constraints aren't satisfied:
* <pre>
* min <= value <= value+extent <= max
* </pre>
*
--- 68,91 ----
/**
* Initializes all of the properties with default values.
* Those values are:
* <ul>
! * <li>{@code value} = 0
! * <li>{@code extent} = 0
! * <li>{@code minimum} = 0
! * <li>{@code maximum} = 100
! * <li>{@code adjusting} = false
* </ul>
*/
public DefaultBoundedRangeModel() {
}
/**
* Initializes value, extent, minimum and maximum. Adjusting is false.
! * Throws an {@code IllegalArgumentException} if the following
* constraints aren't satisfied:
* <pre>
* min <= value <= value+extent <= max
* </pre>
*
*** 226,236 ****
setRangeProperties(newValue, newExtent, newMin, n, isAdjusting);
}
/**
! * Sets the <code>valueIsAdjusting</code> property.
*
* @see #getValueIsAdjusting
* @see #setValue
* @see BoundedRangeModel#setValueIsAdjusting
*/
--- 226,236 ----
setRangeProperties(newValue, newExtent, newMin, n, isAdjusting);
}
/**
! * Sets the {@code valueIsAdjusting} property.
*
* @see #getValueIsAdjusting
* @see #setValue
* @see BoundedRangeModel#setValueIsAdjusting
*/
*** 241,267 ****
/**
* Returns true if the value is in the process of changing
* as a result of actions being taken by the user.
*
! * @return the value of the <code>valueIsAdjusting</code> property
* @see #setValue
* @see BoundedRangeModel#getValueIsAdjusting
*/
public boolean getValueIsAdjusting() {
return isAdjusting;
}
/**
! * Sets all of the <code>BoundedRangeModel</code> properties after forcing
* the arguments to obey the usual constraints:
* <pre>
* minimum <= value <= value+extent <= maximum
* </pre>
* <p>
! * At most, one <code>ChangeEvent</code> is generated.
*
* @see BoundedRangeModel#setRangeProperties
* @see #setValue
* @see #setExtent
* @see #setMinimum
--- 241,267 ----
/**
* Returns true if the value is in the process of changing
* as a result of actions being taken by the user.
*
! * @return the value of the {@code valueIsAdjusting} property
* @see #setValue
* @see BoundedRangeModel#getValueIsAdjusting
*/
public boolean getValueIsAdjusting() {
return isAdjusting;
}
/**
! * Sets all of the {@code BoundedRangeModel} properties after forcing
* the arguments to obey the usual constraints:
* <pre>
* minimum <= value <= value+extent <= maximum
* </pre>
* <p>
! * At most, one {@code ChangeEvent} is generated.
*
* @see BoundedRangeModel#setRangeProperties
* @see #setValue
* @see #setExtent
* @see #setMinimum
*** 310,320 ****
}
}
/**
! * Adds a <code>ChangeListener</code>. The change listeners are run each
* time any one of the Bounded Range model properties changes.
*
* @param l the ChangeListener to add
* @see #removeChangeListener
* @see BoundedRangeModel#addChangeListener
--- 310,320 ----
}
}
/**
! * Adds a {@code ChangeListener}. The change listeners are run each
* time any one of the Bounded Range model properties changes.
*
* @param l the ChangeListener to add
* @see #removeChangeListener
* @see BoundedRangeModel#addChangeListener
*** 323,348 ****
listenerList.add(ChangeListener.class, l);
}
/**
! * Removes a <code>ChangeListener</code>.
*
! * @param l the <code>ChangeListener</code> to remove
* @see #addChangeListener
* @see BoundedRangeModel#removeChangeListener
*/
public void removeChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
}
/**
* Returns an array of all the change listeners
! * registered on this <code>DefaultBoundedRangeModel</code>.
*
! * @return all of this model's <code>ChangeListener</code>s
* or an empty
* array if no change listeners are currently registered
*
* @see #addChangeListener
* @see #removeChangeListener
--- 323,348 ----
listenerList.add(ChangeListener.class, l);
}
/**
! * Removes a {@code ChangeListener}.
*
! * @param l the {@code ChangeListener} to remove
* @see #addChangeListener
* @see BoundedRangeModel#removeChangeListener
*/
public void removeChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
}
/**
* Returns an array of all the change listeners
! * registered on this {@code DefaultBoundedRangeModel}.
*
! * @return all of this model's {@code ChangeListener}s
* or an empty
* array if no change listeners are currently registered
*
* @see #addChangeListener
* @see #removeChangeListener
*** 353,363 ****
return listenerList.getListeners(ChangeListener.class);
}
/**
! * Runs each <code>ChangeListener</code>'s <code>stateChanged</code> method.
*
* @see #setRangeProperties
* @see EventListenerList
*/
protected void fireStateChanged()
--- 353,363 ----
return listenerList.getListeners(ChangeListener.class);
}
/**
! * Runs each {@code ChangeListener}'s {@code stateChanged} method.
*
* @see #setRangeProperties
* @see EventListenerList
*/
protected void fireStateChanged()
*** 374,384 ****
}
/**
* Returns a string that displays all of the
! * <code>BoundedRangeModel</code> properties.
*/
public String toString() {
String modelString =
"value=" + getValue() + ", " +
"extent=" + getExtent() + ", " +
--- 374,384 ----
}
/**
* Returns a string that displays all of the
! * {@code BoundedRangeModel} properties.
*/
public String toString() {
String modelString =
"value=" + getValue() + ", " +
"extent=" + getExtent() + ", " +
*** 394,407 ****
* <code><em>Foo</em>Listener</code>s
* upon this model.
* <code><em>Foo</em>Listener</code>s
* are registered using the <code>add<em>Foo</em>Listener</code> method.
* <p>
! * You can specify the <code>listenerType</code> argument
* with a class literal, such as <code><em>Foo</em>Listener.class</code>.
! * For example, you can query a <code>DefaultBoundedRangeModel</code>
! * instance <code>m</code>
* for its change listeners
* with the following code:
*
* <pre>ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));</pre>
*
--- 394,407 ----
* <code><em>Foo</em>Listener</code>s
* upon this model.
* <code><em>Foo</em>Listener</code>s
* are registered using the <code>add<em>Foo</em>Listener</code> method.
* <p>
! * You can specify the {@code listenerType} argument
* with a class literal, such as <code><em>Foo</em>Listener.class</code>.
! * For example, you can query a {@code DefaultBoundedRangeModel}
! * instance {@code m}
* for its change listeners
* with the following code:
*
* <pre>ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));</pre>
*
*** 409,427 ****
* this method returns an empty array.
*
* @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
! * that descends from <code>java.util.EventListener</code>
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s
* on this model,
* or an empty array if no such
* listeners have been added
! * @exception ClassCastException if <code>listenerType</code> doesn't
* specify a class or interface that implements
! * <code>java.util.EventListener</code>
*
* @see #getChangeListeners
*
* @since 1.3
*/
--- 409,427 ----
* this method returns an empty array.
*
* @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
! * that descends from {@code java.util.EventListener}
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s
* on this model,
* or an empty array if no such
* listeners have been added
! * @exception ClassCastException if {@code listenerType} doesn't
* specify a class or interface that implements
! * {@code java.util.EventListener}
*
* @see #getChangeListeners
*
* @since 1.3
*/
< prev index next >