-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.1.6, 1.3.0, 1.3.1
-
x86, sparc
-
linux, solaris_2.5.1, solaris_2.6
Name: skT88420 Date: 09/28/99
For JSlider, if you setExtent as, say 5, and the max value is 100,
the slider will take values only upto 95 (ie., max - extent). If
you pull the knob, it does go to the end, but the value returned
is still 95. And it doesn't go beyond 95 by clicking to the right
of the knob.
To reproduce this, you just run the following code.
I am using swing 1.1.1
java version "1.1.6"
java full version "JDK1.1.6N"
SunOS tarang 5.5.1 Generic_103640-28 sun4u sparc SUNW,Ultra-1
Source code to reproduce the problem:
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Slider implements ChangeListener {
public static void main(String[] args) {
JSlider slider = new JSlider();
slider.addChangeListener(new Slider());
JFrame window = new JFrame();
window.getContentPane().add(slider);
slider.setExtent(5);
slider.setVisible(true);
window.pack();
window.setVisible(true);
System.out.println("Slider: extent = " + slider.getExtent()
+ " min = " + slider.getMinimum()
+ " max = " + slider.getMaximum());
}
public void stateChanged(ChangeEvent chEvent) {
System.out.println("In SliderListener.stateChanged");
if (chEvent.getSource() instanceof JSlider) {
if (!((JSlider)chEvent.getSource()).getValueIsAdjusting())
System.out.println("slider.value = " + ((JSlider)chEvent.getSource()).getValue());
else System.out.println("value is adjusting");
}
}
}
(Review ID: 95833)
======================================================================
- duplicates
-
JDK-4344469 unix: JSlider knob can occupy incorrect position
-
- Closed
-