2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Defines the data model used by components like <code>Slider</code>s 0N/A * and <code>ProgressBar</code>s. 0N/A * Defines four interrelated integer properties: minimum, maximum, extent 0N/A * and value. These four integers define two nested ranges like this: 0N/A * minimum <= value <= value+extent <= maximum 0N/A * The outer range is <code>minimum,maximum</code> and the inner 0N/A * range is <code>value,value+extent</code>. The inner range 0N/A * must lie within the outer one, i.e. <code>value</code> must be 0N/A * less than or equal to <code>maximum</code> and <code>value+extent</code> 0N/A * must greater than or equal to <code>minimum</code>, and <code>maximum</code> 0N/A * must be greater than or equal to <code>minimum</code>. 0N/A * There are a few features of this model that one might find a little 0N/A * surprising. These quirks exist for the convenience of the 0N/A * Swing BoundedRangeModel clients, such as <code>Slider</code> and 0N/A * <code>ScrollBar</code>. 0N/A * The minimum and maximum set methods "correct" the other 0N/A * three properties to accommodate their new value argument. For 0N/A * example setting the model's minimum may change its maximum, value, 0N/A * and extent properties (in that order), to maintain the constraints 0N/A * The value and extent set methods "correct" their argument to 0N/A * fit within the limits defined by the other three properties. 0N/A * For example if <code>value == maximum</code>, <code>setExtent(10)</code> 0N/A * would change the extent (back) to zero. 0N/A * The four BoundedRangeModel values are defined as Java Beans properties 0N/A * however Swing ChangeEvents are used to notify clients of changes rather 0N/A * than PropertyChangeEvents. This was done to keep the overhead of monitoring 0N/A * a BoundedRangeModel low. Changes are often reported at MouseDragged rates. 0N/A * For an example of specifying custom bounded range models used by sliders, 0N/A * in <em>The Java Tutorial.</em> 0N/A * @author Hans Muller 0N/A * @see DefaultBoundedRangeModel 0N/A * Returns the minimum acceptable value. 0N/A * @return the value of the minimum property 0N/A * Sets the model's minimum to <I>newMinimum</I>. The 0N/A * other three properties may be changed as well, to ensure 0N/A * minimum <= value <= value+extent <= maximum 0N/A * Notifies any listeners if the model changes. 0N/A * @param newMinimum the model's new minimum 0N/A * @see #addChangeListener 0N/A * Returns the model's maximum. Note that the upper 0N/A * limit on the model's value is (maximum - extent). 0N/A * @return the value of the maximum property. 0N/A * Sets the model's maximum to <I>newMaximum</I>. The other 0N/A * three properties may be changed as well, to ensure that 0N/A * minimum <= value <= value+extent <= maximum 0N/A * Notifies any listeners if the model changes. 0N/A * @param newMaximum the model's new maximum 0N/A * @see #addChangeListener 0N/A * Returns the model's current value. Note that the upper 0N/A * limit on the model's value is <code>maximum - extent</code> 0N/A * and the lower limit is <code>minimum</code>. 0N/A * @return the model's value 0N/A * Sets the model's current value to <code>newValue</code> if <code>newValue</code> 0N/A * satisfies the model's constraints. Those constraints are: 0N/A * minimum <= value <= value+extent <= maximum 0N/A * Otherwise, if <code>newValue</code> is less than <code>minimum</code> 0N/A * it's set to <code>minimum</code>, if its greater than 0N/A * <code>maximum</code> then it's set to <code>maximum</code>, and 0N/A * if it's greater than <code>value+extent</code> then it's set to 0N/A * <code>value+extent</code>. 0N/A * When a BoundedRange model is used with a scrollbar the value 0N/A * specifies the origin of the scrollbar knob (aka the "thumb" or 0N/A * "elevator"). The value usually represents the origin of the 0N/A * visible part of the object being scrolled. 0N/A * Notifies any listeners if the model changes. 0N/A * @param newValue the model's new value 0N/A * This attribute indicates that any upcoming changes to the value 0N/A * of the model should be considered a single event. This attribute 0N/A * will be set to true at the start of a series of changes to the value, 0N/A * and will be set to false when the value has finished changing. Normally 0N/A * this allows a listener to only take action when the final value change in 0N/A * committed, instead of having to do updates for all intermediate values. 0N/A * Sliders and scrollbars use this property when a drag is underway. 0N/A * @param b true if the upcoming changes to the value property are part of a series 0N/A * Returns true if the current changes to the value property are part 0N/A * of a series of changes. 0N/A * @return the valueIsAdjustingProperty. 0N/A * @see #setValueIsAdjusting 0N/A * Returns the model's extent, the length of the inner range that 0N/A * begins at the model's value. 0N/A * @return the value of the model's extent property 0N/A * Sets the model's extent. The <I>newExtent</I> is forced to 0N/A * be greater than or equal to zero and less than or equal to 0N/A * When a BoundedRange model is used with a scrollbar the extent 0N/A * defines the length of the scrollbar knob (aka the "thumb" or 0N/A * "elevator"). The extent usually represents how much of the 0N/A * object being scrolled is visible. When used with a slider, 0N/A * the extent determines how much the value can "jump", for 0N/A * example when the user presses PgUp or PgDn. 0N/A * Notifies any listeners if the model changes. 0N/A * @param newExtent the model's new extent 0N/A * This method sets all of the model's data with a single method call. 0N/A * The method results in a single change event being generated. This is 0N/A * convenient when you need to adjust all the model data simultaneously and 0N/A * do not want individual change events to occur. 0N/A * @param value an int giving the current value 0N/A * @param extent an int giving the amount by which the value can "jump" 0N/A * @param min an int giving the minimum value 0N/A * @param max an int giving the maximum value 0N/A * @param adjusting a boolean, true if a series of changes are in 0N/A * @see #setValueIsAdjusting 0N/A * Adds a ChangeListener to the model's listener list. 0N/A * @param x the ChangeListener to add 0N/A * @see #removeChangeListener 0N/A * Removes a ChangeListener from the model's listener list. 0N/A * @param x the ChangeListener to remove 0N/A * @see #addChangeListener