/[classpath]/classpath/javax/swing/DefaultBoundedRangeModel.java
ViewVC logotype

Diff of /classpath/javax/swing/DefaultBoundedRangeModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.1 by gnu_andrew, Sat Jan 15 17:02:20 2005 UTC revision 1.5.2.2 by gnu_andrew, Sun Jan 16 15:15:13 2005 UTC
# Line 47  import javax.swing.event.ChangeListener; Line 47  import javax.swing.event.ChangeListener;
47  import javax.swing.event.EventListenerList;  import javax.swing.event.EventListenerList;
48    
49  /**  /**
50   * A default implementation of BoundedRangeModel.   * A default implementation of <code>BoundedRangeModel</code>.
51   *   *
52   * @author <a href="mailto:aselkirk@sympatico.ca">Andrew Selkirk</a>   * @author <a href="mailto:aselkirk@sympatico.ca">Andrew Selkirk</a>
53   * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>   * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
# Line 59  public class DefaultBoundedRangeModel Line 59  public class DefaultBoundedRangeModel
59     * The identifier of this class in object serialization. Verified     * The identifier of this class in object serialization. Verified
60     * using the serialver tool of Sun J2SE 1.4.1_01.     * using the serialver tool of Sun J2SE 1.4.1_01.
61     */     */
62    static final long serialVersionUID = 5034068491295259790L;    private static final long serialVersionUID = 5034068491295259790L;
63    
64    
65    /**    /**
# Line 67  public class DefaultBoundedRangeModel Line 67  public class DefaultBoundedRangeModel
67     * when the state of this range model has changed.     * when the state of this range model has changed.
68     *     *
69     * <p>The event object is created on demand, the first time it     * <p>The event object is created on demand, the first time it
70     * is actually needed.     * is actually needed.</p>
71     *     *
72     * @see #fireStateChanged()     * @see #fireStateChanged()
73     */     */
# Line 155  public class DefaultBoundedRangeModel Line 155  public class DefaultBoundedRangeModel
155     * @param maximum the initial maximal value of the range model.     * @param maximum the initial maximal value of the range model.
156     *     *
157     * @throws IllegalArgumentException if the following condition is     * @throws IllegalArgumentException if the following condition is
158     * not satisfied: <code>minimum <= value <= value + extent <=     * not satisfied: <code>minimum &lt;= value &lt;= value + extent &lt;=
159     * maximum</code>.     * maximum</code>.
160     */     */
161    public DefaultBoundedRangeModel(int value, int extent, int minimum,    public DefaultBoundedRangeModel(int value, int extent, int minimum,
# Line 176  public class DefaultBoundedRangeModel Line 176  public class DefaultBoundedRangeModel
176    /**    /**
177     * Returns a string with all relevant properties of this range     * Returns a string with all relevant properties of this range
178     * model.     * model.
179       *
180       * @return a string representing the object
181     */     */
182    public String toString()    public String toString()
183    {    {
# Line 193  public class DefaultBoundedRangeModel Line 195  public class DefaultBoundedRangeModel
195     * Returns the current value of this bounded range model.  In a     * Returns the current value of this bounded range model.  In a
196     * scroll bar visualization of a {@link BoundedRangeModel}, the     * scroll bar visualization of a {@link BoundedRangeModel}, the
197     * <code>value</code> is displayed as the position of the thumb.     * <code>value</code> is displayed as the position of the thumb.
198       *
199       * @return the value
200     */     */
201    public int getValue()    public int getValue()
202    {    {
# Line 206  public class DefaultBoundedRangeModel Line 210  public class DefaultBoundedRangeModel
210     * <code>value</code> is displayed as the position of the thumb;     * <code>value</code> is displayed as the position of the thumb;
211     * changing the <code>value</code> of a scroll bar's model     * changing the <code>value</code> of a scroll bar's model
212     * thus moves the thumb to a different position.     * thus moves the thumb to a different position.
213       *
214       * @param value the value
215     */     */
216    public void setValue(int value)    public void setValue(int value)
217    {    {
# Line 226  public class DefaultBoundedRangeModel Line 232  public class DefaultBoundedRangeModel
232     * a number greater than or equal to zero. In a scroll bar     * a number greater than or equal to zero. In a scroll bar
233     * visualization of a {@link BoundedRangeModel}, the     * visualization of a {@link BoundedRangeModel}, the
234     * <code>extent</code> is displayed as the size of the thumb.     * <code>extent</code> is displayed as the size of the thumb.
235       *
236       * @return the extent
237     */     */
238    public int getExtent()    public int getExtent()
239    {    {
# Line 282  public class DefaultBoundedRangeModel Line 290  public class DefaultBoundedRangeModel
290    
291    /**    /**
292     * Returns the current maximal value of this bounded range model.     * Returns the current maximal value of this bounded range model.
293       *
294       * @return the maximum
295     */     */
296    public int getMaximum()    public int getMaximum()
297    {    {
# Line 313  public class DefaultBoundedRangeModel Line 323  public class DefaultBoundedRangeModel
323     * around; when the mouse is relased, they set the property to     * around; when the mouse is relased, they set the property to
324     * <code>false</code> and post a final {@link ChangeEvent}.     * <code>false</code> and post a final {@link ChangeEvent}.
325     *     *
326     * @returns <code>true</code> if the value will change soon again;     * @return <code>true</code> if the value will change soon again;
327     * <code>false</code> if the value will probably not change soon.     * <code>false</code> if the value will probably not change soon.
328     */     */
329    public boolean getValueIsAdjusting()    public boolean getValueIsAdjusting()
# Line 344  public class DefaultBoundedRangeModel Line 354  public class DefaultBoundedRangeModel
354    
355    
356    /**    /**
357     * setRangeProperties     * Sets all properties.
358     *     *
359     * @param value the new value of the range model.  In a scroll bar     * @param value the new value of the range model.  In a scroll bar
360     * visualization of a {@link BoundedRangeModel}, the     * visualization of a {@link BoundedRangeModel}, the
# Line 422  public class DefaultBoundedRangeModel Line 432  public class DefaultBoundedRangeModel
432     */     */
433    protected void fireStateChanged()    protected void fireStateChanged()
434    {    {
435      Object[] listeners;      ChangeListener[] listeners = getChangeListeners();
436        
437        if (changeEvent == null)
438          changeEvent = new ChangeEvent(this);
439    
440      listeners = listenerList.getListenerList();      for (int i = listeners.length - 1; i >= 0; --i)
441      for (int i = listeners.length - 2; i >= 0; i -= 2)        listeners[i].stateChanged(changeEvent);
       if (listeners[i] == ChangeListener.class)  
         {  
           if (changeEvent == null)  
             changeEvent = new ChangeEvent(this);  
           ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);  
         }  
442    }    }
443    
444    

Legend:
Removed from v.1.5.2.1  
changed lines
  Added in v.1.5.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26