-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
7
-
x86
-
windows_7
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b108)
Java HotSpot(TM) Client VM (build 19.0-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
Tabs are not drawn correctly when the layout policy is SCROLL_TAB_LAYOUT.
This may be related to bug 6747580, but it is much worse in 1.7.0 b108 than in 1.6.0u21 and earlier. I selected the option for regression from 6u21, but this may not be not strictly correct. Tabs are also drawn incorreclty in Java 6, but the visual discrepency is worse in Java 7. Under Java 6, the blue line was missing and there appears to be an issue with size calculations. Under Java 7, the tabs are invisible (see "Actual Result" for a detailed description.) Also, in Java 6 some workarounds are possible (don't use border layout, use BOTTOM tab position). These no longer work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JTabbedPane using Nimnbus Look and Feel.
2. Set the layout policy to JTabbedPane.SCROLL_TAB_LAYOUT.
3. Add one or more tabs.
4. Display the tabbed pane in window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tabbed pane should be drawn similarly to WRAP_TAB_LAYOUT (except limited to a single row and possibly displaying scroll buttons).
ACTUAL -
The tabs are drawn in a flat background colour (same as the default tabbed pane background colour so that they don't even look like tabs), are not spaced correctly, and lack the usual blue decorations. Apart from the obvious visual issues, it is also harder to correctly select the intended tab because it is difficult to determine where one tab ends and another starts.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
N/A (no crash or exception occurs)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.EventQueue;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
public class bug {
public static void main( String[] args ) {
EventQueue.invokeLater( new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel( "javax.swing.plaf.nimbus.NimbusLookAndFeel" );
} catch( Throwable t ) {
System.err.println( "Run against JRE 7" );
t.printStackTrace();
}
JFrame f = new JFrame("Test");
// NOTE: bug not restricted to BorderLayout
f.setLayout( new FlowLayout() );
JTabbedPane tp = new JTabbedPane();
tp.addTab( "0", new JLabel("Tab Content 0") );
tp.addTab( "1", new JLabel("Tab Content 1") );
tp.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT );
f.add( tp );
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.pack();
f.setVisible( true );
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None found, and importantly, workarounds for a similar issue in Java 6 (see bug 6747580) no longer work.
This is a defect of javax.swing.plaf.nimbus.NimbusLookAndFeel
and com.sun.java.swing.plaf.gtk.GTKLookAndFeel.
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b108)
Java HotSpot(TM) Client VM (build 19.0-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
Tabs are not drawn correctly when the layout policy is SCROLL_TAB_LAYOUT.
This may be related to bug 6747580, but it is much worse in 1.7.0 b108 than in 1.6.0u21 and earlier. I selected the option for regression from 6u21, but this may not be not strictly correct. Tabs are also drawn incorreclty in Java 6, but the visual discrepency is worse in Java 7. Under Java 6, the blue line was missing and there appears to be an issue with size calculations. Under Java 7, the tabs are invisible (see "Actual Result" for a detailed description.) Also, in Java 6 some workarounds are possible (don't use border layout, use BOTTOM tab position). These no longer work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JTabbedPane using Nimnbus Look and Feel.
2. Set the layout policy to JTabbedPane.SCROLL_TAB_LAYOUT.
3. Add one or more tabs.
4. Display the tabbed pane in window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tabbed pane should be drawn similarly to WRAP_TAB_LAYOUT (except limited to a single row and possibly displaying scroll buttons).
ACTUAL -
The tabs are drawn in a flat background colour (same as the default tabbed pane background colour so that they don't even look like tabs), are not spaced correctly, and lack the usual blue decorations. Apart from the obvious visual issues, it is also harder to correctly select the intended tab because it is difficult to determine where one tab ends and another starts.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
N/A (no crash or exception occurs)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.EventQueue;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
public class bug {
public static void main( String[] args ) {
EventQueue.invokeLater( new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel( "javax.swing.plaf.nimbus.NimbusLookAndFeel" );
} catch( Throwable t ) {
System.err.println( "Run against JRE 7" );
t.printStackTrace();
}
JFrame f = new JFrame("Test");
// NOTE: bug not restricted to BorderLayout
f.setLayout( new FlowLayout() );
JTabbedPane tp = new JTabbedPane();
tp.addTab( "0", new JLabel("Tab Content 0") );
tp.addTab( "1", new JLabel("Tab Content 1") );
tp.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT );
f.add( tp );
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.pack();
f.setVisible( true );
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None found, and importantly, workarounds for a similar issue in Java 6 (see bug 6747580) no longer work.
This is a defect of javax.swing.plaf.nimbus.NimbusLookAndFeel
and com.sun.java.swing.plaf.gtk.GTKLookAndFeel.
- duplicates
-
JDK-7031915 JTabbedPane is worse: tabs aren't renderd
-
- Closed
-