diff options
author | David Gilbert <david.gilbert@object-refinery.com> | 2005-07-19 13:20:37 +0000 |
---|---|---|
committer | David Gilbert <david.gilbert@object-refinery.com> | 2005-07-19 13:20:37 +0000 |
commit | da8792193f6f9e965657652e112f61db709e8418 (patch) | |
tree | ceba247a7405045988d624d00fc9bdb8c12b0265 /javax/swing/JSlider.java | |
parent | 09fafa54cb7b2302f818cd44a151cc7c638a815a (diff) | |
download | classpath-da8792193f6f9e965657652e112f61db709e8418.tar.gz |
2005-17-19 David Gilbert <david.gilbert@object-refinery.com>
* javax/swing/JSlider.java
(createStandardLabels(int)): updated API docs,
(createStandardLabels(int, int)): throw IllegalArgumentException for
bad arguments.
Diffstat (limited to 'javax/swing/JSlider.java')
-rw-r--r-- | javax/swing/JSlider.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/javax/swing/JSlider.java b/javax/swing/JSlider.java index 2187311d9..1761b31af 100644 --- a/javax/swing/JSlider.java +++ b/javax/swing/JSlider.java @@ -648,9 +648,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible, * 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 @@ public class JSlider extends JComponent implements SwingConstants, Accessible, * 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; |