Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7010561

Tab text position with Synth based LaF is different to Java 5/6

    Details

    • Subcomponent:
    • Introduced In Build:
      b10
    • Introduced In Version:
      7
    • Resolved In Build:
      b25
    • CPU:
      x86
    • OS:
      windows_7

      Backports

        Description

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

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rupashka Pavel Porvatov (Inactive)
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: