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

Transparent JDesktopPane impossible because isOpaque() returns true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • client-libs
    • beta
    • x86
    • linux



      Name: gm110360 Date: 06/22/2004


      FULL PRODUCT VERSION :
      ...> java -version
      java version "1.5.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b55)
      Java HotSpot(TM) Server VM (build 1.5.0-beta3-b55, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      ...> uname -a
      Linux riedquat 2.4.20-64GB-SMP #1 SMP Fri Apr 2 19:10:22 UTC 2004 i686 unknown unknown GNU/Linux
      You have new mail in /var/spool/mail/chris


      A DESCRIPTION OF THE PROBLEM :
      JDesktopPane currently has an implementation of isOpaque() which always returns true.

      I have written a subclass of JDesktopPane which does nothing more than just return false for isOpaque(). That subclass can be used without any problems. That subclass allows the usage of JDesktopPane e.g. as layer in a LayeredPane, e.g. in computer games for moving around palette and statistics windows over the game field.

      This means that it is totally superfluous to override isOpaque() in JDesktopPane and make it always opaque. Transparent JDesktopPanes are possible and nice.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      a) Without patch:
      Use the following class:
      package com.itcqis.swing;
      import javax.swing.JDesktopPane;

      public class TransparentDesktop extends JDesktopPane {
          public boolean isOpaque() {
              return false;
          }
      }


      b) With a patch:
      1. Apply the following patch
      2. Compile the patched source
      3. Put the patched source in a Jar
      4. Put that jar in jre/lib/endorsed/
      *** JDesktopPane.java 2004-06-20 22:13:21.000000000 +0200
      --- /dist/opt/sun/j2sdk/se/latest/src/javax/swing/JDesktopPane.java 2004-06-09 09:25:21.000000000 +0200
      ***************
      *** 308,313 ****
      --- 308,327 ----
                return results;
            }

      +
      + /**
      + * Returns true to indicate that this component paints every pixel
      + * in its range. (In other words, it does not have a transparent
      + * background or foreground.)
      + *
      + * @return true
      + * @see JComponent#isOpaque
      + */
      + public boolean isOpaque() {
      + return true;
      + }
      +
      +
            /**
             * See readObject() and writeObject() in JComponent for more
             * information about serialization in Swing.
      (Incident Review ID: 280758)
      ======================================================================

            mbronsonsunw Mike Bronson (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: