changeset 1214:48df681dc50a

Merge
author yan
date Tue, 28 Apr 2009 13:30:42 -0700
parents 7859c68fed2b 9cb0aecf54bd
children 4b922e8fef3b
files test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java
diffstat 33 files changed, 1885 insertions(+), 1439 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/Component.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/java/awt/Component.java	Tue Apr 28 13:30:42 2009 -0700
@@ -6666,7 +6666,7 @@
 
 
             // Update stacking order
-            peer.setZOrder(getHWPeerAboveMe());
+            updateZOrder();
 
             if (!isAddNotifyComplete) {
                 mixOnShowing();
@@ -9838,4 +9838,11 @@
 
         return doesClassImplement(obj.getClass(), interfaceName);
     }
+
+    // Note that the method is overriden in the Window class,
+    // a window doesn't need to be updated in the Z-order.
+    void updateZOrder() {
+        peer.setZOrder(getHWPeerAboveMe());
+    }
+
 }
--- a/src/share/classes/java/awt/Container.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/java/awt/Container.java	Tue Apr 28 13:30:42 2009 -0700
@@ -840,7 +840,7 @@
                     // Native container changed - need to reparent native widgets
                     newNativeContainer.reparentChild(comp);
                 }
-                comp.peer.setZOrder(comp.getHWPeerAboveMe());
+                comp.updateZOrder();
 
                 if (!comp.isLightweight() && isLightweight()) {
                     // If component is heavyweight and one of the containers is lightweight
@@ -3977,10 +3977,8 @@
             Component comp = getComponent(index);
             if (!comp.isLightweight()) {
                 comp.applyCurrentShape();
-                if (comp instanceof Container && ((Container)comp).getLayout() == null) {
-                    ((Container)comp).recursiveApplyCurrentShape();
-                }
-            } else if (comp instanceof Container &&
+            }
+            if (comp instanceof Container &&
                     ((Container)comp).hasHeavyweightDescendants()) {
                 ((Container)comp).recursiveApplyCurrentShape();
             }
--- a/src/share/classes/java/awt/GraphicsConfiguration.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/java/awt/GraphicsConfiguration.java	Tue Apr 28 13:30:42 2009 -0700
@@ -440,13 +440,14 @@
      * the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
      * PERPIXEL_TRANSLUCENT} kind of translucency.
      *
-     * @param gc GraphicsConfiguration
-     * @throws NullPointerException if the gc argument is null
      * @return whether the given GraphicsConfiguration supports
      *         the translucency effects.
+     *
      * @see Window#setBackground(Color)
+     *
+     * @since 1.7
      */
