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

[macos11] JTabPanel active tab is unreadable in Big Sur

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      15 and 16-ea
      macOS Big Sur (11.1)

      A DESCRIPTION OF THE PROBLEM :
      The text in an active JTabPanel tab will appear as white on two-tone grey on macOS Big Sur, and be unreadable.

      I've made screenshots at https://josm.openstreetmap.de/ticket/20075

      Please label the bug with 'josm-found'. Thank you!

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open anything with a JTabbedPane on macOS Big Sur.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Tab text is readable, and the tabs look the tabs in Apple menu > About this mac, with one grey background colour.
      ACTUAL -
      Tab text is white on two-tone light grey.

      ---------- BEGIN SOURCE ----------
      package start;

      import java.awt.GridLayout;
      import java.awt.Label;

      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JTabbedPane;
      import javax.swing.UIManager;
      import java.awt.Color;

      public class CreateJTabbedPaneExample {

          private static void createAndShowGUI() {

              // UNCOMMENT ME FOR WORKAROUND
              // UIManager.put("TabbedPane.foreground", Color.BLACK);
              // UNCOMMENT ME FOR WORKAROUND

              final JFrame frame = new JFrame("Split Pane Example");

              // Display the window.
              frame.setSize(500, 300);
              frame.setVisible(true);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              // set grid layout for the frame
              frame.getContentPane().setLayout(new GridLayout(1, 1));

              JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);

              tabbedPane.addTab("Tab 1", makePanel("This is tab 1"));
              tabbedPane.addTab("Tab 2", makePanel("This is tab 2"));
              tabbedPane.addTab("Tab 3", makePanel("This is tab 3"));
              tabbedPane.addTab("Tab 4", makePanel("This is tab 4"));

              frame.getContentPane().add(tabbedPane);

          }

          private static JPanel makePanel(String text) {
              JPanel pane = new JPanel();
              pane.add(new Label(text));
              pane.setLayout(new GridLayout(1, 1));
              return pane;
          }

          public static void main(String[] args) {
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                      createAndShowGUI();
                  }
              });
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      UIManager.put("TabbedPane.foreground", Color.BLACK); makes the text readable, but does not remove the old-fashioned two-tone 3D effect.

      FREQUENCY : always


            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: