/[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.10 by mkoch, Wed Feb 16 11:41:16 2005 UTC revision 1.11 by rabbit78, Mon Jun 20 14:35:53 2005 UTC
# Line 61  public class DefaultBoundedRangeModel Line 61  public class DefaultBoundedRangeModel
61     */     */
62    private static final long serialVersionUID = 5034068491295259790L;    private static final long serialVersionUID = 5034068491295259790L;
63    
   
64    /**    /**
65     * An event that is sent to all registered {@link ChangeListener}s     * An event that is sent to all registered {@link ChangeListener}s
66     * when the state of this range model has changed.     * when the state of this range model has changed.
# Line 73  public class DefaultBoundedRangeModel Line 72  public class DefaultBoundedRangeModel
72     */     */
73    protected transient ChangeEvent changeEvent;    protected transient ChangeEvent changeEvent;
74    
   
75    /**    /**
76     * The list of the currently registered EventListeners.     * The list of the currently registered EventListeners.
77     */     */
78    protected EventListenerList listenerList = new EventListenerList();    protected EventListenerList listenerList = new EventListenerList();
79    
   
80    /**    /**
81     * The current value of the range model, which is always between     * The current value of the range model, which is always between
82     * {@link #minimum} and ({@link #maximum} - {@link #extent}). In a     * {@link #minimum} and ({@link #maximum} - {@link #extent}). In a
# Line 88  public class DefaultBoundedRangeModel Line 85  public class DefaultBoundedRangeModel
85     */     */
86    private int value;    private int value;
87    
   
88    /**    /**
89     * The current extent of the range model, which is a number greater     * The current extent of the range model, which is a number greater
90     * than or equal to zero. In a scroll bar visualization of a {@link     * than or equal to zero. In a scroll bar visualization of a {@link
# Line 97  public class DefaultBoundedRangeModel Line 93  public class DefaultBoundedRangeModel
93     */     */
94    private int extent;    private int extent;
95    
   
96    /**    /**
97     * The current minimum value of the range model, which is always     * The current minimum value of the range model, which is always
98     * less than or equal to {@link #maximum}.     * less than or equal to {@link #maximum}.
99     */     */
100    private int minimum;    private int minimum;
101    
   
102    /**    /**
103     * The current maximum value of the range model, which is always     * The current maximum value of the range model, which is always
104     * greater than or equal to {@link #minimum}.     * greater than or equal to {@link #minimum}.
105     */     */
106    private int maximum;    private int maximum;
107    
   
108    /**    /**
109     * A property that indicates whether the value of this {@link     * A property that indicates whether the value of this {@link
110     * BoundedRangeModel} is going to change in the immediate future.     * BoundedRangeModel} is going to change in the immediate future.
111     */     */
112    private boolean isAdjusting;    private boolean isAdjusting;
113    
   
114    /**    /**
115     * Constructs a <code>DefaultBoundedRangeModel</code> with default     * Constructs a <code>DefaultBoundedRangeModel</code> with default
116     * values for the properties. The properties <code>value</code>,     * values for the properties. The properties <code>value</code>,
# Line 134  public class DefaultBoundedRangeModel Line 126  public class DefaultBoundedRangeModel
126      maximum = 100;      maximum = 100;
127    }    }
128    
   
129    /**    /**
130     * Constructs a <code>DefaultBoundedRangeModel</code> with the     * Constructs a <code>DefaultBoundedRangeModel</code> with the
131     * specified values for some properties.     * specified values for some properties.
132     *     *
133     * @param value the initial value of the range model, which must be     * @param value the initial value of the range model, which must be
134     * a number between <code>minimum</code> and <code>(maximum -     *     a number between <code>minimum</code> and <code>(maximum -
135     * extent)</code>. In a scroll bar visualization of a {@link     *     extent)</code>. In a scroll bar visualization of a {@link
136     * BoundedRangeModel}, the <code>value</code> is displayed as the     *     BoundedRangeModel}, the <code>value</code> is displayed as the
137     * position of the thumb.     *     position of the thumb.
    *  
138     * @param extent the initial extent of the range model, which is a     * @param extent the initial extent of the range model, which is a
139     * number greater than or equal to zero. In a scroll bar     *     number greater than or equal to zero. In a scroll bar
140     * visualization of a {@link BoundedRangeModel}, the     *     visualization of a {@link BoundedRangeModel}, the
141     * <code>extent</code> is displayed as the size of the thumb.     *     <code>extent</code> is displayed as the size of the thumb.
    *  
142     * @param minimum the initial minimal value of the range model.     * @param minimum the initial minimal value of the range model.
    *  
143     * @param maximum the initial maximal value of the range model.     * @param maximum the initial maximal value of the range model.
144     *     *
145     * @throws IllegalArgumentException if the following condition is     * @throws IllegalArgumentException if the following condition is
146     * not satisfied: <code>minimum &lt;= value &lt;= value + extent &lt;=     *     not satisfied: <code>minimum &lt;= value &lt;= value + extent &lt;=
147     * maximum</code>.     *     maximum</code>.
148     */     */
149    public DefaultBoundedRangeModel(int value, int extent, int minimum,    public DefaultBoundedRangeModel(int value, int extent, int minimum,
150                                    int maximum)                                    int maximum)
# Line 172  public class DefaultBoundedRangeModel Line 160  public class DefaultBoundedRangeModel
160      // The isAdjusting field already has a false value by default.      // The isAdjusting field already has a false value by default.
161    }    }
162    
   
163    /**    /**
164     * Returns a string with all relevant properties of this range     * Returns a string with all relevant properties of this range
165     * model.     * model.
# Line 190  public class DefaultBoundedRangeModel Line 177  public class DefaultBoundedRangeModel
177        + ']';        + ']';
178    }    }
179    
   
180    /**    /**
181     * Returns the current value of this bounded range model.  In a     * Returns the current value of this bounded range model.  In a
182     * scroll bar visualization of a {@link BoundedRangeModel}, the     * scroll bar visualization of a {@link BoundedRangeModel}, the
# Line 203  public class DefaultBoundedRangeModel Line 189  public class DefaultBoundedRangeModel
189      return value;      return value;
190    }    }
191    
   
192    /**    /**
193     * Changes the current value of this bounded range model. In a     * Changes the current value of this bounded range model. In a
194     * scroll bar visualization of a {@link BoundedRangeModel}, the     * scroll bar visualization of a {@link BoundedRangeModel}, the
# Line 226  public class DefaultBoundedRangeModel Line 211  public class DefaultBoundedRangeModel
211        }        }
212    }    }
213    
   
214    /**    /**
215     * Returns the current extent of this bounded range model, which is     * Returns the current extent of this bounded range model, which is
216     * a number greater than or equal to zero. In a scroll bar     * a number greater than or equal to zero. In a scroll bar
# Line 240  public class DefaultBoundedRangeModel Line 224  public class DefaultBoundedRangeModel
224      return extent;      return extent;
225    }    }
226    
   
227    /**    /**
228     * Changes the current extent of this bounded range model. In a     * Changes the current extent of this bounded range model. In a
229     * scroll bar visualization of a {@link BoundedRangeModel}, the     * scroll bar visualization of a {@link BoundedRangeModel}, the
230     * <code>extent</code> is displayed as the size of the thumb.     * <code>extent</code> is displayed as the size of the thumb.
231     *     *
232     * @param extent the new extent of the range model, which is a     * @param extent the new extent of the range model, which is a
233     * number greater than or equal to zero.     *     number greater than or equal to zero.
234     */     */
235    public void setExtent(int extent)    public void setExtent(int extent)
236    {    {
# Line 262  public class DefaultBoundedRangeModel Line 245  public class DefaultBoundedRangeModel
245        }        }
246    }    }
247    
   
