Java Swing rendering bug on Windows 7 look-and-feel?

Posted by John B. on Stack Overflow See other posts from Stack Overflow or by John B.
Published on 2010-05-02T17:35:45Z Indexed on 2010/05/02 17:37 UTC
Read the original article Hit count: 169

Filed under:
|
|

The knob on vertical JSlider's on my Windows 7 machine (with native look-and-feel) is really, really tiny in both directions. Not just skinny but short as well. alt text

Can anyone confirm this? Should I report it? If so, where? Thanks!

Here is the code for the sample program (in the screen shot):

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.SwingConstants;
import javax.swing.UIManager;


public class SliderTest
{
    public static void main( String[] args )
    {
        // Set the look and feel to that of the system
        try
        { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); }
        catch ( Exception e )
        { System.err.println( e ); }


        // Launch the GUI from the event dispatch thread
        javax.swing.SwingUtilities.invokeLater( new Runnable()
        {
            public void run ()
            {
                JFrame window = new JFrame();
                window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

                JPanel contentPane = new JPanel();
                contentPane.add( new JSlider(SwingConstants.HORIZONTAL) );
                contentPane.add( new JSlider(SwingConstants.VERTICAL) );

                window.setContentPane( contentPane );
                window.pack();
                window.setLocationRelativeTo( null ); // Center window
                window.setVisible( true );
            }
        });
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about swing