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

[macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 8u60
    • client-libs
    • b105
    • x86
    • os_x

    Description

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      $ uname -a
      Darwin scrappy.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64


      A DESCRIPTION OF THE PROBLEM :
      When the JOptionPane option buttons need a bigger width than the message, the calculated width appears to be a bit too short; the left edge of the first button is truncated.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached program on a Mac; note that the left edge of the "1" button is truncated.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      All option buttons are fully visible.
      ACTUAL -
      The left edge of the first button ("1") is truncated.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class OptionPane
      {
        public static void main(final String[] args) throws Exception
        {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JOptionPane.showOptionDialog(frame,
                                       "JOptionPane",
                                       "JOptionPane",
                                       JOptionPane.INFORMATION_MESSAGE,
                                       JOptionPane.DEFAULT_OPTION,
                                       null,
                                       new String[]{"3","2","1"},
                                       null);
          System.exit(0);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Make the message long enough to force a bigger overall width:

      import javax.swing.*;

      public class OptionPane
      {
        public static void main(final String[] args) throws Exception
        {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JOptionPane.showOptionDialog(frame,
                                       "JOptionPane with a longer description...",
                                       "JOptionPane",
                                       JOptionPane.INFORMATION_MESSAGE,
                                       JOptionPane.DEFAULT_OPTION,
                                       null,
                                       new String[]{"3","2","1"},
                                       null);
          System.exit(0);
        }
      }


      Attachments

        Activity

          People

            rchamyal Rajeev Chamyal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: