Imported GNU Classpath 0.20
[official-gcc.git] / libjava / classpath / javax / swing / BoundedRangeModel.java
blob54446acd5eae4d3bdbd36a69199bbfa229c9b23c
1 /* BoundedRangeModel.java --
2 Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing;
41 import javax.swing.event.ChangeEvent;
42 import javax.swing.event.ChangeListener;
44 /**
45 * The data model that represents a <i>range</i> that is constrained to fit
46 * within specified <i>bounds</i>. The range is defined as <code>value</code>
47 * to <code>value + extent</code>, where both <code>value</code> and
48 * <code>extent</code> are integers, and <code>extent >= 0</code>. The bounds
49 * are defined by integers <code>minimum</code> and <code>maximum</code>.
50 * <p>
51 * This type of model is used in components that display a range of values,
52 * like {@link JProgressBar} and {@link JSlider}.
54 * @author Andrew Selkirk
56 public interface BoundedRangeModel
58 /**
59 * Returns the current value for the model.
61 * @return The current value for the model.
63 * @see #setValue(int)
65 int getValue();
67 /**
68 * Sets the value for the model and sends a {@link ChangeEvent} to
69 * all registered listeners. The new value must satisfy the constraint
70 * <code>min <= value <= value + extent <= max</code>.
72 * @param value the value
74 * @see #getValue()
76 void setValue(int value);
78 /**
79 * Returns the lower bound for the model. The start of the model's range
80 * (see {@link #getValue()}) cannot be less than this lower bound.
82 * @return The lower bound for the model.
84 * @see #setMinimum(int)
85 * @see #getMaximum()
87 int getMinimum();
89 /**
90 * Sets the lower bound for the model and sends a {@link ChangeEvent} to all
91 * registered listeners. The new minimum must be less than or equal to the
92 * start value of the model's range (as returned by {@link #getValue()}).
94 * @param minimum the minimum value
96 * @see #getMinimum()
98 void setMinimum(int minimum);
101 * Returns the upper bound for the model. This sets an upper limit for the
102 * end value of the model's range ({@link #getValue()} +
103 * {@link #getExtent()}).
105 * @return The upper bound for the model.
107 * @see #setMaximum(int)
108 * @see #getMinimum()
110 int getMaximum();
113 * Sets the upper bound for the model and sends a {@link ChangeEvent} to all
114 * registered listeners. The new maximum must be greater than or equal to the
115 * end value of the model's range (as returned by {@link #getValue()} +
116 * {@link #getExtent()}).
118 * @param maximum the maximum value
120 * @see #getMaximum()
122 void setMaximum(int maximum);
125 * Returns the value of the <code>valueIsAdjusting</code> property.
127 * @return <code>true</code> if value is adjusting,
128 * otherwise <code>false</code>
130 * @see #setValueIsAdjusting(boolean)
132 boolean getValueIsAdjusting();
135 * Sets the <code>valueIsAdjusting</code> property.
137 * @param adjusting <code>true</code> if adjusting,
138 * <code>false</code> otherwise
140 * @see #getValueIsAdjusting()
142 void setValueIsAdjusting(boolean adjusting);
145 * Returns the current extent.
147 * @return the extent
149 * @see #setExtent(int)
151 int getExtent();
154 * Sets the extent, which is the length of the model's range, and sends a
155 * {@link ChangeEvent} to all registered listeners.
157 * @param extent the extent
159 * @see #getExtent()
161 void setExtent(int extent);
164 * Sets all the properties for the model in a single call.
166 * @param value the value
167 * @param extent the extent
168 * @param minimum the minimum value
169 * @param maximum the maximum value
170 * @param adjusting a flag that indicates the model is being adjusted
171 * continuously.
173 void setRangeProperties(int value, int extent, int minimum, int maximum,
174 boolean adjusting);
177 * Adds a <code>ChangeListener</code> to this object.
179 * @param listener the listener to add
181 * @see #removeChangeListener(ChangeListener)
183 void addChangeListener(ChangeListener listener);
186 * Removes a <code>ChangeListener</code> from this object.
188 * @param listener the listener to remove
190 * @see #addChangeListener(ChangeListener)
192 void removeChangeListener(ChangeListener listener);