JDK-6923305 : SynthSliderUI paints the slider track when the slider's "paintTrack" property is set to false
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10,7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-02-04
  • Updated: 2012-03-22
  • Resolved: 2010-03-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u21Fixed 7 b86Fixed
Related Reports
Duplicate :  
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() {
            public void run() {

    private static void runTest() {
        try {
            UIManager.setLookAndFeel(new SynthLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            throw new RuntimeException(e);
        JSlider slider = new JSlider();
        slider.setUI(new SynthSliderUI(slider) {

            protected void paintTrack(SynthContext context, Graphics g,
                    Rectangle trackBounds) {
                super.paintTrack(context, g, trackBounds);
                System.out.println("paintTrack called");

        JFrame jFrame = new JFrame();

EVALUATION The SynthSliderUI#paintTrack method shouldn't be invoked in case the paintTrack property is false. A part of the BasicSliderUI#paint method can be an example of correct code: if ( slider.getPaintTrack() && clip.intersects( trackRect ) ) { paintTrack( g ); }