< prev index next >

src/java.desktop/share/classes/javax/swing/BoundedRangeModel.java

Print this page

        

*** 27,53 **** import javax.swing.event.*; /** ! * Defines the data model used by components like <code>Slider</code>s ! * and <code>ProgressBar</code>s. * Defines four interrelated integer properties: minimum, maximum, extent * and value. These four integers define two nested ranges like this: * <pre> * minimum &lt;= value &lt;= value+extent &lt;= maximum * </pre> ! * The outer range is <code>minimum,maximum</code> and the inner ! * range is <code>value,value+extent</code>. The inner range ! * must lie within the outer one, i.e. <code>value</code> must be ! * less than or equal to <code>maximum</code> and <code>value+extent</code> ! * must greater than or equal to <code>minimum</code>, and <code>maximum</code> ! * must be greater than or equal to <code>minimum</code>. * There are a few features of this model that one might find a little * surprising. These quirks exist for the convenience of the ! * Swing BoundedRangeModel clients, such as <code>Slider</code> and ! * <code>ScrollBar</code>. * <ul> * <li> * The minimum and maximum set methods "correct" the other * three properties to accommodate their new value argument. For * example setting the model's minimum may change its maximum, value, --- 27,53 ---- import javax.swing.event.*; /** ! * Defines the data model used by components like {@code Slider}s ! * and {@code ProgressBar}s. * Defines four interrelated integer properties: minimum, maximum, extent * and value. These four integers define two nested ranges like this: * <pre> * minimum &lt;= value &lt;= value+extent &lt;= maximum * </pre> ! * The outer range is {@code minimum,maximum} and the inner ! * range is {@code value,value+extent}. The inner range ! * must lie within the outer one, i.e. {@code value} must be ! * less than or equal to {@code maximum} and {@code value+extent} ! * must greater than or equal to {@code minimum}, and {@code maximum} ! * must be greater than or equal to {@code minimum}. * There are a few features of this model that one might find a little * surprising. These quirks exist for the convenience of the ! * Swing BoundedRangeModel clients, such as {@code Slider} and ! * {@code ScrollBar}. * <ul> * <li> * The minimum and maximum set methods "correct" the other * three properties to accommodate their new value argument. For * example setting the model's minimum may change its maximum, value,
*** 55,65 **** * specified above. * * <li> * The value and extent set methods "correct" their argument to * fit within the limits defined by the other three properties. ! * For example if <code>value == maximum</code>, <code>setExtent(10)</code> * would change the extent (back) to zero. * * <li> * The four BoundedRangeModel values are defined as Java Beans properties * however Swing ChangeEvents are used to notify clients of changes rather --- 55,65 ---- * specified above. * * <li> * The value and extent set methods "correct" their argument to * fit within the limits defined by the other three properties. ! * For example if {@code value == maximum}, {@code setExtent(10)} * would change the extent (back) to zero. * * <li> * The four BoundedRangeModel values are defined as Java Beans properties * however Swing ChangeEvents are used to notify clients of changes rather
*** 133,162 **** void setMaximum(int newMaximum); /** * Returns the model's current value. Note that the upper ! * limit on the model's value is <code>maximum - extent</code> ! * and the lower limit is <code>minimum</code>. * * @return the model's value * @see #setValue */ int getValue(); /** ! * Sets the model's current value to <code>newValue</code> if <code>newValue</code> * satisfies the model's constraints. Those constraints are: * <pre> * minimum &lt;= value &lt;= value+extent &lt;= maximum * </pre> ! * Otherwise, if <code>newValue</code> is less than <code>minimum</code> ! * it's set to <code>minimum</code>, if its greater than ! * <code>maximum</code> then it's set to <code>maximum</code>, and ! * if it's greater than <code>value+extent</code> then it's set to ! * <code>value+extent</code>. * <p> * When a BoundedRange model is used with a scrollbar the value * specifies the origin of the scrollbar knob (aka the "thumb" or * "elevator"). The value usually represents the origin of the * visible part of the object being scrolled. --- 133,162 ---- void setMaximum(int newMaximum); /** * Returns the model's current value. Note that the upper ! * limit on the model's value is {@code maximum - extent} ! * and the lower limit is {@code minimum}. * * @return the model's value * @see #setValue */ int getValue(); /** ! * Sets the model's current value to {@code newValue} if {@code newValue} * satisfies the model's constraints. Those constraints are: * <pre> * minimum &lt;= value &lt;= value+extent &lt;= maximum * </pre> ! * Otherwise, if {@code newValue} is less than {@code minimum} ! * it's set to {@code minimum}, if its greater than ! * {@code maximum} then it's set to {@code maximum}, and ! * if it's greater than {@code value+extent} then it's set to ! * {@code value+extent}. * <p> * When a BoundedRange model is used with a scrollbar the value * specifies the origin of the scrollbar knob (aka the "thumb" or * "elevator"). The value usually represents the origin of the * visible part of the object being scrolled.
< prev index next >