248    /**    /**
249     * Returns the current minimal value of this bounded range model.     * Returns the current minimal value of this bounded range model.
250     */     */
# Line 271  public class DefaultBoundedRangeModel Line 253  public class DefaultBoundedRangeModel
253      return minimum;      return minimum;
254    }    }
255    
   
256    /**    /**
257     * Changes the current minimal value of this bounded range model.     * Changes the current minimal value of this bounded range model.
258     *     *
# Line 287  public class DefaultBoundedRangeModel Line 268  public class DefaultBoundedRangeModel
268      setRangeProperties(value, extent, minimum, maximum, isAdjusting);      setRangeProperties(value, extent, minimum, maximum, isAdjusting);
269    }    }
270    
   
271    /**    /**
272     * Returns the current maximal value of this bounded range model.     * Returns the current maximal value of this bounded range model.
273     *     *
# Line 298  public class DefaultBoundedRangeModel Line 278  public class DefaultBoundedRangeModel
278      return maximum;      return maximum;
279    }    }
280    
   
281    /**    /**
282     * Changes the current maximal value of this bounded range model.     * Changes the current maximal value of this bounded range model.
283     *     *
# Line 315  public class DefaultBoundedRangeModel Line 294  public class DefaultBoundedRangeModel
294      setRangeProperties(value, extent, minimum, maximum, isAdjusting);      setRangeProperties(value, extent, minimum, maximum, isAdjusting);
295    }    }
296    
   
297    /**    /**
298     * Returns whether or not the value of this bounded range model is     * Returns whether or not the value of this bounded range model is
299     * going to change in the immediate future. Scroll bars set this     * going to change in the immediate future. Scroll bars set this
# Line 324  public class DefaultBoundedRangeModel Line 302  public class DefaultBoundedRangeModel
302     * <code>false</code> and post a final {@link ChangeEvent}.     * <code>false</code> and post a final {@link ChangeEvent}.
303     *     *
304     * @return <code>true</code> if the value will change soon again;     * @return <code>true</code> if the value will change soon again;
305     * <code>false</code> if the value will probably not change soon.     *     <code>false</code> if the value will probably not change soon.
306     */     */
307    public boolean getValueIsAdjusting()    public boolean getValueIsAdjusting()
308    {    {
309      return isAdjusting;      return isAdjusting;
310    }    }
311    
   
312    /**    /**
313     * Specifies whether or not the value of this bounded range model is     * Specifies whether or not the value of this bounded range model is
314     * going to change in the immediate future. Scroll bars set this     * going to change in the immediate future. Scroll bars set this
# Line 340  public class DefaultBoundedRangeModel Line 317  public class DefaultBoundedRangeModel
317     * <code>false</code>.     * <code>false</code>.
318     *     *
319     * @param isAdjusting <code>true</code> if the value will change     * @param isAdjusting <code>true</code> if the value will change
320     * soon again; <code>false</code> if the value will probably not     *     soon again; <code>false</code> if the value will probably not
321     * change soon.     *     change soon.
322     */     */
323    public void setValueIsAdjusting(boolean isAdjusting)    public void setValueIsAdjusting(boolean isAdjusting)
324    {    {
# Line 352  public class DefaultBoundedRangeModel Line 329  public class DefaultBoundedRangeModel
329      fireStateChanged();      fireStateChanged();
330    }    }
331    
   
