United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7148281 [macosx] JTabbedPane tabs with HTML text do not render correctly
JDK-7148281 : [macosx] JTabbedPane tabs with HTML text do not render correctly

Details
Type:
Bug
Submit Date:
2012-02-23
Status:
Closed
Updated Date:
2012-05-17
Project Name:
JDK
Resolved Date:
2012-03-23
Component:
client-libs
OS:
os_x
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
7u4
Fixed Versions:
7u4 (b16)

Related Reports
Backport:

Sub Tasks

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

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));
                                     
2012-02-27
EVALUATION

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



Hardware and Software, Engineered to Work Together