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

Synth LnF doesn't use MOUSE_OVER or PRESSED state for Tabs

XMLWordPrintable

    • b48
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b32)
      Java HotSpot(TM) Client VM (build 1.6.0-ea-b32, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Setting alternate colours for BACKGROUND, FOREGROUND, TEXT_BACKGROUND, TEXT_FOREGROUND doesn't work for the MOUSE_OVER or PRESSED state of a "TabbedPaneTab". The correct colour seems to be used for the SELECTED state only.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Bind a style that has alternate colours for MOUSE_OVER or PRESSED states to "TabbedPaneTab" and see that they have no effect. whereas the SELECTED state in the same style definition does seem to use the TEXT_FOREGROUND colour to paint the tab text.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      MOUSE_OVER and PRESSED states should work for TabbedPaneTabs (e.g. the Windows XP LnF draws tabs differently for the mouse over state, this should be possible with Synth)
      ACTUAL -
      MOUSE_OVER and PRESSED states are ignored for TabbedPaneTab

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.ByteArrayInputStream;
      import java.io.FileInputStream;
      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 SynthTest
      {
      public static void main(String[] args)
      {
      try
      {
      InputStream ins = new ByteArrayInputStream(xml.getBytes("UTF8"));
      if(args.length > 0)
      ins = new FileInputStream(args[0]);
      assert ins != null;
      SynthLookAndFeel laf = new SynthLookAndFeel();
      laf.load(ins, SynthTest.class);
      UIManager.setLookAndFeel(laf);
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
      JFrame f = new JFrame("SynthTest");
      JTabbedPane tp = new JTabbedPane();
      tp.add(new JLabel("This is tab 1"),"Tab 1");
      tp.add(new JLabel("This is tab 2"),"Tab 2");
      tp.add(new JLabel("This is tab 3"),"Tab 3");
      f.setContentPane(tp);
      f.pack();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setVisible(true);
      }

      static String xml = "<synth>" +
      "<style id=\"tab\">" +
      " <font name=\"Verdana\" size=\"12\"/>" +
      " <state>" +
      " <color value=\"BLACK\" type=\"BACKGROUND\"/>" +
      " <color value=\"GREEN\" type=\"FOREGROUND\"/>" +
      " <color value=\"GRAY\" type=\"TEXT_BACKGROUND\"/>" +
      " <color value=\"BLUE\" type=\"TEXT_FOREGROUND\"/>" +
      " </state>" +
      " <state value=\"SELECTED\">" +
      " <color value=\"WHITE\" type=\"FOREGROUND\"/>" +
      " <color value=\"YELLOW\" type=\"TEXT_FOREGROUND\"/>" +
      " </state>" +
      " <state value=\"PRESSED\">" +
      " <color value=\"MAGENTA\" type=\"FOREGROUND\"/>" +
      " <color value=\"ORANGE\" type=\"TEXT_FOREGROUND\"/>" +
      " </state>" +
      " <state value=\"MOUSE_OVER\">" +
      " <color value=\"CYAN\" type=\"FOREGROUND\"/>" +
      " <color value=\"PINK\" type=\"TEXT_FOREGROUND\"/>" +
      " </state>" +
      " </style>" +
      " <bind style=\"tab\" type=\"REGION\" key=\"TabbedPaneTab\"/>" +
      "</synth>";
      }

      ---------- END SOURCE ----------
      ###@###.### 2005-04-20 20:43:38 GMT

            gromainsunw Guy Romain (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: