JDK-7034621 : Tab text position in JDK 7 with Synth based LaF is different to Java 5/6
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2011-04-07
  • Updated: 2012-03-20
  • Resolved: 2011-07-28
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.
JDK 8
8-poolResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b136)
Java HotSpot(TM) Client VM (build 21.0-b06, mixed mode, sharing)


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.



REGRESSION.  Last worked in version 6u24

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 by 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 ----------