332    /**    /**
333     * Sets all properties.     * Sets all properties.
334     *     *
335     * @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
336     * visualization of a {@link BoundedRangeModel}, the     *     visualization of a {@link BoundedRangeModel}, the
337     * <code>value</code> is displayed as the position of the thumb.     *     <code>value</code> is displayed as the position of the thumb.
    *  
338     * @param extent the new extent of the range model, which is a     * @param extent the new extent of the range model, which is a
339     * number greater than or equal to zero. In a scroll bar     *     number greater than or equal to zero. In a scroll bar
340     * visualization of a {@link BoundedRangeModel}, the     *     visualization of a {@link BoundedRangeModel}, the
341     * <code>extent</code> is displayed as the size of the thumb.     *     <code>extent</code> is displayed as the size of the thumb.
    *  
342     * @param minimum the new minimal value of the range model.     * @param minimum the new minimal value of the range model.
    *  
343     * @param maximum the new maximal value of the range model.     * @param maximum the new maximal value of the range model.
   
344     * @param isAdjusting whether or not the value of this bounded range     * @param isAdjusting whether or not the value of this bounded range
345     * model is going to change in the immediate future. Scroll bars set     *     model is going to change in the immediate future. Scroll bars set
346     * this property to <code>true</code> while the thumb is being     *     this property to <code>true</code> while the thumb is being
347     * dragged around; when the mouse is relased, they set the property     *     dragged around; when the mouse is relased, they set the property
348     * to <code>false</code>.     *     to <code>false</code>.
349     */     */
350    public void setRangeProperties(int value, int extent, int minimum,    public void setRangeProperties(int value, int extent, int minimum,
351                                   int maximum, boolean isAdjusting)                                   int maximum, boolean isAdjusting)
# Line 400  public class DefaultBoundedRangeModel Line 372  public class DefaultBoundedRangeModel
372      fireStateChanged();      fireStateChanged();
373    }    }
374    
   
375    /**    /**
376     * Subscribes a ChangeListener to state changes.     * Subscribes a ChangeListener to state changes.
377     *     *
# Line 411  public class DefaultBoundedRangeModel Line 382  public class DefaultBoundedRangeModel
382      listenerList.add(ChangeListener.class, listener);      listenerList.add(ChangeListener.class, listener);
383    }    }
384    
   
385    /**    /**
386     * Cancels the subscription of a ChangeListener.     * Cancels the subscription of a ChangeListener.
387     *     *
# Line 422  public class DefaultBoundedRangeModel Line 392  public class DefaultBoundedRangeModel
392      listenerList.remove(ChangeListener.class, listener);      listenerList.remove(ChangeListener.class, listener);
393    }    }
394    
   
395    /**    /**
396     * Sends a {@link ChangeEvent} to any registered {@link     * Sends a {@link ChangeEvent} to any registered {@link
397     * ChangeListener}s.     * ChangeListener}s.
# Line 441  public class DefaultBoundedRangeModel Line 410  public class DefaultBoundedRangeModel
410        listeners[i].stateChanged(changeEvent);        listeners[i].stateChanged(changeEvent);
411    }    }
412    
   
413    /**    /**
414     * Retrieves the current listeners of the specified class.     * Retrieves the current listeners of the specified class.
415     *     *
416     * @param c the class of listeners; usually {@link     * @param c the class of listeners; usually {@link
417     * ChangeListener}<code>.class</code>.     *     ChangeListener}<code>.class</code>.
418     *     *
419     * @return an array with the currently subscribed listeners, or     * @return an array with the currently subscribed listeners, or
420     * an empty array if there are currently no listeners.     *     an empty array if there are currently no listeners.
421     *     *
422     * @since 1.3     * @since 1.3
423     */     */
# Line 458  public class DefaultBoundedRangeModel Line 426  public class DefaultBoundedRangeModel
426      return listenerList.getListeners(listenerType);      return listenerList.getListeners(listenerType);
427    }    }
428    
   
429    /**    /**
430     * Returns all <code>ChangeListeners</code> that are currently     * Returns all <code>ChangeListeners</code> that are currently
431     * subscribed for changes to this     * subscribed for changes to this
432     * <code>DefaultBoundedRangeModel</code>.     * <code>DefaultBoundedRangeModel</code>.
433     *     *
434     * @return an array with the currently subscribed listeners, or     * @return an array with the currently subscribed listeners, or
435     * an empty array if there are currently no listeners.     *     an empty array if there are currently no listeners.
436     *     *
437     * @since 1.4     * @since 1.4
438     */     */

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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