JDK-6815439 : Removing a null tab may disorganize titles with htlm content.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2009-03-10
  • Updated: 2021-12-20
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.
Other
tbdUnresolved
Related Reports
Relates :  
Description
JTabbedPane supports tab with null component, however it treats it in a special way.
Swing doesn't allow null component to be added, so the usual machinery with 
ContainerListener.componentAdded/componentRemoved doesn't work.

It leads to a situation when html views vector goes unsynchronized when a tab with a null component is removed, so you can see html tags in the tab's title
instead of real html formatting.

import javax.swing.*;

public class MyTest {

    private static void createGui() {
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        JTabbedPane pane = new JTabbedPane();
        pane.addTab("Hello", null, null);
        
        // This line would work        
//        pane.addTab("Hello", null, new JPanel());
        pane.addTab("<html><u>underlined text</u></html>", null, null);
        pane.removeTabAt(0);
        frame.add(pane);

        frame.setSize(200, 200);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                MyTest.createGui();
            }
        });
    }
}

Comments
- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

EVALUATION We should catch the situation when null tab is removed and keep the vector with html views in a correct state
10-03-2009