-    /*public */boolean isTranslucencyCapable() {
+    public boolean isTranslucencyCapable() {
         // Overridden in subclasses
         return false;
     }
--- a/src/share/classes/java/awt/GraphicsDevice.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/java/awt/GraphicsDevice.java	Tue Apr 28 13:30:42 2009 -0700
@@ -112,10 +112,14 @@
      */
     public final static int TYPE_IMAGE_BUFFER           = 2;
 
-    /** Kinds of translucency supported by the underlying system.
-     *  @see #isTranslucencySupported
+    /**
+     * Kinds of translucency supported by the underlying system.
+     *
+     * @see #isWindowTranslucencySupported
+     *
+     * @since 1.7
      */
-    /*public */static enum WindowTranslucency {
+    public static enum WindowTranslucency {
         /**
          * Represents support in the underlying system for windows each pixel
          * of which is guaranteed to be either completely opaque, with
@@ -246,38 +250,44 @@
      * full-screen window is not visible, this method will make it visible.
      * It will remain visible when returning to windowed mode.
      * <p>
-     * When returning to windowed mode from an exclusive full-screen window, any
-     * display changes made by calling <code>setDisplayMode</code> are
+     * When entering full-screen mode, all the translucency effects are reset for
+     * the window. Its shape is set to {@code null}, the opacity value is set to
+     * 1.0f, and the background color alpha is set to 255 (completely opaque).
+     * These values are not restored when returning to windowed mode.
+     * <p>
+     * When returning to windowed mode from an exclusive full-screen window,
+     * any display changes made by calling {@code setDisplayMode} are
      * automatically restored to their original state.
      *
-     * @param w a window to use as the full-screen window; <code>null</code>
+     * @param w a window to use as the full-screen window; {@code null}
      * if returning to windowed mode.  Some platforms expect the
      * fullscreen window to be a top-level component (i.e., a Frame);
      * therefore it is preferable to use a Frame here rather than a
      * Window.
+     *
      * @see #isFullScreenSupported
      * @see #getFullScreenWindow
      * @see #setDisplayMode
      * @see Component#enableInputMethods
      * @see Component#setVisible
+     *
      * @since 1.4
      */
     public void setFullScreenWindow(Window w) {
         if (w != null) {
-            //XXX: The actions should be documented in some non-update release.
-            /*
             if (w.getShape() != null) {
-                w.setShape(w, null);
-            }
-            if (!w.isOpaque()) {
-                w.setOpaque(false);
+                w.setShape(null);
             }
             if (w.getOpacity() < 1.0f) {
                 w.setOpacity(1.0f);
             }
-            */
+            Color bgColor = w.getBackground();
+            if (bgColor.getAlpha() < 255) {
+                bgColor = new Color(bgColor.getRed(), bgColor.getGreen(),
+                                    bgColor.getBlue(), 255);
+                w.setBackground(bgColor);
+            }
         }
-
         if (fullScreenWindow != null && windowedModeBounds != null) {
             // if the window went into fs mode before it was realized it may
             // have (0,0) dimensions
@@ -469,13 +479,15 @@
     }
 
     /**
-     * Returns whether the given level of translucency is supported
+     * Returns whether the given level of translucency is supported by
      * this graphics device.
      *
      * @param translucencyKind a kind of translucency support
      * @return whether the given translucency kind is supported
+     *
+     * @since 1.7
      */
-    /*public */boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
+    public boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
         switch (translucencyKind) {
             case PERPIXEL_TRANSPARENT:
                 return isWindowShapingSupported();
--- a/src/share/classes/java/awt/Window.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/java/awt/Window.java	Tue Apr 28 13:30:42 2009 -0700
@@ -25,6 +25,7 @@
 package java.awt;
 
 import java.awt.event.*;
+import java.awt.geom.Path2D;
 import java.awt.geom.Point2D;
 import java.awt.im.InputContext;
 import java.awt.image.BufferStrategy;
@@ -297,6 +298,7 @@
     /*
      * Opacity level of the window
      *
+     * @serial
      * @see #setOpacity(float)
      * @see #getOpacity()
      * @since 1.7
@@ -307,6 +309,7 @@
      * The shape assigned to this window. This field is set to null if
      * no shape is set (rectangular window).
      *
+     * @serial
      * @see #getShape()
      * @see #setShape(Shape)
      * @since 1.7
@@ -3340,32 +3343,78 @@
     // ******************** SHAPES & TRANSPARENCY CODE ********************
 
     /**
-     * JavaDoc
+     * Returns the opacity of the window.
+     *
+     * @return the opacity of the window
+     *
+     * @see Window#setOpacity
+     * @see GraphicsDevice.WindowTranslucency
+     *
+     * @since 1.7
      */
-    /*public */float getOpacity() {
+    public float getOpacity() {
         synchronized (getTreeLock()) {
             return opacity;
         }
     }
 
     /**
-     * JavaDoc
+     * Sets the opacity of the window.
+     * <p>
+     * The opacity value is in the range [0..1]. Note that setting the opacity
+     * level of 0 may or may not disable the mouse event handling on this
+     * window. This is a platform-dependent behavior.
+     * <p>
+     * In order for this method to enable the translucency effect, the {@link
+     * GraphicsDevice#isWindowTranslucencySupported()} method must indicate that
+     * the {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
+     * translucency is supported.
+     * <p>
+     * Also note that the window must not be in the full-screen mode when
+     * setting the opacity value &lt; 1.0f. Otherwise the {@code
+     * IllegalComponentStateException} is thrown.
+     * <p>
+     * The translucency levels of individual pixels may also be effected by the
+     * alpha component of their color (see {@link setBackground()}) and the
+     * current shape of this window (see {@link setShape()}).
+     *
+     * @param opacity the opacity level to set to the window
+     *
+     * @throws IllegalArgumentException if the opacity is out of the range
+     *     [0..1]
+     * @throws IllegalComponentStateException if the window is in full screen
+     *     mode, and the opacity is less than 1.0f
+     * @throws UnsupportedOperationException if the {@code
+     *     GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
+     *     translucency kind is not supported and the opacity is less than 1.0f
+     *
+     * @see Window#getOpacity
+     * @see Window#setBackground()
+     * @see Window#setShape()
+     * @see GraphicsDevice.WindowTranslucency
+     * @see GraphicsDevice#isWindowTranslucencySupported()
+     *
+     * @since 1.7
      */
-    /*public */void setOpacity(float opacity) {
+    public void setOpacity(float opacity) {
         synchronized (getTreeLock()) {
             if (opacity < 0.0f || opacity > 1.0f) {
                 throw new IllegalArgumentException(
                     "The value of opacity should be in the range [0.0f .. 1.0f].");
             }
-            GraphicsConfiguration gc = getGraphicsConfiguration();
-            GraphicsDevice gd = gc.getDevice();
-            if (!gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
-                throw new UnsupportedOperationException(
+            if (opacity < 1.0f) {
+                GraphicsConfiguration gc = getGraphicsConfiguration();
+                GraphicsDevice gd = gc.getDevice();
+                if (gc.getDevice().getFullScreenWindow() == this) {
+                    throw new IllegalComponentStateException(
+                        "Setting opacity for full-screen window is not supported.");
+                }
+                if (!gd.isWindowTranslucencySupported(
+                    GraphicsDevice.WindowTranslucency.TRANSLUCENT))
+                {
+                    throw new UnsupportedOperationException(
                         "TRANSLUCENT translucency is not supported.");
-            }
-            if ((gc.getDevice().getFullScreenWindow() == this) && (opacity < 1.0f)) {
-                throw new IllegalArgumentException(
-                    "Setting opacity for full-screen window is not supported.");
+                }
             }
             this.opacity = opacity;
             WindowPeer peer = (WindowPeer)getPeer();
@@ -3376,37 +3425,86 @@
     }
 
     /**
-     * JavaDoc
+     * Returns the shape of the window.
+     *
+     * The value returned by this method may not be the same as
+     * previously set with {@code setShape(shape)}, but it is guaranteed
+     * to represent the same shape.
+     *
+     * @return the shape of the window or {@code null} if no
+     *     shape is specified for the window
+     *
+     * @see Window#setShape
+     * @see GraphicsDevice.WindowTranslucency
+     *
+     * @since 1.7
      */
-    /*public */Shape getShape() {
+    public Shape getShape() {
         synchronized (getTreeLock()) {
-            return shape;
+            return shape == null ? null : new Path2D.Float(shape);
         }
     }
 
     /**
-     * JavaDoc
+     * Sets the shape of the window.
+     * <p>
+     * Setting a shape enables cutting off some parts of the window, leaving
+     * visible and clickable only those parts belonging to the given shape
+     * (see {@link Shape}). If the shape argument is null, this methods
+     * restores the default shape (making the window rectangular on most
+     * platforms.)
+     * <p>
+     * The following conditions must be met in order to set a non-null shape:
+     * <ul>
+     * <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT
+     * PERPIXEL_TRANSPARENT} translucency kind must be supported by the
+     * underlying system (see {@link })
+     * <i>and</i>
+     * <li>The window must not be in the full-screen mode (see
+     * {@link GraphicsDevice#setFullScreenWindow()})
+     * </ul>
+     * If a certain condition is not met, either the {@code
+     * UnsupportedOperationException} or {@code IllegalComponentStateException}
+     * is thrown.
+     * <p>
+     * The tranlucency levels of individual pixels may also be effected by the
+     * alpha component of their color (see {@link setBackground()}) and the
+     * opacity value (see {@link setOpacity()}). See {@link
+     * GraphicsDevice#WindowTranslucency} for more details.
      *
-     * @param window the window to set the shape to
      * @param shape the shape to set to the window
-     * @throws IllegalArgumentException if the window is in full screen mode,
-     *                                  and the shape is not null
+     *
+     * @throws IllegalComponentStateException if the shape is not {@code
+     *     null} and the window is in full-screen mode
+     * @throws UnsupportedOperationException if the shape is not {@code
+     *     null} and {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT
+     *     PERPIXEL_TRANSPARENT} translucency is not supported
+     *
+     * @see Window#getShape()
+     * @see Window#setBackgound()
+     * @see Window#setOpacity()
+     * @see GraphicsDevice.WindowTranslucency
+     * @see GraphicsDevice#isWindowTranslucencySupported()
+     *
+     * @since 1.7
      */
-    /*public */void setShape(Shape shape) {
+    public void setShape(Shape shape) {
         synchronized (getTreeLock()) {
-            GraphicsConfiguration gc = getGraphicsConfiguration();
-            GraphicsDevice gd = gc.getDevice();
-            if (!gd.isWindowTranslucencySupported(
-                    GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
-            {
-                throw new UnsupportedOperationException(
+            if (shape != null) {
+                GraphicsConfiguration gc = getGraphicsConfiguration();
+                GraphicsDevice gd = gc.getDevice();
+                if (gc.getDevice().getFullScreenWindow() == this) {
+                    throw new IllegalComponentStateException(
+                        "Setting shape for full-screen window is not supported.");
+                }
+                if (!gd.isWindowTranslucencySupported(
+                        GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+                {
+                    throw new UnsupportedOperationException(
                         "PERPIXEL_TRANSPARENT translucency is not supported.");
+                }
             }
-            if ((gc.getDevice().getFullScreenWindow() == this) && (shape != null)) {
-                throw new IllegalArgumentException(
-                    "Setting shape for full-screen window is not supported.");
-            }
-            this.shape = shape;
+            this.shape = (shape == null) ? null : new Path2D.Float(shape);
             WindowPeer peer = (WindowPeer)getPeer();
             if (peer != null) {
                 peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
@@ -3415,66 +3513,115 @@
     }
 
     /**
-     * JavaDoc
+     * Gets the background color of this window.
+     * <p>
+     * Note that the alpha component of the returned color indicates whether
+     * the window is in the non-opaque (per-pixel translucent) mode.
+     *
+     * @return this component's background color
+     *
+     * @see Window#setBackground
+     * @see GraphicsDevice.WindowTranslucency
      */
-/*
+    @Override
+    public Color getBackground() {
+        return super.getBackground();
+    }
+
+    /**
+     * Sets the background color of this window.
+     * <p>
+     * If the windowing system supports the {@link
+     * GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}
+     * tranclucency, the alpha component of the given background color
+     * may effect the mode of operation for this window: it indicates whether
+     * this window must be opaque (alpha == 1.0f) or per-pixel translucent
+     * (alpha &lt; 1.0f).  All the following conditions must be met in order
+     * to be able to enable the per-pixel transparency mode for this window:
+     * <ul>
+     * <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
+     * PERPIXEL_TRANSLUCENT} translucency must be supported
+     * by the graphics device where this window is located <i>and</i>
+     * <li>The window must not be in the full-screen mode (see {@link
+     * GraphicsDevice#setFullScreenWindow()})
+     * </ul>
+     * If a certain condition is not met at the time of calling this method,
+     * the alpha component of the given background color will not effect the
+     * mode of operation for this window.
+     * <p>
+     * When the window is per-pixel translucent, the drawing sub-system
+     * respects the alpha value of each individual pixel. If a pixel gets
+     * painted with the alpha color component equal to zero, it becomes
+     * visually transparent, if the alpha of the pixel is equal to 1.0f, the
+     * pixel is fully opaque. Interim values of the alpha color component make
+     * the pixel semi-transparent. In this mode the background of the window
+     * gets painted with the alpha value of the given background color (meaning
+     * that it is not painted at all if the alpha value of the argument of this
+     * method is equal to zero.)
+     * <p>
+     * The actual level of translucency of a given pixel also depends on window
+     * opacity (see {@link setOpacity()}), as well as the current shape of
+     * this window (see {@link setShape()}).
+     * <p>
+     * Note that painting a pixel with the alpha value of 0 may or may not
+     * disable the mouse event handling on this pixel. This is a
+     * platform-dependent behavior. To make sure the mouse clicks do not get
+     * dispatched to a particular pixel, the pixel must be excluded from the
+     * shape of the window.
+     * <p>
+     * Enabling the per-pixel translucency mode may change the graphics
+     * configuration of this window due to the native platform requirements.
+     *
+     * @param bgColor the color to become this window's background color.
+     *
+     * @throws IllegalComponentStateException if the alpha value of the given
+     *     background color is less than 1.0f and the window is in
+     *     full-screen mode
+     * @throws UnsupportedOperationException if the alpha value of the given
+     *     background color is less than 1.0f and
+     *     {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
+     *     PERPIXEL_TRANSLUCENT} translucency is not supported
+     *
+     * @see Window#getBackground
+     * @see Window#setOpacity()
+     * @see Window#setShape()
+     * @see GraphicsDevice.WindowTranslucency
+     * @see GraphicsDevice#isWindowTranslucencySupported()
+     * @see GraphicsConfiguration#isTranslucencyCapable()
+     */
     @Override
     public void setBackground(Color bgColor) {
+        Color oldBg = getBackground();
+        if (oldBg != null && oldBg.equals(bgColor)) {
+            return;
+        }
+        super.setBackground(bgColor);
+        int oldAlpha = oldBg != null ? oldBg.getAlpha() : 255;
         int alpha = bgColor.getAlpha();
-        if (alpha < 255) { // non-opaque window
+        if ((oldAlpha == 255) && (alpha < 255)) { // non-opaque window
             GraphicsConfiguration gc = getGraphicsConfiguration();
             GraphicsDevice gd = gc.getDevice();
             if (gc.getDevice().getFullScreenWindow() == this) {
-                throw new IllegalArgumentException(
+                throw new IllegalComponentStateException(
                     "Making full-screen window non opaque is not supported.");
             }
             if (!gc.isTranslucencyCapable()) {
                 GraphicsConfiguration capableGC = gd.getTranslucencyCapableGC();
                 if (capableGC == null) {
-                    throw new IllegalArgumentException(
+                    throw new UnsupportedOperationException(
                         "PERPIXEL_TRANSLUCENT translucency is not supported");
                 }
-                // TODO: change GC
+                setGraphicsConfiguration(capableGC);
             }
             setLayersOpaque(this, false);
+        } else if ((oldAlpha < 255) && (alpha == 255)) {
+            setLayersOpaque(this, true);
         }
-
-        super.setBackground(bgColor);
-
         WindowPeer peer = (WindowPeer)getPeer();
         if (peer != null) {
             peer.setOpaque(alpha == 255);
         }
     }
-*/
-
-    private transient boolean opaque = true;
-
-    void setOpaque(boolean opaque) {
-        synchronized (getTreeLock()) {
-            GraphicsConfiguration gc = getGraphicsConfiguration();
-            if (!opaque && !com.sun.awt.AWTUtilities.isTranslucencyCapable(gc)) {
-            throw new IllegalArgumentException(
-                    "The window must use a translucency-compatible graphics configuration");
-            }
-            if (!com.sun.awt.AWTUtilities.isTranslucencySupported(
-                    com.sun.awt.AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT))
-            {
-                throw new UnsupportedOperationException(
-                        "PERPIXEL_TRANSLUCENT translucency is not supported.");
-            }
-            if ((gc.getDevice().getFullScreenWindow() == this) && !opaque) {
-                throw new IllegalArgumentException(
-                    "Making full-screen window non opaque is not supported.");
-            }
-            setLayersOpaque(this, opaque);
-            this.opaque = opaque;
-            WindowPeer peer = (WindowPeer)getPeer();
-            if (peer != null) {
-                peer.setOpaque(opaque);
-            }
-        }
-    }
 
     private void updateWindow(BufferedImage backBuffer) {
         synchronized (getTreeLock()) {
@@ -3505,10 +3652,10 @@
             }
             lp.setOpaque(isOpaque);
             root.setOpaque(isOpaque);
-            root.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
+            root.setDoubleBuffered(isOpaque);
             if (content != null) {
                 content.setOpaque(isOpaque);
-                content.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
+                content.setDoubleBuffered(isOpaque);
 
                 // Iterate down one level to see whether we have a JApplet
                 // (which is also a RootPaneContainer) which requires processing
@@ -3523,36 +3670,6 @@
                 }
             }
         }
-
-        Color bg = component.getBackground();
-        boolean hasTransparentBg = TRANSPARENT_BACKGROUND_COLOR.equals(bg);
-
-        Container container = null;
-        if (component instanceof Container) {
-            container = (Container) component;
-        }
-
-        if (isOpaque) {
-            if (hasTransparentBg) {
-                // Note: we use the SystemColor.window color as the default.
-                // This color is used in the WindowPeer implementations to
-                // initialize the background color of the window if it is null.
-                // (This might not be the right thing to do for other
-                // RootPaneContainers we might be invoked with)
-                Color newColor = null;
-                if (container != null && container.preserveBackgroundColor != null) {
-                    newColor = container.preserveBackgroundColor;
-                } else {
-                    newColor = SystemColor.window;
-                }
-                component.setBackground(newColor);
-            }
-        } else {
-            if (!hasTransparentBg && container != null) {
-                container.preserveBackgroundColor = bg;
-            }
-            component.setBackground(TRANSPARENT_BACKGROUND_COLOR);
-        }
     }
 
 
@@ -3620,20 +3737,16 @@
                 window.setShape(shape);
             }
             public boolean isOpaque(Window window) {
-                /*
-                return window.getBackground().getAlpha() < 255;
-                */
-                synchronized (window.getTreeLock()) {
-                    return window.opaque;
-                }
+                Color bg = window.getBackground();
+                return (bg != null) ? bg.getAlpha() == 255 : true;
             }
             public void setOpaque(Window window, boolean opaque) {
-                /*
                 Color bg = window.getBackground();
+                if (bg == null) {
+                    bg = new Color(0, 0, 0, 0);
+                }
                 window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
                                                opaque ? 255 : 0));
-                */
-                window.setOpaque(opaque);
             }
             public void updateWindow(Window window, BufferedImage backBuffer) {
                 window.updateWindow(backBuffer);
@@ -3674,6 +3787,10 @@
         }); // WindowAccessor
     } // static
 
+    // a window doesn't need to be updated in the Z-order.
+    @Override
+    void updateZOrder() {}
+
 } // class Window
 
 
--- a/src/share/classes/sun/applet/AppletPanel.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/sun/applet/AppletPanel.java	Tue Apr 28 13:30:42 2009 -0700
@@ -45,7 +45,6 @@
 import java.util.Collections;
 import java.util.Locale;
 import java.util.WeakHashMap;
-import javax.swing.SwingUtilities;
 import sun.awt.AppContext;
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
@@ -450,7 +449,7 @@
                       try {
                           final AppletPanel p = this;
 
-                          SwingUtilities.invokeAndWait(new Runnable() {
+                          EventQueue.invokeAndWait(new Runnable() {
                                   public void run() {
                                       p.validate();
                                   }
@@ -480,7 +479,7 @@
                           final AppletPanel p = this;
                           final Applet a = applet;
 
-                          SwingUtilities.invokeAndWait(new Runnable() {
+                          EventQueue.invokeAndWait(new Runnable() {
                                   public void run() {
                                       p.validate();
                                       a.setVisible(true);
@@ -514,7 +513,7 @@
                     try {
                         final Applet a = applet;
 
-                        SwingUtilities.invokeAndWait(new Runnable() {
+                        EventQueue.invokeAndWait(new Runnable() {
                                 public void run()
                                 {
                                     a.setVisible(false);
--- a/src/share/classes/sun/awt/EmbeddedFrame.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/sun/awt/EmbeddedFrame.java	Tue Apr 28 13:30:42 2009 -0700
@@ -588,9 +588,11 @@
 
         public void setOpacity(float opacity) {
         }
+
         public void setOpaque(boolean isOpaque) {
         }
-        public void updateWindow(BufferedImage backBuffer) {
+
+        public void updateWindow(BufferedImage bi) {
         }
         public void repositionSecurityWarning() {
         }
--- a/src/share/classes/sun/awt/SunToolkit.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/sun/awt/SunToolkit.java	Tue Apr 28 13:30:42 2009 -0700
@@ -2038,37 +2038,34 @@
     /**
      * Returns whether or not a containing top level window for the passed
      * component is
-     * {@link com.sun.awt.AWTUtilities.Translucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}.
+     * {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}.
      *
      * @param c a Component which toplevel's to check
      * @return {@code true}  if the passed component is not null and has a
      * containing toplevel window which is opaque (so per-pixel translucency
      * is not enabled), {@code false} otherwise
-     * @see com.sun.awt.AWTUtilities.Translucency#PERPIXEL_TRANSLUCENT
-     * @see com.sun.awt.AWTUtilities#isWindowOpaque(Window)
+     * @see GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
      */
     public static boolean isContainingTopLevelOpaque(Component c) {
         Window w = getContainingWindow(c);
-        // return w != null && (w).isOpaque();
-        return w != null && com.sun.awt.AWTUtilities.isWindowOpaque(w);
+        return w != null && ((Window)w).getBackground() != null &&
+            ((Window)w).getBackground().getAlpha() == 255;
     }
 
     /**
      * Returns whether or not a containing top level window for the passed
      * component is
-     * {@link com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT TRANSLUCENT}.
+     * {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}.
      *
      * @param c a Component which toplevel's to check
      * @return {@code true} if the passed component is not null and has a
      * containing toplevel window which has opacity less than
      * 1.0f (which means that it is translucent), {@code false} otherwise
-     * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
-     * @see com.sun.awt.AWTUtilities#getWindowOpacity(Window)
+     * @see GraphicsDevice.WindowTranslucency#TRANSLUCENT
      */
     public static boolean isContainingTopLevelTranslucent(Component c) {
         Window w = getContainingWindow(c);
-        // return w != null && (w).getOpacity() < 1.0f;
-        return w != null && com.sun.awt.AWTUtilities.getWindowOpacity((Window)w) < 1.0f;
+        return w != null && ((Window)w).getOpacity() < 1.0f;
     }
 
     /**
--- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -65,10 +65,13 @@
 
 import java.rmi.MarshalledObject;
 
+import java.security.AccessControlContext;
+import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -111,6 +114,8 @@
 import sun.awt.image.ImageRepresentation;
 import sun.awt.image.ToolkitImage;
 
+import java.io.FilePermission;
+
 
 /**
  * Provides a set of functions to be shared among the DataFlavor class and
@@ -1177,8 +1182,10 @@
             (String.class.equals(flavor.getRepresentationClass()) &&
              isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
 
+            String str = removeSuspectedData(flavor, contents, (String)obj);
+
             return translateTransferableString(
-                (String)obj,
+                str,
                 format);
 
         // Source data is a Reader. Convert to a String and recur. In the
@@ -1286,6 +1293,11 @@
                 throw new IOException("data translation failed");
             }
             final List list = (List)obj;
+
+            final ArrayList fileList = new ArrayList();
+
+            final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
+
             int nFiles = 0;
             for (int i = 0; i < list.size(); i++) {
                 Object o = list.get(i);
@@ -1293,17 +1305,18 @@
                     nFiles++;
                 }
             }
-            final String[] files = new String[nFiles];
 
             try {
                 AccessController.doPrivileged(new PrivilegedExceptionAction() {
                     public Object run() throws IOException {
-                        for (int i = 0, j = 0; i < list.size(); i++) {
-                            Object o = list.get(i);
-                            if (o instanceof File) {
-                                files[j++] = ((File)o).getCanonicalPath();
-                            } else if (o instanceof String) {
-                                files[j++] = (String)o;
+                        for (Object fileObject : list)
+                        {
+                            File file = castToFile(fileObject);
+                            if (null == System.getSecurityManager() ||
+                                !(isFileInWebstartedCache(file) ||
+                                isForbiddenToRead(file, userProtectionDomain)))
+                            {
+                                fileList.add(file.getCanonicalPath());
                             }
                         }
                         return null;
@@ -1313,10 +1326,11 @@
                 throw new IOException(pae.getMessage());
             }
 
-            for (int i = 0; i < files.length; i++) {
-                 byte[] bytes = files[i].getBytes();
-                 if (i != 0) bos.write(0);
-                 bos.write(bytes, 0, bytes.length);
+            for (int i = 0; i < fileList.size(); i++)
+            {
+                byte[] bytes = ((String)fileList.get(i)).getBytes();
+                if (i != 0) bos.write(0);
+                bos.write(bytes, 0, bytes.length);
             }
 
         // Source data is an InputStream. For arbitrary flavors, just grab the
@@ -1366,6 +1380,123 @@
         return ret;
     }
 
+    private String removeSuspectedData(DataFlavor flavor, final Transferable contents, final String str)
+            throws IOException
+    {
+        if (null == System.getSecurityManager()
+            || !flavor.isMimeTypeEqual("text/uri-list"))
+        {
+            return str;
+        }
+
+
+        String ret_val = "";
+        final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
+
+        try {
+            ret_val = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                    public Object run() {
+
+                        StringBuffer allowedFiles = new StringBuffer(str.length());
+                        String [] uriArray = str.split("(\\s)+");
+
+                        for (String fileName : uriArray)
+                        {
+                            File file = new File(fileName);
+                            if (file.exists() &&
+                                !(isFileInWebstartedCache(file) ||
+                                isForbiddenToRead(file, userProtectionDomain)))
+                            {
+
+                                if (0 != allowedFiles.length())
+                                {
+                                    allowedFiles.append("\\r\\n");
+                                }
+
+                                allowedFiles.append(fileName);
+                            }
+                        }
+
+                        return allowedFiles.toString();
+                    }
+                });
+        } catch (PrivilegedActionException pae) {
+            throw new IOException(pae.getMessage(), pae);
+        }
+
+        return ret_val;
+    }
+
+    private static ProtectionDomain getUserProtectionDomain(Transferable contents) {
+        return contents.getClass().getProtectionDomain();
+    }
+
+    private boolean isForbiddenToRead (File file, ProtectionDomain protectionDomain)
+    {
+        if (null == protectionDomain) {
+            return false;
+        }
+        try {
+            FilePermission filePermission =
+                    new FilePermission(file.getCanonicalPath(), "read, delete");
+            if (protectionDomain.implies(filePermission)) {
+                return false;
+            }
+        } catch (IOException e) {}
+
+        return true;
+    }
+
+    // It is important do not use user's successors
+    // of File class.
+    private File castToFile(Object fileObject) throws IOException {
+        String filePath = null;
+        if (fileObject instanceof File) {
+            filePath = ((File)fileObject).getCanonicalPath();
+        } else if (fileObject instanceof String) {
+           filePath = (String) fileObject;
+        }
+        return new File(filePath);
+    }
+
+    private final static String[] DEPLOYMENT_CACHE_PROPERTIES = {
+        "deployment.system.cachedir",
+        "deployment.user.cachedir",
+        "deployment.javaws.cachedir",
+        "deployment.javapi.cachedir"
+    };
+
+    private final static ArrayList <File> deploymentCacheDirectoryList =
+            new ArrayList<File>();
+
+    private static boolean isFileInWebstartedCache(File f) {
+
+        if (deploymentCacheDirectoryList.isEmpty()) {
+            for (String cacheDirectoryProperty : DEPLOYMENT_CACHE_PROPERTIES) {
+                String cacheDirectoryPath = System.getProperty(cacheDirectoryProperty);
+                if (cacheDirectoryPath != null) {
+                    try {
+                        File cacheDirectory = (new File(cacheDirectoryPath)).getCanonicalFile();
+                        if (cacheDirectory != null) {
+                            deploymentCacheDirectoryList.add(cacheDirectory);
+                        }
+                    } catch (IOException ioe) {}
+                }
+            }
+        }
+
+        for (File deploymentCacheDirectory : deploymentCacheDirectoryList) {
+            for (File dir = f; dir != null; dir = dir.getParentFile()) {
+                if (dir.equals(deploymentCacheDirectory)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+
     public Object translateBytes(byte[] bytes, DataFlavor flavor,
                                  long format, Transferable localeTransferable)
         throws IOException
--- a/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -490,8 +490,7 @@
             // if the window manager or any other part of the windowing
             // system sets inappropriate size for this window, we can
             // do nothing but accept it.
-            Rectangle reqBounds = newDimensions.getBounds();
-            Rectangle newBounds = constrainBounds(reqBounds.x, reqBounds.y, reqBounds.width, reqBounds.height);
+            Rectangle newBounds = newDimensions.getBounds();
             Insets insets = newDimensions.getInsets();
             // Inherit isClientSizeSet from newDimensions
             if (newDimensions.isClientSizeSet()) {
@@ -619,46 +618,6 @@
     // This method gets overriden in XFramePeer & XDialogPeer.
     abstract boolean isTargetUndecorated();
 
-    @Override
-    Rectangle constrainBounds(int x, int y, int width, int height) {
-        // We don't restrict the setBounds() operation if the code is trusted.
-        if (!hasWarningWindow()) {
-            return new Rectangle(x, y, width, height);
-        }
-
-        // If it's undecorated or is not currently visible,
-        // apply the same constraints as for the Window.
-        if (!isVisible() || isTargetUndecorated()) {
-            return super.constrainBounds(x, y, width, height);
-        }
-
-        // If it's visible & decorated, constraint the size only
-        int newX = x;
-        int newY = y;
-        int newW = width;
-        int newH = height;
-
-        GraphicsConfiguration gc = ((Window)target).getGraphicsConfiguration();
-        Rectangle sB = gc.getBounds();
-        Insets sIn = ((Window)target).getToolkit().getScreenInsets(gc);
-
-        Rectangle curBounds = getBounds();
-
-        int maxW = Math.max(sB.width - sIn.left - sIn.right, curBounds.width);
-        int maxH = Math.max(sB.height - sIn.top - sIn.bottom, curBounds.height);
-
-        // First make sure the size is withing the visible part of the screen
-        if (newW > maxW) {
-            newW = maxW;
-        }
-
-        if (newH > maxH) {
-            newH = maxH;
-        }
-
-        return new Rectangle(newX, newY, newW, newH);
-    }
-
     /**
      * @see java.awt.peer.ComponentPeer#setBounds
      */
--- a/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -196,12 +196,6 @@
         }
     }
 
-    @Override
-    Rectangle constrainBounds(int x, int y, int width, int height) {
-        // We don't constrain the bounds of the EmbeddedFrames
-        return new Rectangle(x, y, width, height);
-    }
-
     // don't use getBounds() inherited from XDecoratedPeer
     public Rectangle getBounds() {
         return new Rectangle(x, y, width, height);
--- a/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java	Tue Apr 28 13:30:42 2009 -0700
@@ -156,11 +156,11 @@
     }
 
     XWindow(Component target, long parentWindow) {
-        this(target, parentWindow, target.getBounds());
+        this(target, parentWindow, new Rectangle(target.getBounds()));
     }
 
     XWindow(Component target) {
-        this(target, (target.getParent() == null) ? 0 : getParentWindowID(target), target.getBounds());
+        this(target, (target.getParent() == null) ? 0 : getParentWindowID(target), new Rectangle(target.getBounds()));
     }
 
     XWindow(Object target) {
@@ -198,7 +198,7 @@
             | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask);
 
         if (target != null) {
-            params.putIfNull(BOUNDS, target.getBounds());
+            params.putIfNull(BOUNDS, new Rectangle(target.getBounds()));
         } else {
             params.putIfNull(BOUNDS, new Rectangle(0, 0, MIN_SIZE, MIN_SIZE));
         }
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -146,6 +146,13 @@
 
         params.put(OVERRIDE_REDIRECT, Boolean.valueOf(isOverrideRedirect()));
 
+        SunToolkit.awtLock();
+        try {
+            windows.add(this);
+        } finally {
+            SunToolkit.awtUnlock();
+        }
+
         cachedFocusableWindow = isFocusableWindow();
 
         Font f = target.getFont();
@@ -173,9 +180,6 @@
 
         GraphicsConfiguration gc = getGraphicsConfiguration();
         ((X11GraphicsDevice)gc.getDevice()).addDisplayChangedListener(this);
-
-        Rectangle bounds = (Rectangle)(params.get(BOUNDS));
-        params.put(BOUNDS, constrainBounds(bounds.x, bounds.y, bounds.width, bounds.height));
     }
 
     protected String getWMName() {
@@ -430,56 +434,6 @@
         return ownerPeer;
     }
 
-    // This method is overriden at the XDecoratedPeer to handle
-    // decorated windows a bit differently.
-    Rectangle constrainBounds(int x, int y, int width, int height) {
-        // We don't restrict the setBounds() operation if the code is trusted.
-        if (!hasWarningWindow()) {
-            return new Rectangle(x, y, width, height);
-        }
-
-        // The window bounds should be within the visible part of the screen
-        int newX = x;
-        int newY = y;
-        int newW = width;
-        int newH = height;
-
-        // Now check each point is within the visible part of the screen
-        GraphicsConfiguration gc = ((Window)target).getGraphicsConfiguration();
-        Rectangle sB = gc.getBounds();
-        Insets sIn = ((Window)target).getToolkit().getScreenInsets(gc);
-
-        int screenX = sB.x + sIn.left;
-        int screenY = sB.y + sIn.top;
-        int screenW = sB.width - sIn.left - sIn.right;
-        int screenH = sB.height - sIn.top - sIn.bottom;
-
-
-        // First make sure the size is withing the visible part of the screen
-        if (newW > screenW) {
-            newW = screenW;
-        }
-
-        if (newH > screenH) {
-            newH = screenH;
-        }
-
-        // Tweak the location if needed
-        if (newX < screenX) {
-            newX = screenX;
-        } else if (newX + newW > screenX + screenW) {
-            newX = screenX + screenW - newW;
-        }
-
-        if (newY < screenY) {
-            newY = screenY;
-        } else if (newY + newH > screenY + screenH) {
-            newY = screenY + screenH - newH;
-        }
-
-        return new Rectangle(newX, newY, newW, newH);
-    }
-
     //Fix for 6318144: PIT:Setting Min Size bigger than current size enlarges
     //the window but fails to revalidate, Sol-CDE
     //This bug is regression for
@@ -488,13 +442,11 @@
     //Note that this function is overriden in XDecoratedPeer so event
     //posting is not changing for decorated peers
     public void setBounds(int x, int y, int width, int height, int op) {
-        Rectangle newBounds = constrainBounds(x, y, width, height);
-
         XToolkit.awtLock();
         try {
             Rectangle oldBounds = getBounds();
 
-            super.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height, op);
+            super.setBounds(x, y, width, height, op);
 
             Rectangle bounds = getBounds();
 
--- a/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Tue Apr 28 13:30:42 2009 -0700
@@ -451,9 +451,7 @@
         }
     }
 
-    /*
     @Override
-    */
     public boolean isTranslucencyCapable() {
         return isTranslucencyCapable(getAData());
     }
--- a/src/windows/classes/sun/awt/Win32GraphicsConfig.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/Win32GraphicsConfig.java	Tue Apr 28 13:30:42 2009 -0700
@@ -332,9 +332,7 @@
         // the rest of the flip actions are not supported
     }
 
-    /*
     @Override
-    */
     public boolean isTranslucencyCapable() {
         //XXX: worth checking if 8-bit? Anyway, it doesn't hurt.
         return true;
--- a/src/windows/classes/sun/awt/windows/WComponentPeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -970,11 +970,12 @@
      *
      * Conditions which could prevent hw acceleration include the toplevel
      * window containing this component being
-     * {@link com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT TRANSLUCENT}.
+     * {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
+     * PERPIXEL_TRANSLUCENT}.
      *
      * @return {@code true} if this component is capable of being hw
      * accelerated, {@code false} otherwise
-     * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
+     * @see GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
      */
     public boolean isAccelCapable() {
         boolean isTranslucent =
--- a/src/windows/classes/sun/awt/windows/WDialogPeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/windows/WDialogPeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -114,12 +114,10 @@
     }
 
     public void reshape(int x, int y, int width, int height) {
-        Rectangle newBounds = constrainBounds(x, y, width, height);
-
         if (((Dialog)target).isUndecorated()) {
-            super.reshape(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
+            super.reshape(x, y, width, height);
         } else {
-            reshapeFrame(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
+            reshapeFrame(x, y, width, height);
         }
     }
 
--- a/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -68,12 +68,6 @@
     public native void synthesizeWmActivate(boolean doActivate);
 
     @Override
-    Rectangle constrainBounds(int x, int y, int width, int height) {
-        // We don't constrain the bounds of the EmbeddedFrames
-        return new Rectangle(x, y, width, height);
-    }
-
-    @Override
     public boolean isAccelCapable() {
         // REMIND: Temp workaround for issues with using HW acceleration
         // in the browser on Vista when DWM is enabled
--- a/src/windows/classes/sun/awt/windows/WFramePeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/windows/WFramePeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -89,12 +89,10 @@
     }
 
     public void reshape(int x, int y, int width, int height) {
-        Rectangle newBounds = constrainBounds(x, y, width, height);
-
         if (((Frame)target).isUndecorated()) {
-            super.reshape(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
+            super.reshape(x, y, width, height);
         } else {
-            reshapeFrame(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
+            reshapeFrame(x, y, width, height);
         }
     }
 
--- a/src/windows/classes/sun/awt/windows/WPanelPeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/windows/WPanelPeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -99,45 +99,4 @@
     public Insets insets() {
         return getInsets();
     }
-
-    private native void pRestack(Object[] peers);
-    private void restack(Container cont, Vector peers) {
-        for (int i = 0; i < cont.getComponentCount(); i++) {
-            Component comp = cont.getComponent(i);
-            if (!comp.isLightweight()) {
-                ComponentPeer peer = comp.getPeer();
-                if (peer != null && (peer instanceof WComponentPeer))
-                {
-                    peers.add(peer);
-                } else {
-                    if (log.isLoggable(Level.FINE)) {
-                        log.log(Level.FINE,
-                                "peer of a {0} is null or not a WComponentPeer: {1}.",
-                                new Object[]{comp, peer});
-                    }
-                }
-            }
-            if (comp.isLightweight() && comp instanceof Container) {
-                restack((Container)comp, peers);
-            }
-        }
-    }
-
-    /**
-     * @see java.awt.peer.ContainerPeer#restack
-     */
-    public void restack() {
-        Vector peers = new Vector();
-        peers.add(this);
-        Container cont = (Container)target;
-        restack(cont, peers);
-        pRestack(peers.toArray());
-    }
-
-    /**
-     * @see java.awt.peer.ContainerPeer#isRestackSupported
-     */
-    public boolean isRestackSupported() {
-        return true;
-    }
 }
--- a/src/windows/classes/sun/awt/windows/WWindowPeer.java	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue Apr 28 13:30:42 2009 -0700
@@ -335,16 +335,14 @@
     }
 
     private void updateShape() {
-        // Shape shape = ((Window)target).getShape();
-        Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
+        Shape shape = ((Window)target).getShape();
         if (shape != null) {
             applyShape(Region.getInstance(shape, null));
         }
     }
 
     private void updateOpacity() {
-        // float opacity = ((Window)target).getOpacity();
-        float opacity = AWTAccessor.getWindowAccessor().getOpacity((Window)target);
+        float opacity = ((Window)target).getOpacity();
         if (opacity < 1.0f) {
             setOpacity(opacity);
         }
@@ -546,81 +544,16 @@
      private volatile int sysW = 0;
      private volatile int sysH = 0;
 
-     Rectangle constrainBounds(int x, int y, int width, int height) {
-         GraphicsConfiguration gc = this.winGraphicsConfig;
-
-         // We don't restrict the setBounds() operation if the code is trusted.
-         if (!hasWarningWindow() || gc == null) {
-             return new Rectangle(x, y, width, height);
-         }
-
-         int newX = x;
-         int newY = y;
-         int newW = width;
-         int newH = height;
-
-         Rectangle sB = gc.getBounds();
-         Insets sIn = Toolkit.getDefaultToolkit().getScreenInsets(gc);
-
-         int screenW = sB.width - sIn.left - sIn.right;
-         int screenH = sB.height - sIn.top - sIn.bottom;
-
-         // If it's undecorated or is not currently visible
-         if (!AWTAccessor.getComponentAccessor().isVisible_NoClientCode(
-                     (Component)target) || isTargetUndecorated())
-         {
-             // Now check each point is within the visible part of the screen
-             int screenX = sB.x + sIn.left;
-             int screenY = sB.y + sIn.top;
-
-             // First make sure the size is within the visible part of the screen
-             if (newW > screenW) {
-                 newW = screenW;
-             }
-             if (newH > screenH) {
-                 newH = screenH;
-             }
-
-             // Tweak the location if needed
-             if (newX < screenX) {
-                 newX = screenX;
-             } else if (newX + newW > screenX + screenW) {
-                 newX = screenX + screenW - newW;
-             }
-             if (newY < screenY) {
-                 newY = screenY;
-             } else if (newY + newH > screenY + screenH) {
-                 newY = screenY + screenH - newH;
-             }
-         } else {
-             int maxW = Math.max(screenW, sysW);
-             int maxH = Math.max(screenH, sysH);
-
-             // Make sure the size is withing the visible part of the screen
-             // OR less that the current size of the window.
-             if (newW > maxW) {
-                 newW = maxW;
-             }
-             if (newH > maxH) {
-                 newH = maxH;
-             }
-         }
-
-         return new Rectangle(newX, newY, newW, newH);
-     }
-
      public native void repositionSecurityWarning();
 
      @Override
      public void setBounds(int x, int y, int width, int height, int op) {
-         Rectangle newBounds = constrainBounds(x, y, width, height);
+         sysX = x;
+         sysY = y;
+         sysW = width;
+         sysH = height;
 
-         sysX = newBounds.x;
-         sysY = newBounds.y;
-         sysW = newBounds.width;
-         sysH = newBounds.height;
-
-         super.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height, op);
+         super.setBounds(x, y, width, height, op);
      }
 
     @Override
@@ -675,11 +608,13 @@
     public void setOpaque(boolean isOpaque) {
         Window target = (Window)getTarget();
 
-        SunToolkit sunToolkit = (SunToolkit)target.getToolkit();
-        if (!sunToolkit.isWindowTranslucencySupported() ||
-            !sunToolkit.isTranslucencyCapable(target.getGraphicsConfiguration()))
-        {
-            return;
+        if (!isOpaque) {
+            SunToolkit sunToolkit = (SunToolkit)target.getToolkit();
+            if (!sunToolkit.isWindowTranslucencySupported() ||
+                !sunToolkit.isTranslucencyCapable(target.getGraphicsConfiguration()))
+            {
+                return;
+            }
         }
 
         boolean opaqueChanged = this.isOpaque != isOpaque;
@@ -713,9 +648,9 @@
             // its shape only. To restore the correct visual appearance
             // of the window (i.e. w/ the correct shape) we have to reset
             // the shape.
-            Shape shape = AWTAccessor.getWindowAccessor().getShape(target);
+            Shape shape = ((Window)target).getShape();
             if (shape != null) {
-                AWTAccessor.getWindowAccessor().setShape(target, shape);
+                ((Window)target).setShape(shape);
             }
         }
 
@@ -729,6 +664,11 @@
             return;
         }
 
+        Component target = (Component)this.target;
+        if (target.getWidth() <= 0 || target.getHeight() <= 0) {
+            return;
+        }
+
         TranslucentWindowPainter currentPainter = painter;
         if (currentPainter != null) {
             currentPainter.updateWindow(backBuffer);
--- a/src/windows/native/sun/windows/awt_Component.cpp	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/native/sun/windows/awt_Component.cpp	Tue Apr 28 13:30:42 2009 -0700
@@ -1843,8 +1843,13 @@
       case WM_AWT_SETALWAYSONTOP: {
         AwtWindow* w = (AwtWindow*)lParam;
         BOOL value = (BOOL)wParam;
+        UINT flags = SWP_NOMOVE | SWP_NOSIZE;
+        // transient windows shouldn't change the owner window's position in the z-order
+        if (w->IsRetainingHierarchyZOrder()) {
+            flags |= SWP_NOOWNERZORDER;
+        }
         ::SetWindowPos(w->GetHWnd(), (value != 0 ? HWND_TOPMOST : HWND_NOTOPMOST),
-                       0,0,0,0, SWP_NOMOVE|SWP_NOSIZE);
+                       0,0,0,0, flags);
         break;
       }
 
--- a/src/windows/native/sun/windows/awt_Window.cpp	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/native/sun/windows/awt_Window.cpp	Tue Apr 28 13:30:42 2009 -0700
@@ -165,7 +165,6 @@
 int AwtWindow::ms_instanceCounter = 0;
 HHOOK AwtWindow::ms_hCBTFilter;
 AwtWindow * AwtWindow::m_grabbedWindow = NULL;
-HWND AwtWindow::sm_retainingHierarchyZOrderInShow = NULL;
 BOOL AwtWindow::sm_resizing = FALSE;
 UINT AwtWindow::untrustedWindowsCounter = 0;
 
@@ -341,23 +340,6 @@
 }
 
 MsgRouting AwtWindow::WmWindowPosChanging(LPARAM windowPos) {
-    /*
-     * See 6178004.
-     * Some windows shouldn't trigger a change in z-order of
-     * any window from the hierarchy.
-     */
-    if (IsRetainingHierarchyZOrder()) {
-        if (((WINDOWPOS *)windowPos)->flags & SWP_SHOWWINDOW) {
-            sm_retainingHierarchyZOrderInShow = GetHWnd();
-        }
-    } else if (sm_retainingHierarchyZOrderInShow != NULL) {
-        HWND ancestor = ::GetAncestor(sm_retainingHierarchyZOrderInShow, GA_ROOTOWNER);
-        HWND windowAncestor = ::GetAncestor(GetHWnd(), GA_ROOTOWNER);
-
-        if (windowAncestor == ancestor) {
-            ((WINDOWPOS *)windowPos)->flags |= SWP_NOZORDER;
-        }
-    }
     return mrDoDefault;
 }
 
@@ -369,19 +351,14 @@
     ::SetWindowPos(warningWindow, HWND_NOTOPMOST,
             rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top,
-            SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER
+            SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |
+            SWP_NOOWNERZORDER
             );
 }
 
 MsgRouting AwtWindow::WmWindowPosChanged(LPARAM windowPos) {
     WINDOWPOS * wp = (WINDOWPOS *)windowPos;
 
-    if (IsRetainingHierarchyZOrder() && wp->flags & SWP_SHOWWINDOW) {
-        // By this time all the windows from the hierarchy are already notified about z-order change.
-        // Thus we may and we should reset the trigger in order not to affect other changes.
-        sm_retainingHierarchyZOrderInShow = NULL;
-    }
-
     // Reposition the warning window
     if (IsUntrusted() && warningWindow != NULL) {
         if (wp->flags & SWP_HIDEWINDOW) {
@@ -854,7 +831,7 @@
     if (securityAnimationKind == akShow) {
         ::SetWindowPos(warningWindow, HWND_NOTOPMOST, 0, 0, 0, 0,
                 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE |
-                SWP_SHOWWINDOW);
+                SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
 
         ::SetLayeredWindowAttributes(warningWindow, RGB(0, 0, 0),
                 0xFF, LWA_ALPHA);
@@ -880,7 +857,7 @@
         case akPreHide:
             ::SetWindowPos(warningWindow, HWND_NOTOPMOST, 0, 0, 0, 0,
                     SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE |
-                    SWP_HIDEWINDOW);
+                    SWP_HIDEWINDOW | SWP_NOOWNERZORDER);
             break;
         case akShow:
             RepaintWarningWindow();
@@ -1250,7 +1227,16 @@
         }
     }
     if (!done) {
-        ::ShowWindow(GetHWnd(), nCmdShow);
+        // transient windows shouldn't change the owner window's position in the z-order
+        if (IsRetainingHierarchyZOrder()){
+            UINT flags = SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER;
+            if (nCmdShow == SW_SHOWNA) {
+                flags |= SWP_NOACTIVATE;
+            }
+            ::SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, flags);
+        } else {
+            ::ShowWindow(GetHWnd(), nCmdShow);
+        }
     }
     env->DeleteLocalRef(target);
 }
--- a/src/windows/native/sun/windows/awt_Window.h	Thu Apr 23 21:32:44 2009 -0700
+++ b/src/windows/native/sun/windows/awt_Window.h	Tue Apr 28 13:30:42 2009 -0700
@@ -248,7 +248,6 @@
     static int ms_instanceCounter;
     static HHOOK ms_hCBTFilter;
     static LRESULT CALLBACK CBTFilter(int nCode, WPARAM wParam, LPARAM lParam);
-    static HWND sm_retainingHierarchyZOrderInShow; // a referred window in the process of show
     static BOOL sm_resizing;        /* in the middle of a resizing operation */
 
     RECT m_insets;          /* a cache of the insets being used */
--- a/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java	Thu Apr 23 21:32:44 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * @test %I% %E%
- * @bug 6683728
- * @summary Tests that a JApplet in a translucent JFrame works properly
- * @author Kenneth.Russell@sun.com: area=Graphics
- * @compile -XDignore.symbol.file=true TranslucentJAppletTest.java
- * @run main/manual/othervm TranslucentJAppletTest
- */
-
-import java.awt.*;
-import java.awt.image.*;
-
-import javax.swing.*;
-
-public class TranslucentJAppletTest {
-
-    private static JFrame frame;
-    private static volatile boolean paintComponentCalled = false;
-
-    private static void initAndShowGUI() {
-        frame = new JFrame();
-        JApplet applet = new JApplet();
-        JPanel panel = new JPanel() {
-            protected void paintComponent(Graphics g) {
-                paintComponentCalled = true;
-                g.setColor(Color.RED);
-                g.fillOval(0, 0, getWidth(), getHeight());
-            }
-        };
-        panel.setDoubleBuffered(false);
-        panel.setOpaque(false);
-        applet.add(panel);
-        frame.add(applet);
-        frame.setBounds(100, 100, 200, 200);
-        frame.setUndecorated(true);
-        com.sun.awt.AWTUtilities.setWindowOpaque(frame, false);
-        frame.setVisible(true);
-    }
-
-    public static void main(String[] args)
-        throws Exception
-    {
-        sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
-
-        Robot r = new Robot();
-        Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates
-
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                initAndShowGUI();
-            }
-        });
-        tk.realSync();
-
-        if (!paintComponentCalled) {
-            throw new RuntimeException("Test FAILED: panel's paintComponent() method is not called");
-        }
-
-        Color newColor1 = r.getPixelColor(100, 100);
-        // unfortunately, robot.getPixelColor() doesn't work for some unknown reason
-        // Color newColor2 = r.getPixelColor(200, 200);
-        BufferedImage bim = r.createScreenCapture(new Rectangle(200, 200, 1, 1));
-        Color newColor2 = new Color(bim.getRGB(0, 0));
-
-        // Frame must be transparent at (100, 100) in screen coords
-        if (!color1.equals(newColor1)) {
-            System.err.println("color1 = " + color1);
-            System.err.println("newColor1 = " + newColor1);
-            throw new RuntimeException("Test FAILED: frame pixel at (0, 0) is not transparent");
-        }
-
-        // Frame must be RED at (200, 200) in screen coords
-        if (!newColor2.equals(Color.RED)) {
-            System.err.println("newColor2 = " + newColor2);
-            throw new RuntimeException("Test FAILED: frame pixel at (100, 100) is not red (transparent?)");
-        }
-
-        System.out.println("Test PASSED");
-    }
-}
--- a/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java	Thu Apr 23 21:32:44 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +0,0 @@
-/*
- * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-import com.sun.awt.AWTUtilities;
-import static com.sun.awt.AWTUtilities.Translucency.*;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
-import java.awt.RenderingHints;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.Canvas;
-import java.awt.Component;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-import java.util.Random;
-import java.awt.geom.Ellipse2D;
-import javax.swing.JApplet;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-
-public class TSFrame {
-
-    static volatile boolean done = false;
-
-    static final boolean useSwing = System.getProperty("useswing") != null;
-    static final boolean useShape = System.getProperty("useshape") != null;
-    static final boolean useTransl = System.getProperty("usetransl") != null;
-    static final boolean useNonOpaque = System.getProperty("usenonop") != null;
-
-    static final Random rnd = new Random();
-    private static void render(Graphics g, int w, int h, boolean useNonOpaque) {
-        if (useNonOpaque) {
-            Graphics2D g2d = (Graphics2D)g;
-            GradientPaint p =
-                new GradientPaint(0.0f, 0.0f,
-                                  new Color(rnd.nextInt(0xffffff)),
-                                  w, h,
-                                  new Color(rnd.nextInt(0xff),
-                                            rnd.nextInt(0xff),
-                                            rnd.nextInt(0xff), 0),
-                                  true);
-            g2d.setPaint(p);
-            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                                 RenderingHints.VALUE_ANTIALIAS_ON);
-            g2d.fillOval(0, 0, w, h);
-        } else {
-            g.setColor(new Color(rnd.nextInt(0xffffff)));
-            g.fillRect(0, 0, w, h);
-        }
-    }
-
-    private static class MyCanvas extends Canvas {
-        @Override
-        public void paint(Graphics g) {
-            render(g, getWidth(), getHeight(), false);
-        }
-        @Override
-        public Dimension getPreferredSize() {
-            return new Dimension(200, 100);
-        }
-    }
-    private static class NonOpaqueJFrame extends JFrame {
-        NonOpaqueJFrame(GraphicsConfiguration gc) {
-            super("NonOpaque Swing JFrame", gc);
-            JPanel p = new JPanel() {
-                public void paintComponent(Graphics g) {
-                    super.paintComponent(g);
-                    render(g, getWidth(), getHeight(), true);
-                    g.setColor(Color.red);
-                    g.drawString("Non-Opaque Swing JFrame", 10, 15);
-                }
-            };
-            p.setDoubleBuffered(false);
-            p.setOpaque(false);
-            add(p);
-            setUndecorated(true);
-        }
-    }
-    private static class NonOpaqueJAppletFrame extends JFrame {
-        JPanel p;
-        NonOpaqueJAppletFrame(GraphicsConfiguration gc) {
-            super("NonOpaque Swing JAppletFrame", gc);
-            JApplet ja = new JApplet() {
-                public void paint(Graphics g) {
-                    super.paint(g);
-                    System.err.println("JAppletFrame paint called");
-                }
-            };
-            p = new JPanel() {
-                public void paintComponent(Graphics g) {
-                    super.paintComponent(g);
-                    render(g, getWidth(), getHeight(), true);
-                    g.setColor(Color.red);
-                    g.drawString("Non-Opaque Swing JFrame", 10, 15);
-                }
-            };
-            p.setDoubleBuffered(false);
-            p.setOpaque(false);
-            ja.add(p);
-            add(ja);
-            setUndecorated(true);
-        }
-    }
-    private static class NonOpaqueFrame extends Frame {
-        NonOpaqueFrame(GraphicsConfiguration gc) {
-            super("NonOpaque AWT Frame", gc);
-            // uncomment to test with hw child
-//            setLayout(null);
-//            Component c = new Panel() {
-//                public void paint(Graphics g) {
-//                    g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.5f));
-//                    g.fillRect(0, 0, getWidth(), getHeight());
-//                }
-//            };
-//            c.setSize(100, 100);
-//            c.setBackground(Color.red);
-//            c.setForeground(Color.red);
-//            add(c);
-//            c.setLocation(130, 130);
-        }
-        @Override
-        public void paint(Graphics g) {
-            render(g, getWidth(), getHeight(), true);
-            g.setColor(Color.red);
-            g.drawString("Non-Opaque AWT Frame", 10, 15);
-        }
-    }
-
-    private static class MyJPanel extends JPanel {
-        @Override
-        public void paintComponent(Graphics g) {
-            render(g, getWidth(), getHeight(), false);
-        }
-    }
-
-    public static Frame createGui(GraphicsConfiguration gc,
-                                  final boolean useSwing,
-                                  final boolean useShape,
-                                  final boolean useTransl,
-                                  final boolean useNonOpaque,
-                                  final float factor)
-    {
-        Frame frame;
-        done = false;
-
-        if (gc == null) {
-            gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
-                    getDefaultScreenDevice().getDefaultConfiguration();
-        }
-
-        if (useNonOpaque) {
-            if (useSwing) {
-                frame = new NonOpaqueJFrame(gc);
-//                frame = new NonOpaqueJAppletFrame(gc);
-            } else {
-                frame = new NonOpaqueFrame(gc);
-            }
-            animateComponent(frame);
-        } else if (useSwing) {
-            frame = new JFrame("Swing Frame", gc);
-            JComponent p = new JButton("Swing!");
-            p.setPreferredSize(new Dimension(200, 100));
-            frame.add("North", p);
-            p = new MyJPanel();
-            animateComponent(p);
-            frame.add("Center", p);
-        } else {
-            frame = new Frame("AWT Frame", gc) {
-                public void paint(Graphics g) {
-                    g.setColor(Color.red);
-                    g.fillRect(0, 0, 100, 100);
-                }
-            };
-            frame.setLayout(new BorderLayout());
-            Canvas c = new MyCanvas();
-            frame.add("North", c);
-            animateComponent(c);
-            c = new MyCanvas();
-            frame.add("Center", c);
-            animateComponent(c);
-            c = new MyCanvas();
-            frame.add("South", c);
-            animateComponent(c);
-        }
-        final Frame finalFrame = frame;
-        frame.addWindowListener(new WindowAdapter() {
-            @Override
-            public void windowClosing(WindowEvent e) {
-                finalFrame.dispose();
-                done = true;
-            }
-        });
-        frame.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mouseClicked(MouseEvent e) {
-                finalFrame.dispose();
-                done = true;
-            }
-        });
-        frame.setPreferredSize(new Dimension(800, 600));
-
-        if (useShape) {
-            frame.setUndecorated(true);
-        }
-
-        frame.setLocation(450, 10);
-        frame.pack();
-
-        if (useShape) {
-            if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSPARENT)) {
-                System.out.println("applying PERPIXEL_TRANSPARENT");
-                AWTUtilities.setWindowShape(frame,
-                    new Ellipse2D.Double(0, 0, frame.getWidth(),
-                                               frame.getHeight()/3));
-                frame.setTitle("PERPIXEL_TRANSPARENT");
-            } else {
-                System.out.println("Passed: PERPIXEL_TRANSPARENT unsupported");
-            }
-        }
-        if (useTransl) {
-            if (AWTUtilities.isTranslucencySupported(TRANSLUCENT)) {
-                System.out.println("applying TRANSLUCENT");
-                AWTUtilities.setWindowOpacity(frame, factor);
-                frame.setTitle("TRANSLUCENT");
-            } else {
-                System.out.println("Passed: TRANSLUCENT unsupported");
-            }
-        }
-        if (useNonOpaque) {
-            if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT) &&
-                AWTUtilities.isTranslucencyCapable(gc))
-            {
-                System.out.println("applying PERPIXEL_TRANSLUCENT");
-                AWTUtilities.setWindowOpaque(frame, false);
-                frame.setTitle("PERPIXEL_TRANSLUCENT");
-            } else {
-                System.out.println("Passed: PERPIXEL_TRANSLUCENT unsupported");
-            }
-        }
-        frame.setVisible(true);
-        return frame;
-    }
-
-    public static void stopThreads() {
-        done = true;
-    }
-
-    private static void animateComponent(final Component comp) {
-        Thread t = new Thread(new Runnable() {
-            public void run() {
-                do {
-                    try {
-                        Thread.sleep(50);
-                    } catch (InterruptedException ex) {}
-                    comp.repaint();
-                } while (!done);
-            }
-        });
-        t.start();
-    }
-
-    public static void main(String[] args) throws Exception {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                TSFrame.createGui(null, useSwing,
-                                  useShape,
-                                  useTransl,
-                                  useNonOpaque,
-                                  0.7f);
-            }
-        });
-    }
-}
--- a/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form	Thu Apr 23 21:32:44 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
-  <NonVisualComponents>
-    <Component class="javax.swing.ButtonGroup" name="createDisposeGrp">
-    </Component>
-  </NonVisualComponents>
-  <Properties>
-    <Property name="defaultCloseOperation" type="int" value="3"/>
-    <Property name="title" type="java.lang.String" value="TranslucentShapedFrameTest"/>
-  </Properties>
-  <SyntheticProperties>
-    <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
-  </SyntheticProperties>
-  <AuxValues>
-    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
-    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
-    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
-    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
-  </AuxValues>
-
-  <Layout>
-    <DimensionLayout dim="0">
-      <Group type="103" groupAlignment="0" attributes="0">
-          <Group type="102" attributes="0">
-              <EmptySpace max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="0" attributes="0">
-                  <Group type="102" alignment="0" attributes="0">
-                      <Component id="transparencySld" pref="375" max="32767" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                  </Group>
-                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
-                  <Group type="102" alignment="0" attributes="0">
-                      <Component id="shapedCb" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                      <Component id="nonOpaqueChb" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                      <Component id="useSwingCb" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace pref="102" max="32767" attributes="0"/>
-                  </Group>
-                  <Group type="102" alignment="0" attributes="0">
-                      <Group type="103" groupAlignment="0" attributes="0">
-                          <Group type="102" alignment="0" attributes="0">
-                              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
-                              <EmptySpace pref="314" max="-2" attributes="0"/>
-                          </Group>
-                          <Group type="102" alignment="0" attributes="0">
-                              <Component id="passedBtn" min="-2" max="-2" attributes="0"/>
-                              <EmptySpace max="-2" attributes="0"/>
-                              <Component id="failedBtn" min="-2" max="-2" attributes="0"/>
-                              <EmptySpace pref="241" max="-2" attributes="0"/>
-                          </Group>
-                          <Component id="jScrollPane1" alignment="1" pref="375" max="32767" attributes="0"/>
-                          <Group type="102" alignment="0" attributes="0">
-                              <Component id="createFrameBtn" min="-2" pref="187" max="-2" attributes="0"/>
-                              <EmptySpace max="-2" attributes="0"/>
-                              <Component id="disposeFrameBtn" min="-2" pref="182" max="-2" attributes="0"/>
-                          </Group>
-                      </Group>
-                      <EmptySpace max="-2" attributes="0"/>
-                  </Group>
-              </Group>
-          </Group>
-      </Group>
-    </DimensionLayout>
-    <DimensionLayout dim="1">
-      <Group type="103" groupAlignment="0" attributes="0">
-          <Group type="102" alignment="0" attributes="0">
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="transparencySld" min="-2" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="3" attributes="0">
-                  <Component id="shapedCb" alignment="3" min="-2" max="-2" attributes="0"/>
-                  <Component id="nonOpaqueChb" alignment="3" min="-2" max="-2" attributes="0"/>
-                  <Component id="useSwingCb" alignment="3" min="-2" max="-2" attributes="0"/>
-              </Group>
-              <EmptySpace max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="3" attributes="0">
-                  <Component id="disposeFrameBtn" alignment="3" min="-2" max="-2" attributes="0"/>
-                  <Component id="createFrameBtn" alignment="3" min="-2" max="-2" attributes="0"/>
-              </Group>
-              <EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
-              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="jScrollPane1" min="-2" pref="148" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="3" attributes="0">
-                  <Component id="passedBtn" alignment="3" min="-2" max="-2" attributes="0"/>
-                  <Component id="failedBtn" alignment="3" min="-2" max="-2" attributes="0"/>
-              </Group>
-              <EmptySpace max="32767" attributes="0"/>
-          </Group>
-      </Group>
-    </DimensionLayout>
-  </Layout>
-  <SubComponents>
-    <Component class="javax.swing.JLabel" name="jLabel1">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Frame Opacity:"/>
-      </Properties>
-    </Component>
-    <Component class="javax.swing.JSlider" name="transparencySld">
-      <Properties>
-        <Property name="majorTickSpacing" type="int" value="10"/>
-        <Property name="minorTickSpacing" type="int" value="5"/>
-        <Property name="paintLabels" type="boolean" value="true"/>
-        <Property name="paintTicks" type="boolean" value="true"/>
-        <Property name="value" type="int" value="100"/>
-      </Properties>
-      <Events>
-        <EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="transparencySldStateChanged"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JCheckBox" name="shapedCb">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Shaped Frame"/>
-        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
-          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
-            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
-          </Border>
-        </Property>
-        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
-          <Insets value="[0, 0, 0, 0]"/>
-        </Property>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="shapedCbActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JCheckBox" name="nonOpaqueChb">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Non Opaque Frame"/>
-        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
-          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
-            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
-          </Border>
-        </Property>
-        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
-          <Insets value="[0, 0, 0, 0]"/>
-        </Property>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nonOpaqueChbActionPerformed"/>
-      </Events>
-    </Component>
-    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
-      <AuxValues>
-        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
-      </AuxValues>
-
-      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
-      <SubComponents>
-        <Component class="javax.swing.JTextArea" name="jTextArea1">
-          <Properties>
-            <Property name="columns" type="int" value="20"/>
-            <Property name="rows" type="int" value="5"/>
-            <Property name="text" type="java.lang.String" value="Create translucent and/or shaped, or&#xa;non-opaque frame. Make sure it behaves&#xa;correctly (no artifacts left on the screen&#xa;when dragging - if dragging is possible).&#xa;Click &quot;Passed&quot; if the test behaves correctly,&#xa;&quot;Falied&quot; otherwise."/>
-          </Properties>
-        </Component>
-      </SubComponents>
-    </Container>
-    <Component class="javax.swing.JLabel" name="jLabel2">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Instructions:"/>
-      </Properties>
-    </Component>
-    <Component class="javax.swing.JButton" name="passedBtn">
-      <Properties>
-        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
-          <Color blue="64" green="ff" red="81" type="rgb"/>
-        </Property>
-        <Property name="text" type="java.lang.String" value="Passed"/>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="passedBtnActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JButton" name="failedBtn">
-      <Properties>
-        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
-          <Color blue="0" green="0" id="red" palette="1" red="ff" type="palette"/>
-        </Property>
-        <Property name="text" type="java.lang.String" value="Failed"/>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="failedBtnActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JToggleButton" name="createFrameBtn">
-      <Properties>
-        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
-          <ComponentRef name="createDisposeGrp"/>
-        </Property>
-        <Property name="text" type="java.lang.String" value="Create Frame"/>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createFrameBtnActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JToggleButton" name="disposeFrameBtn">
-      <Properties>
-        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
-          <ComponentRef name="createDisposeGrp"/>
-        </Property>
-        <Property name="selected" type="boolean" value="true"/>
-        <Property name="text" type="java.lang.String" value="Dispose Frame"/>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="disposeFrameBtnActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JCheckBox" name="useSwingCb">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Use JFrame"/>
-        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
-          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
-            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
-          </Border>
-        </Property>
-        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
-          <Insets value="[0, 0, 0, 0]"/>
-        </Property>
-      </Properties>
-    </Component>
-  </SubComponents>
-</Form>
--- a/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java	Thu Apr 23 21:32:44 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,359 +0,0 @@
-/*
- * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * @test %I% %E%
- * @bug 6655001 6670649 6687141
- * @summary Tests that hw acceleration doesn't affect translucent/shaped windows
- * @author Dmitri.Trembovetski@sun.com: area=Graphics
- * @compile -XDignore.symbol.file=true TranslucentShapedFrameTest.java
- * @compile -XDignore.symbol.file=true TSFrame.java
- * @run main/manual/othervm TranslucentShapedFrameTest
- * @run main/manual/othervm -Dsun.java2d.noddraw=true TranslucentShapedFrameTest
- * @run main/manual/othervm -Dsun.java2d.opengl=True TranslucentShapedFrameTest
- */
-import com.sun.awt.AWTUtilities;
-import static com.sun.awt.AWTUtilities.Translucency.*;
-import java.awt.Frame;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Shape;
-import java.awt.geom.Ellipse2D;
-import java.util.concurrent.CountDownLatch;
-import javax.swing.JSlider;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.UnsupportedLookAndFeelException;
-
-public class TranslucentShapedFrameTest extends javax.swing.JFrame {
-    Frame testFrame;
-    static CountDownLatch done;
-    static volatile boolean failed = false;
-    GraphicsConfiguration gcToUse = null;
-
-    /**
-     * Creates new form TranslucentShapedFrameTest
-     */
-    public TranslucentShapedFrameTest() {
-        // not necessary, but we just look nicer
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception ex) {}
-
-        initComponents();
-        checkEffects();
-
-        SwingUtilities.updateComponentTreeUI(this);
-    }
-
-    /** This method is called from within the constructor to
-     * initialize the form.
-     * WARNING: Do NOT modify this code. The content of this method is
-     * always regenerated by the Form Editor.
-     */
-    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
-    private void initComponents() {
-        createDisposeGrp = new javax.swing.ButtonGroup();
-        jLabel1 = new javax.swing.JLabel();
-        transparencySld = new javax.swing.JSlider();
-        shapedCb = new javax.swing.JCheckBox();
-        nonOpaqueChb = new javax.swing.JCheckBox();
-        jScrollPane1 = new javax.swing.JScrollPane();
-        jTextArea1 = new javax.swing.JTextArea();
-        jLabel2 = new javax.swing.JLabel();
-        passedBtn = new javax.swing.JButton();
-        failedBtn = new javax.swing.JButton();
-        createFrameBtn = new javax.swing.JToggleButton();
-        disposeFrameBtn = new javax.swing.JToggleButton();
-        useSwingCb = new javax.swing.JCheckBox();
-
-        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
-        setTitle("TranslucentShapedFrameTest");
-        jLabel1.setText("Frame Opacity:");
-
-        transparencySld.setMajorTickSpacing(10);
-        transparencySld.setMinorTickSpacing(5);
-        transparencySld.setPaintLabels(true);
-        transparencySld.setPaintTicks(true);
-        transparencySld.setValue(100);
-        transparencySld.addChangeListener(new javax.swing.event.ChangeListener() {
-            public void stateChanged(javax.swing.event.ChangeEvent evt) {
-                transparencySldStateChanged(evt);
-            }
-        });
-
-        shapedCb.setText("Shaped Frame");
-        shapedCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
-        shapedCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
-        shapedCb.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                shapedCbActionPerformed(evt);
-            }
-        });
-
-        nonOpaqueChb.setText("Non Opaque Frame");
-        nonOpaqueChb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
-        nonOpaqueChb.setMargin(new java.awt.Insets(0, 0, 0, 0));
-        nonOpaqueChb.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                nonOpaqueChbActionPerformed(evt);
-            }
-        });
-
-        jTextArea1.setColumns(20);
-        jTextArea1.setRows(5);
-        jTextArea1.setText("Create translucent and/or shaped, or\nnon-opaque frame. Make sure it behaves\ncorrectly (no artifacts left on the screen\nwhen dragging - if dragging is possible).\nClick \"Passed\" if the test behaves correctly,\n\"Falied\" otherwise.");
-        jScrollPane1.setViewportView(jTextArea1);
-
-        jLabel2.setText("Instructions:");
-
-        passedBtn.setBackground(new java.awt.Color(129, 255, 100));
-        passedBtn.setText("Passed");
-        passedBtn.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                passedBtnActionPerformed(evt);
-            }
-        });
-
-        failedBtn.setBackground(java.awt.Color.red);
-        failedBtn.setText("Failed");
-        failedBtn.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                failedBtnActionPerformed(evt);
-            }
-        });
-
-        createDisposeGrp.add(createFrameBtn);
-        createFrameBtn.setText("Create Frame");
-        createFrameBtn.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                createFrameBtnActionPerformed(evt);
-            }
-        });
-
-        createDisposeGrp.add(disposeFrameBtn);
-        disposeFrameBtn.setSelected(true);
-        disposeFrameBtn.setText("Dispose Frame");
-        disposeFrameBtn.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                disposeFrameBtnActionPerformed(evt);
-            }
-        });
-
-        useSwingCb.setText("Use JFrame");
-        useSwingCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
-        useSwingCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
-
-        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
-        getContentPane().setLayout(layout);
-        layout.setHorizontalGroup(
-            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(layout.createSequentialGroup()
-                .addContainerGap()
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addGroup(layout.createSequentialGroup()
-                        .addComponent(transparencySld, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
-                        .addContainerGap())
-                    .addComponent(jLabel1)
-                    .addGroup(layout.createSequentialGroup()
-                        .addComponent(shapedCb)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(nonOpaqueChb)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(useSwingCb)
-                        .addContainerGap(102, Short.MAX_VALUE))
-                    .addGroup(layout.createSequentialGroup()
-                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                            .addGroup(layout.createSequentialGroup()
-                                .addComponent(jLabel2)
-                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 314, javax.swing.GroupLayout.PREFERRED_SIZE))
-                            .addGroup(layout.createSequentialGroup()
-                                .addComponent(passedBtn)
-                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                                .addComponent(failedBtn)
-                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
-                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
-                            .addGroup(layout.createSequentialGroup()
-                                .addComponent(createFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
-                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                                .addComponent(disposeFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
-                        .addContainerGap())))
-        );
-        layout.setVerticalGroup(
-            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(layout.createSequentialGroup()
-                .addContainerGap()
-                .addComponent(jLabel1)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(transparencySld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(shapedCb)
-                    .addComponent(nonOpaqueChb)
-                    .addComponent(useSwingCb))
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(disposeFrameBtn)
-                    .addComponent(createFrameBtn))
-                .addGap(17, 17, 17)
-                .addComponent(jLabel2)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(passedBtn)
-                    .addComponent(failedBtn))
-                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-        );
-        pack();
-    }// </editor-fold>//GEN-END:initComponents
-
-    private void nonOpaqueChbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nonOpaqueChbActionPerformed
-        if (testFrame != null) {
-            // REMIND: this path in the test doesn't work well (test bug)
-//            AWTUtilities.setWindowOpaque(testFrame, !nonOpaqueChb.isSelected());
-        }
-    }//GEN-LAST:event_nonOpaqueChbActionPerformed
-
-    private void shapedCbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shapedCbActionPerformed
-        if (testFrame != null) {
-            Shape s = null;
-            if (shapedCb.isSelected()) {
-                s = new Ellipse2D.Double(0, 0,
-                                         testFrame.getWidth(),
-                                         testFrame.getHeight());
-            }
-            AWTUtilities.setWindowShape(testFrame, s);
-        }
-    }//GEN-LAST:event_shapedCbActionPerformed
-
-    private void transparencySldStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_transparencySldStateChanged
-        JSlider source = (JSlider)evt.getSource();
-            int transl = transparencySld.getValue();
-            if (testFrame != null) {
-                AWTUtilities.setWindowOpacity(testFrame, (float)transl/100f);
-            }
-    }//GEN-LAST:event_transparencySldStateChanged
-
-    private void failedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_failedBtnActionPerformed
-        disposeFrameBtnActionPerformed(evt);
-        dispose();
-        failed = true;
-        done.countDown();
-    }//GEN-LAST:event_failedBtnActionPerformed
-
-    private void disposeFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disposeFrameBtnActionPerformed
-        TSFrame.stopThreads();
-        if (testFrame != null) {
-            testFrame.dispose();
-            testFrame = null;
-        }
-    }//GEN-LAST:event_disposeFrameBtnActionPerformed
-
-    private void createFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createFrameBtnActionPerformed
-        disposeFrameBtnActionPerformed(evt);
-        int transl = transparencySld.getValue();
-        testFrame = TSFrame.createGui(gcToUse,
-                useSwingCb.isSelected(), shapedCb.isSelected(),
-                (transl < 100), nonOpaqueChb.isSelected(),
-                (float)transl/100f);
-    }//GEN-LAST:event_createFrameBtnActionPerformed
-
-    private void passedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passedBtnActionPerformed
-        disposeFrameBtnActionPerformed(evt);
-        dispose();
-        done.countDown();
-    }//GEN-LAST:event_passedBtnActionPerformed
-
-    /**
-     * @param args the command line arguments
-     */
-    public static void main(String args[]) {
-        done = new CountDownLatch(1);
-        java.awt.EventQueue.invokeLater(new Runnable() {
-            public void run() {
-                new TranslucentShapedFrameTest().setVisible(true);
-            }
-        });
-        try {
-            done.await();
-        } catch (InterruptedException ex) {}
-        if (failed) {
-            throw new RuntimeException("Test FAILED");
-        }
-        System.out.println("Test PASSED");
-    }
-
-    private void checkEffects() {
-        if (!AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSPARENT)) {
-            shapedCb.setEnabled(false);
-        }
-
-        if (!AWTUtilities.isTranslucencySupported(TRANSLUCENT)) {
-            transparencySld.setEnabled(false);
-        }
-
-        GraphicsConfiguration gc = null;
-        if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
-            gc = findGraphicsConfig();
-            if (gc == null) {
-                nonOpaqueChb.setEnabled(false);
-            }
-        }
-
-        gcToUse = gc;
-    }
-
-    private GraphicsConfiguration findGraphicsConfig() {
-        GraphicsDevice gd =
-            GraphicsEnvironment.getLocalGraphicsEnvironment().
-                getDefaultScreenDevice();
-        GraphicsConfiguration gcs[] = gd.getConfigurations();
-        for (GraphicsConfiguration gc : gcs) {
-            if (AWTUtilities.isTranslucencyCapable(gc)) {
-                return gc;
-            }
-        }
-        return null;
-    }
-
-    // Variables declaration - do not modify//GEN-BEGIN:variables
-    private javax.swing.ButtonGroup createDisposeGrp;
-    private javax.swing.JToggleButton createFrameBtn;
-    private javax.swing.JToggleButton disposeFrameBtn;
-    private javax.swing.JButton failedBtn;
-    private javax.swing.JLabel jLabel1;
-    private javax.swing.JLabel jLabel2;
-    private javax.swing.JScrollPane jScrollPane1;
-    private javax.swing.JTextArea jTextArea1;
-    private javax.swing.JCheckBox nonOpaqueChb;
-    private javax.swing.JButton passedBtn;
-    private javax.swing.JCheckBox shapedCb;
-    private javax.swing.JSlider transparencySld;
-    private javax.swing.JCheckBox useSwingCb;
-    // End of variables declaration//GEN-END:variables
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Mixing/MixingInHwPanel.java	Tue Apr 28 13:30:42 2009 -0700
@@ -0,0 +1,428 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+  @test %W% %E%
+  @bug 6829858
+  @summary Mixing should work inside heavyweight containers
+  @author anthony.petrov@sun.com: area=awt.mixing
+  @library ../regtesthelpers
+  @build Util
+  @run main MixingInHwPanel
+*/
+
+
+/**
+ * MixingInHwPanel.java
+ *
+ * summary: Mixing should work inside heavyweight containers
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import test.java.awt.regtesthelpers.Util;
+
+
+
+public class MixingInHwPanel
+{
+    static volatile boolean failed = true;
+
+    private static void init()
+    {
+        //*** Create instructions for the user here ***
+
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        // Create the components: frame -> hwPanel -> JDesktopPane ->
+        //    -> JInternalFrame -> hwButton
+        Frame frame = new Frame("Mixing in a heavyweight Panel");
+        frame.setBounds(100, 100, 640, 480);
+
+        Panel hwPanel = new Panel(new BorderLayout());
+        frame.add(hwPanel);
+
+        JDesktopPane desktop = new JDesktopPane();
+        hwPanel.add(desktop);
+
+        JInternalFrame iFrame = new JInternalFrame("one",
+                true, true, true, true);
+        iFrame.setPreferredSize(new Dimension(150, 55));
+        iFrame.setBounds(600, 100, 150, 55);
+        iFrame.setVisible(true);
+        desktop.add(iFrame);
+
+        Button button = new Button("HW Button");
+        button.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                failed = false;
+            }
+        });
+        iFrame.add(button);
+
+        // Show the frame with the hwButton slightly hidden initially
+        frame.setVisible(true);
+
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(20);
+
+        Util.waitForIdle(robot);
+
+        // Now resize the frame so that the button is fully visible
+        frame.setBounds(100, 100, 800, 480);
+        frame.validate();
+
+        Util.waitForIdle(robot);
+
+        // And click the part of the button that has been previously hidden
+        Point bLoc = button.getLocationOnScreen();
+        robot.mouseMove(bLoc.x + button.getWidth() - 6, bLoc.y + button.getHeight() / 2);
+
+        Util.waitForIdle(robot);
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        Util.waitForIdle(robot);
+
+        // If the click happens (the shape is reapplied), the button's action
+        // listener will make failed == false.
+        if (failed) {
+            MixingInHwPanel.fail("The HW button did not receive the click.");
+        } else {
+            MixingInHwPanel.pass();
+        }
+    }//End  init()
+
+
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class MixingInHwPanel
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+   static int newVar = 0;
+
+   public void eventDispatched(AWTEvent e)
+    {
+      //Counting events to see if we get enough
+      eventCount++;
+
+      if( eventCount == 20 )
+       {
+         //got enough events, so pass
+
+         MixingInHwPanel.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         MixingInHwPanel.fail();
+       }
+
+    }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java	Tue Apr 28 13:30:42 2009 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test %I% %E%
+ * @bug 6683728
+ * @summary Tests that a JApplet in a translucent JFrame works properly
+ * @author Kenneth.Russell@sun.com: area=Graphics
+ * @compile -XDignore.symbol.file=true TranslucentJAppletTest.java
+ * @run main/manual/othervm TranslucentJAppletTest
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+import javax.swing.*;
+
+public class TranslucentJAppletTest {
+
+    private static JFrame frame;
+    private static volatile boolean paintComponentCalled = false;
+
+    private static void initAndShowGUI() {
+        frame = new JFrame();
+        JApplet applet = new JApplet();
+        JPanel panel = new JPanel() {
+            protected void paintComponent(Graphics g) {
+                paintComponentCalled = true;
+                g.setColor(Color.RED);
+                g.fillOval(0, 0, getWidth(), getHeight());
+            }
+        };
+        panel.setDoubleBuffered(false);
+        panel.setOpaque(false);
+        applet.add(panel);
+        frame.add(applet);
+        frame.setBounds(100, 100, 200, 200);
+        frame.setUndecorated(true);
+        frame.setBackground(new Color(0, 0, 0, 0));
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args)
+        throws Exception
+    {
+        sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
+
+        Robot r = new Robot();
+        Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                initAndShowGUI();
+            }
+        });
+        tk.realSync();
+
+        if (!paintComponentCalled) {
+            throw new RuntimeException("Test FAILED: panel's paintComponent() method is not called");
+        }
+
+        Color newColor1 = r.getPixelColor(100, 100);
+        // unfortunately, robot.getPixelColor() doesn't work for some unknown reason
+        // Color newColor2 = r.getPixelColor(200, 200);
+        BufferedImage bim = r.createScreenCapture(new Rectangle(200, 200, 1, 1));
+        Color newColor2 = new Color(bim.getRGB(0, 0));
+
+        // Frame must be transparent at (100, 100) in screen coords
+        if (!color1.equals(newColor1)) {
+            System.err.println("color1 = " + color1);
+            System.err.println("newColor1 = " + newColor1);
+            throw new RuntimeException("Test FAILED: frame pixel at (0, 0) is not transparent");
+        }
+
+        // Frame must be RED at (200, 200) in screen coords
+        if (!newColor2.equals(Color.RED)) {
+            System.err.println("newColor2 = " + newColor2);
+            throw new RuntimeException("Test FAILED: frame pixel at (100, 100) is not red (transparent?)");
+        }
+
+        System.out.println("Test PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/TranslucentShapedFrameTest/TSFrame.java	Tue Apr 28 13:30:42 2009 -0700
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsDevice.WindowTranslucency;
+import java.awt.GraphicsEnvironment;
+import java.awt.RenderingHints;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.Canvas;
+import java.awt.Component;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.util.Random;
+import java.awt.geom.Ellipse2D;
+import javax.swing.JApplet;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+public class TSFrame {
+
+    static volatile boolean done = false;
+
+    static final boolean useSwing = System.getProperty("useswing") != null;
+    static final boolean useShape = System.getProperty("useshape") != null;
+    static final boolean useTransl = System.getProperty("usetransl") != null;
+    static final boolean useNonOpaque = System.getProperty("usenonop") != null;
+
+    static final Random rnd = new Random();
+    private static void render(Graphics g, int w, int h, boolean useNonOpaque) {
+        if (useNonOpaque) {
+            Graphics2D g2d = (Graphics2D)g;
+            GradientPaint p =
+                new GradientPaint(0.0f, 0.0f,
+                                  new Color(rnd.nextInt(0xffffff)),
+                                  w, h,
+                                  new Color(rnd.nextInt(0xff),
+                                            rnd.nextInt(0xff),
+                                            rnd.nextInt(0xff), 0),
+                                  true);
+            g2d.setPaint(p);
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                 RenderingHints.VALUE_ANTIALIAS_ON);
+            g2d.fillOval(0, 0, w, h);
+        } else {
+            g.setColor(new Color(rnd.nextInt(0xffffff)));
+            g.fillRect(0, 0, w, h);
+        }
+    }
+
+    private static class MyCanvas extends Canvas {
+        @Override
+        public void paint(Graphics g) {
+            render(g, getWidth(), getHeight(), false);
+        }
+        @Override
+        public Dimension getPreferredSize() {
+            return new Dimension(200, 100);
+        }
+    }
+    private static class NonOpaqueJFrame extends JFrame {
+        NonOpaqueJFrame() {
+            super("NonOpaque Swing JFrame");
+            JPanel p = new JPanel() {
+                public void paintComponent(Graphics g) {
+                    super.paintComponent(g);
+                    render(g, getWidth(), getHeight(), true);
+                    g.setColor(Color.red);
+                    g.drawString("Non-Opaque Swing JFrame", 10, 15);
+                }
+            };
+            p.setDoubleBuffered(false);
+            p.setOpaque(false);
+            add(p);
+            setUndecorated(true);
+        }
+    }
+    private static class NonOpaqueJAppletFrame extends JFrame {
+        JPanel p;
+        NonOpaqueJAppletFrame() {
+            super("NonOpaque Swing JAppletFrame");
+            JApplet ja = new JApplet() {
+                public void paint(Graphics g) {
+                    super.paint(g);
+                    System.err.println("JAppletFrame paint called");
+                }
+            };
+            p = new JPanel() {
+                public void paintComponent(Graphics g) {
+                    super.paintComponent(g);
+                    render(g, getWidth(), getHeight(), true);
+                    g.setColor(Color.red);
+                    g.drawString("Non-Opaque Swing JFrame", 10, 15);
+                }
+            };
+            p.setDoubleBuffered(false);
+            p.setOpaque(false);
+            ja.add(p);
+            add(ja);
+            setUndecorated(true);
+        }
+    }
+    private static class NonOpaqueFrame extends Frame {
+        NonOpaqueFrame() {
+            super("NonOpaque AWT Frame");
+            // uncomment to test with hw child
+//            setLayout(null);
+//            Component c = new Panel() {
+//                public void paint(Graphics g) {
+//                    g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.5f));
+//                    g.fillRect(0, 0, getWidth(), getHeight());
+//                }
+//            };
+//            c.setSize(100, 100);
+//            c.setBackground(Color.red);
+//            c.setForeground(Color.red);
+//            add(c);
+//            c.setLocation(130, 130);
+        }
+        @Override
+        public void paint(Graphics g) {
+            render(g, getWidth(), getHeight(), true);
+            g.setColor(Color.red);
+            g.drawString("Non-Opaque AWT Frame", 10, 15);
+        }
+    }
+
+    private static class MyJPanel extends JPanel {
+        @Override
+        public void paintComponent(Graphics g) {
+            render(g, getWidth(), getHeight(), false);
+        }
+    }
+
+    public static Frame createGui(
+                                  final boolean useSwing,
+                                  final boolean useShape,
+                                  final boolean useTransl,
+                                  final boolean useNonOpaque,
+                                  final float factor)
+    {
+        Frame frame;
+        done = false;
+
+        if (useNonOpaque) {
+            if (useSwing) {
+                frame = new NonOpaqueJFrame();
+//                frame = new NonOpaqueJAppletFrame(gc);
+            } else {
+                frame = new NonOpaqueFrame();
+            }
+            animateComponent(frame);
+        } else if (useSwing) {
+            frame = new JFrame("Swing Frame");
+            JComponent p = new JButton("Swing!");
+            p.setPreferredSize(new Dimension(200, 100));
+            frame.add("North", p);
+            p = new MyJPanel();
+            animateComponent(p);
+            frame.add("Center", p);
+        } else {
+            frame = new Frame("AWT Frame") {
+                public void paint(Graphics g) {
+                    g.setColor(Color.red);
+                    g.fillRect(0, 0, 100, 100);
+                }
+            };
+            frame.setLayout(new BorderLayout());
+            Canvas c = new MyCanvas();
+            frame.add("North", c);
+            animateComponent(c);
+            c = new MyCanvas();
+            frame.add("Center", c);
+            animateComponent(c);
+            c = new MyCanvas();
+            frame.add("South", c);
+            animateComponent(c);
+        }
+        final Frame finalFrame = frame;
+        frame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                finalFrame.dispose();
+                done = true;
+            }
+        });
+        frame.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                finalFrame.dispose();
+                done = true;
+            }
+        });
+        frame.setPreferredSize(new Dimension(800, 600));
+
+        if (useShape) {
+            frame.setUndecorated(true);
+        }
+
+        frame.setLocation(450, 10);
+        frame.pack();
+
+        GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
+        if (useShape) {
+            if (gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
+                System.out.println("applying PERPIXEL_TRANSPARENT");
+                frame.setShape(new Ellipse2D.Double(0, 0, frame.getWidth(),
+                                                    frame.getHeight()/3));
+                frame.setTitle("PERPIXEL_TRANSPARENT");
+            } else {
+                System.out.println("Passed: PERPIXEL_TRANSPARENT unsupported");
+            }
+        }
+        if (useTransl) {
+            if (gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
+                System.out.println("applying TRANSLUCENT");
+                frame.setOpacity(factor);
+                frame.setTitle("TRANSLUCENT");
+            } else {
+                System.out.println("Passed: TRANSLUCENT unsupported");
+            }
+        }
+        if (useNonOpaque) {
+            if (gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
+                System.out.println("applying PERPIXEL_TRANSLUCENT");
+                frame.setBackground(new Color(0, 0, 0, 0));
+                frame.setTitle("PERPIXEL_TRANSLUCENT");
+            } else {
+                System.out.println("Passed: PERPIXEL_TRANSLUCENT unsupported");
+            }
+        }
+        frame.setVisible(true);
+        return frame;
+    }
+
+    public static void stopThreads() {
+        done = true;
+    }
+
+    private static void animateComponent(final Component comp) {
+        Thread t = new Thread(new Runnable() {
+            public void run() {
+                do {
+                    try {
+                        Thread.sleep(50);
+                    } catch (InterruptedException ex) {}
+                    comp.repaint();
+                } while (!done);
+            }
+        });
+        t.start();
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                TSFrame.createGui(useSwing,
+                                  useShape,
+                                  useTransl,
+                                  useNonOpaque,
+                                  0.7f);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form	Tue Apr 28 13:30:42 2009 -0700
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+  <NonVisualComponents>
+    <Component class="javax.swing.ButtonGroup" name="createDisposeGrp">
+    </Component>
+  </NonVisualComponents>
+  <Properties>
+    <Property name="defaultCloseOperation" type="int" value="3"/>
+    <Property name="title" type="java.lang.String" value="TranslucentShapedFrameTest"/>
+  </Properties>
+  <SyntheticProperties>
+    <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+  </SyntheticProperties>
+  <AuxValues>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="0" attributes="0">
+                      <Component id="transparencySld" pref="375" max="32767" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                  </Group>
+                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
+                  <Group type="102" alignment="0" attributes="0">
+                      <Component id="shapedCb" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="nonOpaqueChb" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="useSwingCb" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace pref="102" max="32767" attributes="0"/>
+                  </Group>
+                  <Group type="102" alignment="0" attributes="0">
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Group type="102" alignment="0" attributes="0">
+                              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace pref="314" max="-2" attributes="0"/>
+                          </Group>
+                          <Group type="102" alignment="0" attributes="0">
+                              <Component id="passedBtn" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace max="-2" attributes="0"/>
+                              <Component id="failedBtn" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace pref="241" max="-2" attributes="0"/>
+                          </Group>
+                          <Component id="jScrollPane1" alignment="1" pref="375" max="32767" attributes="0"/>
+                          <Group type="102" alignment="0" attributes="0">
+                              <Component id="createFrameBtn" min="-2" pref="187" max="-2" attributes="0"/>
+                              <EmptySpace max="-2" attributes="0"/>
+                              <Component id="disposeFrameBtn" min="-2" pref="182" max="-2" attributes="0"/>
+                          </Group>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
+                  </Group>
+              </Group>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="transparencySld" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="shapedCb" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="nonOpaqueChb" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="useSwingCb" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="disposeFrameBtn" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="createFrameBtn" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
+              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jScrollPane1" min="-2" pref="148" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="passedBtn" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="failedBtn" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace max="32767" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JLabel" name="jLabel1">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Frame Opacity:"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JSlider" name="transparencySld">
+      <Properties>
+        <Property name="majorTickSpacing" type="int" value="10"/>
+        <Property name="minorTickSpacing" type="int" value="5"/>
+        <Property name="paintLabels" type="boolean" value="true"/>
+        <Property name="paintTicks" type="boolean" value="true"/>
+        <Property name="value" type="int" value="100"/>
+      </Properties>
+      <Events>
+        <EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="transparencySldStateChanged"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JCheckBox" name="shapedCb">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Shaped Frame"/>
+        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+          </Border>
+        </Property>
+        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+          <Insets value="[0, 0, 0, 0]"/>
+        </Property>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="shapedCbActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JCheckBox" name="nonOpaqueChb">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Non Opaque Frame"/>
+        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+          </Border>
+        </Property>
+        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+          <Insets value="[0, 0, 0, 0]"/>
+        </Property>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nonOpaqueChbActionPerformed"/>
+      </Events>
+    </Component>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JTextArea" name="jTextArea1">
+          <Properties>
+            <Property name="columns" type="int" value="20"/>
+            <Property name="rows" type="int" value="5"/>
+            <Property name="text" type="java.lang.String" value="Create translucent and/or shaped, or&#xa;non-opaque frame. Make sure it behaves&#xa;correctly (no artifacts left on the screen&#xa;when dragging - if dragging is possible).&#xa;Click &quot;Passed&quot; if the test behaves correctly,&#xa;&quot;Falied&quot; otherwise."/>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JLabel" name="jLabel2">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Instructions:"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JButton" name="passedBtn">
+      <Properties>
+        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+          <Color blue="64" green="ff" red="81" type="rgb"/>
+        </Property>
+        <Property name="text" type="java.lang.String" value="Passed"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="passedBtnActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="failedBtn">
+      <Properties>
+        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+          <Color blue="0" green="0" id="red" palette="1" red="ff" type="palette"/>
+        </Property>
+        <Property name="text" type="java.lang.String" value="Failed"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="failedBtnActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JToggleButton" name="createFrameBtn">
+      <Properties>
+        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+          <ComponentRef name="createDisposeGrp"/>
+        </Property>
+        <Property name="text" type="java.lang.String" value="Create Frame"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createFrameBtnActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JToggleButton" name="disposeFrameBtn">
+      <Properties>
+        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+          <ComponentRef name="createDisposeGrp"/>
+        </Property>
+        <Property name="selected" type="boolean" value="true"/>
+        <Property name="text" type="java.lang.String" value="Dispose Frame"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="disposeFrameBtnActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JCheckBox" name="useSwingCb">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Use JFrame"/>
+        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+          <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+            <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+          </Border>
+        </Property>
+        <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+          <Insets value="[0, 0, 0, 0]"/>
+        </Property>
+      </Properties>
+    </Component>
+  </SubComponents>
+</Form>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java	Tue Apr 28 13:30:42 2009 -0700
@@ -0,0 +1,339 @@
+/*
+ * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test %I% %E%
+ * @bug 6655001 6670649 6687141
+ * @summary Tests that hw acceleration doesn't affect translucent/shaped windows
+ * @author Dmitri.Trembovetski@sun.com: area=Graphics
+ * @compile -XDignore.symbol.file=true TranslucentShapedFrameTest.java
+ * @compile -XDignore.symbol.file=true TSFrame.java
+ * @run main/manual/othervm TranslucentShapedFrameTest
+ * @run main/manual/othervm -Dsun.java2d.noddraw=true TranslucentShapedFrameTest
+ * @run main/manual/othervm -Dsun.java2d.opengl=True TranslucentShapedFrameTest
+ */
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsDevice.WindowTranslucency;
+import java.awt.GraphicsEnvironment;
+import java.awt.Shape;
+import java.awt.geom.Ellipse2D;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class TranslucentShapedFrameTest extends javax.swing.JFrame {
+    Frame testFrame;
+    static CountDownLatch done;
+    static volatile boolean failed = false;
+    GraphicsConfiguration gcToUse = null;
+
+    /**
+     * Creates new form TranslucentShapedFrameTest
+     */
+    public TranslucentShapedFrameTest() {
+        // not necessary, but we just look nicer
+        try {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        } catch (Exception ex) {}
+
+        initComponents();
+        checkEffects();
+
+        SwingUtilities.updateComponentTreeUI(this);
+    }
+
+    /** This method is called from within the constructor to
+     * initialize the form.
+     * WARNING: Do NOT modify this code. The content of this method is
+     * always regenerated by the Form Editor.
+     */
+    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+    private void initComponents() {
+        createDisposeGrp = new javax.swing.ButtonGroup();
+        jLabel1 = new javax.swing.JLabel();
+        transparencySld = new javax.swing.JSlider();
+        shapedCb = new javax.swing.JCheckBox();
+        nonOpaqueChb = new javax.swing.JCheckBox();
+        jScrollPane1 = new javax.swing.JScrollPane();
+        jTextArea1 = new javax.swing.JTextArea();
+        jLabel2 = new javax.swing.JLabel();
+        passedBtn = new javax.swing.JButton();
+        failedBtn = new javax.swing.JButton();
+        createFrameBtn = new javax.swing.JToggleButton();
+        disposeFrameBtn = new javax.swing.JToggleButton();
+        useSwingCb = new javax.swing.JCheckBox();
+
+        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+        setTitle("TranslucentShapedFrameTest");
+        jLabel1.setText("Frame Opacity:");
+
+        transparencySld.setMajorTickSpacing(10);
+        transparencySld.setMinorTickSpacing(5);
+        transparencySld.setPaintLabels(true);
+        transparencySld.setPaintTicks(true);
+        transparencySld.setValue(100);
+        transparencySld.addChangeListener(new javax.swing.event.ChangeListener() {
+            public void stateChanged(javax.swing.event.ChangeEvent evt) {
+                transparencySldStateChanged(evt);
+            }
+        });
+
+        shapedCb.setText("Shaped Frame");
+        shapedCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+        shapedCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
+        shapedCb.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                shapedCbActionPerformed(evt);
+            }
+        });
+
+        nonOpaqueChb.setText("Non Opaque Frame");
+        nonOpaqueChb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+        nonOpaqueChb.setMargin(new java.awt.Insets(0, 0, 0, 0));
+        nonOpaqueChb.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                nonOpaqueChbActionPerformed(evt);
+            }
+        });
+
+        jTextArea1.setColumns(20);
+        jTextArea1.setRows(5);
+        jTextArea1.setText("Create translucent and/or shaped, or\nnon-opaque frame. Make sure it behaves\ncorrectly (no artifacts left on the screen\nwhen dragging - if dragging is possible).\nClick \"Passed\" if the test behaves correctly,\n\"Falied\" otherwise.");
+        jScrollPane1.setViewportView(jTextArea1);
+
+        jLabel2.setText("Instructions:");
+
+        passedBtn.setBackground(new Color(129, 255, 100));
+        passedBtn.setText("Passed");
+        passedBtn.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                passedBtnActionPerformed(evt);
+            }
+        });
+
+        failedBtn.setBackground(Color.red);
+        failedBtn.setText("Failed");
+        failedBtn.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                failedBtnActionPerformed(evt);
+            }
+        });
+
+        createDisposeGrp.add(createFrameBtn);
+        createFrameBtn.setText("Create Frame");
+        createFrameBtn.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                createFrameBtnActionPerformed(evt);
+            }
+        });
+
+        createDisposeGrp.add(disposeFrameBtn);
+        disposeFrameBtn.setSelected(true);
+        disposeFrameBtn.setText("Dispose Frame");
+        disposeFrameBtn.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                disposeFrameBtnActionPerformed(evt);
+            }
+        });
+
+        useSwingCb.setText("Use JFrame");
+        useSwingCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+        useSwingCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
+
+        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+        getContentPane().setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(transparencySld, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
+                        .addContainerGap())
+                    .addComponent(jLabel1)
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(shapedCb)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(nonOpaqueChb)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(useSwingCb)
+                        .addContainerGap(102, Short.MAX_VALUE))
+                    .addGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addGroup(layout.createSequentialGroup()
+                                .addComponent(jLabel2)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 314, javax.swing.GroupLayout.PREFERRED_SIZE))
+                            .addGroup(layout.createSequentialGroup()
+                                .addComponent(passedBtn)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                .addComponent(failedBtn)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
+                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
+                            .addGroup(layout.createSequentialGroup()
+                                .addComponent(createFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                .addComponent(disposeFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
+                        .addContainerGap())))
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap()
+                .addComponent(jLabel1)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(transparencySld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(shapedCb)
+                    .addComponent(nonOpaqueChb)
+                    .addComponent(useSwingCb))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(disposeFrameBtn)
+                    .addComponent(createFrameBtn))
+                .addGap(17, 17, 17)
+                .addComponent(jLabel2)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(passedBtn)
+                    .addComponent(failedBtn))
+                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+        );
+        pack();
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void nonOpaqueChbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nonOpaqueChbActionPerformed
+        if (testFrame != null) {
+            // REMIND: this path in the test doesn't work well (test bug)
+            testFrame.setBackground(new Color(0, 0, 0, nonOpaqueChb.isSelected() ? 0 : 255));
+        }
+    }//GEN-LAST:event_nonOpaqueChbActionPerformed
+
+    private void shapedCbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shapedCbActionPerformed
+        if (testFrame != null) {
+            Shape s = null;
+            if (shapedCb.isSelected()) {
+                s = new Ellipse2D.Double(0, 0,
+                                         testFrame.getWidth(),
+                                         testFrame.getHeight());
+            }
+            testFrame.setShape(s);
+        }
+    }//GEN-LAST:event_shapedCbActionPerformed
+
+    private void transparencySldStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_transparencySldStateChanged
+        JSlider source = (JSlider)evt.getSource();
+            int transl = transparencySld.getValue();
+            if (testFrame != null) {
+                testFrame.setOpacity((float)transl/100f);
+            }
+    }//GEN-LAST:event_transparencySldStateChanged
+
+    private void failedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_failedBtnActionPerformed
+        disposeFrameBtnActionPerformed(evt);
+        dispose();
+        failed = true;
+        done.countDown();
+    }//GEN-LAST:event_failedBtnActionPerformed
+
+    private void disposeFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disposeFrameBtnActionPerformed
+        TSFrame.stopThreads();
+        if (testFrame != null) {
+            testFrame.dispose();
+            testFrame = null;
+        }
+    }//GEN-LAST:event_disposeFrameBtnActionPerformed
+
+    private void createFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createFrameBtnActionPerformed
+        disposeFrameBtnActionPerformed(evt);
+        int transl = transparencySld.getValue();
+        testFrame = TSFrame.createGui(
+                useSwingCb.isSelected(), shapedCb.isSelected(),
+                (transl < 100), nonOpaqueChb.isSelected(),
+                (float)transl/100f);
+    }//GEN-LAST:event_createFrameBtnActionPerformed
+
+    private void passedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passedBtnActionPerformed
+        disposeFrameBtnActionPerformed(evt);
+        dispose();
+        done.countDown();
+    }//GEN-LAST:event_passedBtnActionPerformed
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String args[]) {
+        done = new CountDownLatch(1);
+        java.awt.EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                new TranslucentShapedFrameTest().setVisible(true);
+            }
+        });
+        try {
+            done.await();
+        } catch (InterruptedException ex) {}
+        if (failed) {
+            throw new RuntimeException("Test FAILED");
+        }
+        System.out.println("Test PASSED");
+    }
+
+    private void checkEffects() {
+        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
+        if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
+            shapedCb.setEnabled(false);
+        }
+        if (!gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
+            transparencySld.setEnabled(false);
+        }
+        if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
+            nonOpaqueChb.setEnabled(false);
+        }
+    }
+
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.ButtonGroup createDisposeGrp;
+    private javax.swing.JToggleButton createFrameBtn;
+    private javax.swing.JToggleButton disposeFrameBtn;
+    private javax.swing.JButton failedBtn;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JLabel jLabel2;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JTextArea jTextArea1;
+    private javax.swing.JCheckBox nonOpaqueChb;
+    private javax.swing.JButton passedBtn;
+    private javax.swing.JCheckBox shapedCb;
+    private javax.swing.JSlider transparencySld;
+    private javax.swing.JCheckBox useSwingCb;
+    // End of variables declaration//GEN-END:variables
+
+}