JDK-4691522 : icons are overwritten in vertical tabs in JTabbedPane
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 2002-05-24
  • Updated: 2003-01-07
  • Resolved: 2002-11-27
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 Other
1.4.1_02 02Fixed 1.4.2Fixed
Related Reports
Relates :  
Description

Name: ks84122			Date: 05/24/2002


Run the attached program.  Box.gif is a 32x16 image(attached) (bug does not
happen with 16x16 image). Notice how left part of box.gif is overwritten in 
2nd and greater columns. The letter "I" that's painted in red can not be seen
in 2nd and greater columns. This happens in Motif L&F on solaris and windows.

reproducible with JDK 1.4 and 1.4.1 (build 13)

import javax.swing.*;

public class TabBug {
  public static void main(String[] args) {
    try {
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
    }
    catch (Exception ex) {

    }
    Icon icon = new ImageIcon(TabBug.class.getResource("box.gif"));
    JFrame frame = new JFrame();
    JTabbedPane tabs = new JTabbedPane();
    tabs.setTabPlacement(JTabbedPane.RIGHT);
    for (int i = 0; i < 50; i++) {
      tabs.addTab(i + "", icon, new JPanel());
    }
    frame.getContentPane().add(tabs);
    frame.setSize(300, 400);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.show();
  }
}
(Review ID: 146870) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.1_02 mantis-beta FIXED IN: 1.4.1_02 mantis-beta INTEGRATED IN: 1.4.1_02 mantis-b12 mantis-beta
14-06-2004

EVALUATION Seems to happen when the text inside is longer than a certain amoun since it does not happen with tabs 1-9. The layout calculations are probably being done incorrectly. ###@###.### 2002-05-28 The overwriting is happening because of the getTabRunOverlay method in com/sun/java/swing/plaf/motif/MotifTabbedPaneUI.java I feel that the overlay should be always less than the insets of any tab. If the overlay is more, then the next run of tabs will cover /obscure the tabs in the previous run by overlay amount. The problem is corrected by checking the run overlay amount against insets. ###@###.### 2002-11-15
15-11-2002

WORK AROUND Workaround -1 : to have a customUI defined and override the method protected int getTabRunOverlay () { return 2; } for motif look & feel Workaround -2 : Override the default TabInsets with the following, when setting look & feel to Motif L&F. UIManager.put("TabbedPane.tabInsets", new Insets(5,10,5,10)); ###@###.### 2002-11-04
04-11-2002