JDK-7148281 : [macosx] JTabbedPane tabs with HTML text do not render correctly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-02-23
  • Updated: 2012-05-17
  • Resolved: 2012-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u4 b16Fixed 8Fixed
Description
Related NetBeans bug:
https://www.netbeans.org/bugzilla/show_bug.cgi?id=208500

Screenshot of the problem:
http://bugzilla-attachments-208500.netbeans.org/bugzilla/attachment.cgi?id=115808

NetBeans IDE uses HTML in titles of tabs in the output window to highlight the outputs which are important to the user. On 7u4 on Mac the HTML breaks tabs appearance.

If possible NetBeans team would like to have this fixed on Java side in 7u4. Otherwise we will need to turn off HTML highlighting of the important output tabs in NetBeans for the users.
To reproduce the issue run the code:
---------------------------------
import javax.swing.*;

public class MyTabbedPane {

    public static void main(String[] args) throws Exception {

        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                createAndShowGUI();
            }
        });
    }

    private static void createAndShowGUI() {
        JFrame frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 300);

        JTabbedPane tabbedPane = new JTabbedPane();

        for (int i = 0; i < 4; i++) {
            String title = "<html><i>Title</i>" + i;
            tabbedPane.insertTab(title, null, new JPanel(), "tip " + i, i);
            tabbedPane.setTabComponentAt(i, new JLabel(title));
        }

        frame.getContentPane().add(tabbedPane);
        frame.setVisible(true);
    }
}
---------------------------------

Comments
EVALUATION changeset: http://hg.openjdk.java.net/jdk7u/jdk7u-dev/jdk/rev/3ddf17681087
17-05-2012

EVALUATION The Aqua L&F paints the tab title even a component is set for the tab title by method: tabbedPane.setTabComponentAt(i, new JLabel(title));
27-02-2012