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

JToolBar.setOpaque(false) has no affect in XP Look and Feel on jdk1.5.0_08

    XMLWordPrintable

    Details

      Description

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

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

      A DESCRIPTION OF THE PROBLEM :
      On jdk1.5_08, when using WindowXP look and feel calling JToolBar.setOpaque(false) has no affect. This is a regression as it worked as expected in jdk1.5_07.

      This works as expected for all other look and feels I tested: Metal, Motif, and windows classic.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a JPanel and set it's background color so Color.Red
      2. Set the toolbar's opaque property to false - JToolBar.setOpaque(false)
      3. Place the JToolBar on JPanel


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Background of JPanel should show through the JToolBar background.
      ACTUAL -
      Background of JPanel does not show through the JToolBar background.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import javax.swing.*;

      public class ToolBarBugDemo
      {
      public static void main(String[] args) throws Exception
      {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      JFrame frame = new JFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(new Dimension(400, 300));
      frame.setLocationRelativeTo(null);

      JToolBar toolBar = new JToolBar();
      toolBar.setFloatable(false);
      toolBar.setOpaque(false);

      toolBar.add(new JButton("New"));
      toolBar.add(new JButton("Open"));
      toolBar.add(new JButton("Close"));

      frame.getContentPane().setBackground(Color.RED);
      frame.getContentPane().add(toolBar, BorderLayout.NORTH);

      frame.setVisible(true);
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      None that I know of. In my case my panels background image is a gradient that needs to show through the toolbar background.

      Release Regression From : 5.0u7
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: