[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: small fix for JSlider
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: small fix for JSlider |
Date: |
Tue, 19 Jul 2005 14:22:28 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050426) |
I committed this patch:
2005-17-19 David Gilbert <address@hidden>
* javax/swing/JSlider.java
(createStandardLabels(int)): updated API docs,
(createStandardLabels(int, int)): throw IllegalArgumentException for
bad arguments.
Mauve tests are written, and will be committed to CVS soon.
Regards,
Dave Gilbert
Index: javax/swing/JSlider.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JSlider.java,v
retrieving revision 1.15
diff -u -r1.15 JSlider.java
--- javax/swing/JSlider.java 18 Jul 2005 22:16:29 -0000 1.15
+++ javax/swing/JSlider.java 19 Jul 2005 13:17:01 -0000
@@ -648,9 +648,12 @@
* minimum and increase by the increment. Each label will have a text
* string indicating their integer value.
*
- * @param increment The increment to between labels.
+ * @param increment The increment between labels (must be > 0).
*
* @return A hashtable with the labels and their keys.
+ *
+ * @throws IllegalArgumentException if <code>increment</code> is not greater
+ * than zero.
*/
public Hashtable createStandardLabels(int increment)
{
@@ -661,15 +664,23 @@
* Creates a hashtable of (Integer, JLabel) pairs that can be used as a
* label table for this slider. The labels will start from the given start
* value and increase by the increment. Each label will have a text string
- * indicating their integer value.
+ * indicating its integer value.
*
- * @param increment The increment to between labels.
+ * @param increment The increment between labels (must be > 0).
* @param start The value to start from.
*
* @return A hashtable with the labels and their keys.
+ *
+ * @throws IllegalArgumentException if <code>increment</code> is not greater
+ * than zero, or <code>start</code> is not within the range of the
+ * model.
*/
public Hashtable createStandardLabels(int increment, int start)
{
+ if (increment <= 0)
+ throw new IllegalArgumentException("Requires 'increment' > 0.");
+ if (start < getMinimum() || start > getMaximum())
+ throw new IllegalArgumentException("The 'start' value is out of range.");
Hashtable table = new Hashtable();
JLabel label;
Dimension dim;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: small fix for JSlider,
David Gilbert <=