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);
}
}
--------------------