-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b10
-
b25
-
x86
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2212242 | 7u4 | Pavel Porvatov | P3 | Closed | Fixed | b10 |
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b121)
Java HotSpot(TM) Client VM (build 20.0-b03, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The text position for selected tabs is different to Java 5/6. On Java 5/6 the selected text is raised by default (2 pixels, compared to unselected tab text). Please find a simple test case below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute test case with Java 5/6/7 and compare the screens.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The selected tab (red) should be raised 2 pixels.
ACTUAL -
The selected tab isn't raised.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test.synth;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import javax.swing.plaf.synth.SynthLookAndFeel;
public class SynthTabbedPaneTest extends JFrame
{
private static String synthXml = "<synth>" +
" <style id=\"all\">" +
" <font name=\"Dialog\" size=\"12\"/>" +
" </style>" +
" <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
" <style id=\"tabbedPaneTab\">" +
" <state>" +
" <color type=\"TEXT_FOREGROUND\" value=\"#800000\"/>" +
" </state>" +
" <state value=\"SELECTED\">" +
" <color type=\"TEXT_FOREGROUND\" value=\"#FF0000\"/>" +
" </state>" +
" </style>" +
" <bind style=\"tabbedPaneTab\" type=\"region\" key=\"TabbedPaneTab\"/>" +
"</synth>";
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable(){
public void run()
{
try
{
new SynthTabbedPaneTest();
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
public SynthTabbedPaneTest() throws Exception
{
InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(is, SynthTabbedPaneTest.class);
UIManager.setLookAndFeel(laf);
JTabbedPane tabPane = new JTabbedPane();
tabPane.addTab("Tab 1", new JLabel("Tab 1"));
tabPane.addTab("Tab 2", new JLabel("Tab 2"));
tabPane.addTab("Tab 3", new JLabel("Tab 3"));
add(tabPane);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(new Dimension(600, 300));
setLocationRelativeTo(null);
setVisible(true);
}
}
---------- END SOURCE ----------
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b121)
Java HotSpot(TM) Client VM (build 20.0-b03, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The text position for selected tabs is different to Java 5/6. On Java 5/6 the selected text is raised by default (2 pixels, compared to unselected tab text). Please find a simple test case below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute test case with Java 5/6/7 and compare the screens.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The selected tab (red) should be raised 2 pixels.
ACTUAL -
The selected tab isn't raised.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test.synth;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;
import javax.swing.plaf.synth.SynthLookAndFeel;
public class SynthTabbedPaneTest extends JFrame
{
private static String synthXml = "<synth>" +
" <style id=\"all\">" +
" <font name=\"Dialog\" size=\"12\"/>" +
" </style>" +
" <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
" <style id=\"tabbedPaneTab\">" +
" <state>" +
" <color type=\"TEXT_FOREGROUND\" value=\"#800000\"/>" +
" </state>" +
" <state value=\"SELECTED\">" +
" <color type=\"TEXT_FOREGROUND\" value=\"#FF0000\"/>" +
" </state>" +
" </style>" +
" <bind style=\"tabbedPaneTab\" type=\"region\" key=\"TabbedPaneTab\"/>" +
"</synth>";
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable(){
public void run()
{
try
{
new SynthTabbedPaneTest();
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
public SynthTabbedPaneTest() throws Exception
{
InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(is, SynthTabbedPaneTest.class);
UIManager.setLookAndFeel(laf);
JTabbedPane tabPane = new JTabbedPane();
tabPane.addTab("Tab 1", new JLabel("Tab 1"));
tabPane.addTab("Tab 2", new JLabel("Tab 2"));
tabPane.addTab("Tab 3", new JLabel("Tab 3"));
add(tabPane);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(new Dimension(600, 300));
setLocationRelativeTo(null);
setVisible(true);
}
}
---------- END SOURCE ----------
- backported by
-
JDK-2212242 Tab text position with Synth based LaF is different to Java 5/6
-
- Closed
-
- duplicates
-
JDK-7034621 Tab text position in JDK 7 with Synth based LaF is different to Java 5/6
-
- Closed
-
- relates to
-
JDK-5089821 The TabbedPane Border is cut at the bottom in GTK LAf unlike native.
-
- Closed
-