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

REGRESSION: JCheckBox doesn't show on JToolBar under Windows L&F

    XMLWordPrintable

Details

    • b07
    • x86
    • windows_xp
    • Verified

    Backports

      Description

        JCheckBox does not appear in JToolBar in Windows L&F under XP. Try the following on XP in 5.0u9 (or later) or 6.0 or 7.0:

        import javax.swing.*;
        import java.awt.*;
        import java.awt.event.*;

        public class TBCBTest extends JFrame {
            
            public TBCBTest() {
                super("TBCBTest");
                
                JToolBar tb = new JToolBar();
                tb.add(new JCheckBox("One"));
                tb.add(new JCheckBox("Two"));
                tb.add(new JCheckBox("Three"));
                
                add(tb, BorderLayout.NORTH);
            }

            private static void createAndShowGUI(String[] args) {
                TBCBTest test = new TBCBTest();
                test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                test.pack();
                test.setLocationRelativeTo(null);
                test.setVisible(true);
            }
            
            public static void main(final String[] args) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        try {
                            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                        } catch (Exception e) {
                        }
                        createAndShowGUI(args);
                    }
                });
            }
        }

        The problem goes away if you use the -Dswing.noxp flag.

        Attachments

          Issue Links

            Activity

              People

                idk Igor Kushnirskiy (Inactive)
                shickeysunw Shannon Hickey (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: