Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P2
-
Resolution: Fixed
-
Affects Version/s: 6u10, 7
-
Fix Version/s: 7
-
Component/s: client-libs
-
Subcomponent:
-
Resolved In Build:b86
-
CPU:generic
-
OS:generic
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2191927 | 6u21 | Alexander Potochkin | P2 | Closed | Fixed | b04 |
Description
The SynthSliderUI class invokes the paintTrack method even though the "paintTrack" property of a slider component being painted was set to false. The spec on the JSlider.html#setPaintTrack(boolean) says that the method controls whether or not to paint the slider track.
Here is a sample program that demonstrates this:
------------------
import javax.swing.*;
import javax.swing.plaf.synth.*;
import java.awt.*;
public class Test {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
runTest();
}
});
}
private static void runTest() {
try {
UIManager.setLookAndFeel(new SynthLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
JSlider slider = new JSlider();
slider.setPaintTrack(false);
slider.setUI(new SynthSliderUI(slider) {
@Override
protected void paintTrack(SynthContext context, Graphics g,
Rectangle trackBounds) {
super.paintTrack(context, g, trackBounds);
System.out.println("paintTrack called");
}
});
JFrame jFrame = new JFrame();
jFrame.getContentPane().add(slider);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.pack();
jFrame.setVisible(true);
}
}
--------------------
Here is a sample program that demonstrates this:
------------------
import javax.swing.*;
import javax.swing.plaf.synth.*;
import java.awt.*;
public class Test {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
runTest();
}
});
}
private static void runTest() {
try {
UIManager.setLookAndFeel(new SynthLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
JSlider slider = new JSlider();
slider.setPaintTrack(false);
slider.setUI(new SynthSliderUI(slider) {
@Override
protected void paintTrack(SynthContext context, Graphics g,
Rectangle trackBounds) {
super.paintTrack(context, g, trackBounds);
System.out.println("paintTrack called");
}
});
JFrame jFrame = new JFrame();
jFrame.getContentPane().add(slider);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.pack();
jFrame.setVisible(true);
}
}
--------------------
Attachments
Issue Links
- backported by
-
JDK-2191927 SynthSliderUI paints the slider track when the slider's "paintTrack" property is set to false
-
- Closed
-
- duplicates
-
JDK-6939209 Nimbus: JSlider setPaintTrack(boolean) method doesn't work as expected
-
- Closed
-