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

Nimbus shows space between button's border and lable even with 0 margins

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 6u16
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description

      java version "1.6.0_16"
      Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
      Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

      Does this problem occur on J2SE 5.0.x or 6.0? Yes / No (pick one)
      Yes

      Operating System Configuration Information (be specific):
      Client: Microsoft Windows XP [Version 5.1.2600]

      Bug Description:
      Nimbus shows space between button's border and label even with 0 margins

      The setMargin JavaDoc states: 'Sets space for margin between the button's border
      and the label.' This works fine for all the other installed look and feels
      (Metal, Motif, Windows and Classic).

      The only one that it does not work for is Nimbus where it can clearly be seen
      that there is space between the text and the button.
      When showing a button with all this extra space for a close button on a Tab,
      it looks really bad, and takes up far too much room.

      import static java.lang.System.*;
      import static javax.swing.JFrame.*;
      import java.awt.*;
      import javax.swing.*;

      public class Test {
        public static void main(String[] args) {
          try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
            JButton button = new JButton("X");
            button.setMargin(new Insets(0, 0, 0, 0));
            JFrame frame = new JFrame();
            frame.setLayout(new FlowLayout());
            frame.add(button);
            frame.setSize(500, 500);
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
            frame.setVisible(true);
          }
          catch (Exception ex) {
            out.println(ex);
          }
        }
      }

      }

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov (Inactive)
              Reporter:
              tyao Ting-Yun Ingrid Yao (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: