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

REGRESSION: JTabbedPane.setBackground() and setOpaque() have no effect

XMLWordPrintable

    • tiger
    • x86
    • windows_2000

      Name: gm110360 Date: 05/23/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-

      b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version

      5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      setBackground for JTabbedPane instances seems to have no effect.

      setOpaque( true ) also has no effect. Both of
      these routines worked

      correctly in Java 1.3.1 but now fail.


      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run code at bottom in Java 1.3.1
      2. Run code at bottom in Java 1.4
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expect that the JTabbedPane should be transparent when I perform

      setOpaque( false ).

      I think this has something to do with
      JTabbedPane
      now providing background across it's contentPanes, but
      the ability to
      make them transparent should be supported.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // Have a ball!
      import java.awt.*;
      import javax.swing.*;

      public class Main {
        public

      static void main( String argv[] ) {
          JFrame frame = new JFrame( "Background frame" );

          
      JPanel
      panel = new JPanel( new BorderLayout());
          panel.setBackground( Color.yellow );
          

      panel.setPreferredSize( new Dimension( 200, 200 ) );

          JButton opaqueButton = new
      JButton(
      "opaque button" );
          opaqueButton.setBackground( Color.white );
          

      opaqueButton.setOpaque( true );

          JButton transparentButton = new JButton(
      "transparent
      button" );
          transparentButton.setBackground( Color.white );
          

      transparentButton.setOpaque( false );

          JTabbedPane transparentTabbedPane = new

      JTabbedPane();
          transparentTabbedPane.setPreferredSize( new Dimension( 100, 100 ) );
          

      transparentTabbedPane.setBackground( Color.green );
          

      transparentTabbedPane.setOpaque( false );

          JTabbedPane opaqueTabbedPane = new

      JTabbedPane();
          opaqueTabbedPane.setPreferredSize( new Dimension( 100, 100 ) );
          

      opaqueTabbedPane.setBackground( Color.green );
          opaqueTabbedPane.setOpaque( true

      );

          panel.add( opaqueButton, "North" );
          panel.add( transparentButton, "South" );
          

      panel.add( transparentTabbedPane, "East" );
          panel.add( opaqueTabbedPane, "West" );
          

      frame.getContentPane().add( "Center", panel );
          frame.pack();
          frame.show();
        
      }
      }

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

      CUSTOMER WORKAROUND :
      No obvious workarounds

      Release Regression From : 1.3.1_03
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 145189)
      ======================================================================

            moasunw Moa Moa (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: