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

The fix for 4886944 touches only L&f's distributed with JDK.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs

      Description

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


      ADDITIONAL OS VERSION INFORMATION :
      Linux blade 2.6.10-02 #2 Mon Dec 27 17:35:40 CET 2004 i686 Mobile Intel(R) Pentium(R) 4 - M CPU 1.90GHz GenuineIntel GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      The fix for 4886944 touches only L&f's distributed with JDK. But there are a lot of L&f's
      which still use rollover borders with UIResource. See also following thread:
      http://www.javadesktop.org/forums/thread.jspa?threadID=8465&tstart=0
      A better fix for 4886944 would be to change SwingUtilities#updateComponentTreeUI
      as described by Karsten.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the sample program. Click on the "goodies" button to change L&f to JGoodies Plastic3D.
      You will need JGoodies Looks from http://looks.dev.java.net to run this program.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect to get a toolbar with a rollover button.
      ACTUAL -
      I get a toolbar with a static border drawn around the toolbar button.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
       
      import javax.swing.*;
      import java.awt.event.*;
      import java.awt.*;
      /**
       * You will need JGoodies Looks from http://looks.dev.java.net to run this code.
       */
      public class ToolBarTest extends JFrame
      {
          public ToolBarTest()
          {
              super();
       
              JToolBar tb = new JToolBar();
              tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
              tb.setFloatable(false);
       
              final JFrame thisFrame = this;
       
              JButton ocean = new JButton("ocean");
              ocean.addActionListener(new ActionListener()
              {
                  public void actionPerformed(ActionEvent e)
                  {
                      try
                      {
                          UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
                      }
                      catch (Exception e1) { }
       
                      SwingUtilities.updateComponentTreeUI(thisFrame);
                  }
              });
       
              JButton windows = new JButton("windows");
              windows.addActionListener(new ActionListener()
              {
                  public void actionPerformed(ActionEvent e)
                  {
                      // Use the Windows Look and Feel
                      try
                      {
                          UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                      }
                      catch (Exception e1) { }
       
                      SwingUtilities.updateComponentTreeUI(thisFrame);
                  }
              });
       
              JButton goodies = new JButton("goodies");
              goodies.addActionListener(new ActionListener()
              {
                  public void actionPerformed(ActionEvent e)
                  {
                      try
                      {
                         UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
                      }
                      catch (Exception e1) {}
       
       
                      SwingUtilities.updateComponentTreeUI(thisFrame);
                  }
              });
       
              tb.add(ocean);
              tb.add(windows);
              tb.add(goodies);
       
              getContentPane().add(tb);
          }
       
          public static void main(String[] args)
          {
       
      // try
      // {
      // UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
      // }
      // catch (Exception e1) {}
       
              JFrame test = new ToolBarTest();
       
              test.pack();
              test.setSize(new Dimension(200, 200));
              test.setVisible(true);
       
              test.addWindowListener(new WindowAdapter()
              {
                  public void windowClosing(WindowEvent e)
                  {
                      System.exit(0);
                  }
              });
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use Swing Suite from JGoodies Karsten Lentzsch.
      Karsten provides a modified version that updates toolbar childrens
      before the toolbar is updated. For those who have access
      to the Swing Suite, see ComponentTreeUtils#updateComponentTreeUI.
      ###@###.### 2005-2-21 10:36:37 GMT

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: