Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6923305

SynthSliderUI paints the slider track when the slider's "paintTrack" property is set to false

    Details

    • Subcomponent:
    • Resolved In Build:
      b86
    • CPU:
      generic
    • OS:
      generic

      Backports

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

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rupashka Pavel Porvatov (Inactive)
                  Reporter:
                  agavrilosunw Alexey Gavrilov (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: