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

JCheckBox looks bad with some themes on Ubuntu.

XMLWordPrintable

      JCheckBox looks bad with some themes on Ubuntu.
      This issue is originally reported against NetBeans Installer (which runs on Java):
      http://www.netbeans.org/issues/show_bug.cgi?id=142650

      It is broken with JDK5u16 and looks much better with OpenJDK6 and jdk 6u10.
      It works fine with Metal and Nimbus but looks ugly with GTK L&F.
      http://www.netbeans.org/nonav/issues/showattachment.cgi/67563/ScreenShots.zip

      Tony (in CC) can give more info if required.

      The source code of the demo used in the issue:

      package jcheckboxcheck;
      import java.awt.Container;
      import java.awt.GridBagConstraints;
      import java.awt.GridBagLayout;
      import java.awt.Insets;
      import java.util.logging.Level;
      import java.util.logging.Logger;
      import javax.swing.JCheckBox;
      import javax.swing.JFrame;
      import javax.swing.JLabel;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;

      public class Main {
          public static void main(String[] args) {
             String[] lafs = {"javax.swing.plaf.metal.MetalLookAndFeel",
                  "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel",
                  "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
              };
              for (String laf : lafs) {
                  try {
                      UIManager.getInstalledLookAndFeels();
                      UIManager.setLookAndFeel(laf);
                      JCheckBox box = new JCheckBox();
                      JFrame theFrame = new JFrame("Label Test");
                      theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                      theFrame.setLayout(new GridBagLayout());
                      Container contentPane = theFrame.getContentPane();

                      contentPane.add(box, new GridBagConstraints(0,0,0,0,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(11, 11, 0, 11), 0, 0));
                      theFrame.setSize(400, 100);
                      theFrame.setLocation(600, 400);
                      theFrame.setVisible(true);
                      box.setText("This is a long, long checkbox, try it, please");
                      try {
                          Thread.sleep(5000);
                      } catch (InterruptedException ex) {
                          Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                      }
                      theFrame.setVisible(false);
                  } catch (ClassNotFoundException ex) {
                  } catch (InstantiationException ex) {
                  } catch (IllegalAccessException ex) {
                  } catch (UnsupportedLookAndFeelException ex) {
                  }
              }
              System.exit(0);
          }
      }

            stayer Kirill Kirichenko (Inactive)
            dlipin Dmitry Lipin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: