changeset 3084:5fc778c913e7

Merge
author lana
date Tue, 30 Nov 2010 14:50:04 -0800
parents f81c37805b5b 357ecafd727b
children 88308d3affa0
files
diffstat 21 files changed, 510 insertions(+), 112 deletions(-) [+]
line wrap: on
line diff
--- a/make/sun/xawt/mapfile-vers	Tue Nov 30 14:49:26 2010 -0800
+++ b/make/sun/xawt/mapfile-vers	Tue Nov 30 14:50:04 2010 -0800
@@ -432,6 +432,7 @@
         Java_sun_awt_X11_GtkFileDialogPeer_initIDs;
         Java_sun_awt_X11_GtkFileDialogPeer_run;
         Java_sun_awt_X11_GtkFileDialogPeer_quit;
+        Java_sun_awt_X11_GtkFileDialogPeer_toFront;
 
 	Java_sun_print_CUPSPrinter_initIDs;
 	Java_sun_print_CUPSPrinter_getCupsServer;
--- a/src/share/classes/java/awt/Color.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/java/awt/Color.java	Tue Nov 30 14:50:04 2010 -0800
@@ -611,12 +611,15 @@
      * <p>
      * This method applies an arbitrary scale factor to each of the three RGB
      * components of this <code>Color</code> to create a brighter version
-     * of this <code>Color</code>. Although <code>brighter</code> and
+     * of this <code>Color</code>.
+     * The {@code alpha} value is preserved.
+     * Although <code>brighter</code> and
      * <code>darker</code> are inverse operations, the results of a
      * series of invocations of these two methods might be inconsistent
      * because of rounding errors.
      * @return     a new <code>Color</code> object that is
-     *                 a brighter version of this <code>Color</code>.
+     *                 a brighter version of this <code>Color</code>
+     *                 with the same {@code alpha} value.
      * @see        java.awt.Color#darker
      * @since      JDK1.0
      */
@@ -624,6 +627,7 @@
         int r = getRed();
         int g = getGreen();
         int b = getBlue();
+        int alpha = getAlpha();
 
         /* From 2D group:
          * 1. black.brighter() should return grey
@@ -632,7 +636,7 @@
          */
         int i = (int)(1.0/(1.0-FACTOR));
         if ( r == 0 && g == 0 && b == 0) {
-           return new Color(i, i, i);
+            return new Color(i, i, i, alpha);
         }
         if ( r > 0 && r < i ) r = i;
         if ( g > 0 && g < i ) g = i;
@@ -640,7 +644,8 @@
 
         return new Color(Math.min((int)(r/FACTOR), 255),
                          Math.min((int)(g/FACTOR), 255),
-                         Math.min((int)(b/FACTOR), 255));
+                         Math.min((int)(b/FACTOR), 255),
+                         alpha);
     }
 
     /**
@@ -649,19 +654,23 @@
      * <p>
      * This method applies an arbitrary scale factor to each of the three RGB
      * components of this <code>Color</code> to create a darker version of
-     * this <code>Color</code>.  Although <code>brighter</code> and
+     * this <code>Color</code>.
+     * The {@code alpha} value is preserved.
+     * Although <code>brighter</code> and
      * <code>darker</code> are inverse operations, the results of a series
      * of invocations of these two methods might be inconsistent because
      * of rounding errors.
      * @return  a new <code>Color</code> object that is
-     *                    a darker version of this <code>Color</code>.
+     *                    a darker version of this <code>Color</code>
+     *                    with the same {@code alpha} value.
      * @see        java.awt.Color#brighter
      * @since      JDK1.0
      */
     public Color darker() {
         return new Color(Math.max((int)(getRed()  *FACTOR), 0),
                          Math.max((int)(getGreen()*FACTOR), 0),
-                         Math.max((int)(getBlue() *FACTOR), 0));
+                         Math.max((int)(getBlue() *FACTOR), 0),
+                         getAlpha());
     }
 
     /**
--- a/src/share/classes/java/awt/Container.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/java/awt/Container.java	Tue Nov 30 14:50:04 2010 -0800
@@ -51,6 +51,7 @@
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.AppContext;
+import sun.awt.AWTAccessor;
 import sun.awt.CausedFocusEvent;
 import sun.awt.PeerEvent;
 import sun.awt.SunToolkit;
@@ -247,6 +248,13 @@
         if (!GraphicsEnvironment.isHeadless()) {
             initIDs();
         }
+
+        AWTAccessor.setContainerAccessor(new AWTAccessor.ContainerAccessor() {
+            @Override
+            public void validateUnconditionally(Container cont) {
+                cont.validateUnconditionally();
+            }
+        });
     }
 
     /**
--- a/src/share/classes/java/awt/Dialog.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/java/awt/Dialog.java	Tue Nov 30 14:50:04 2010 -0800
@@ -1248,14 +1248,31 @@
 
     /**
      * Disables or enables decorations for this dialog.
-     * This method can only be called while the dialog is not displayable.
-     * @param  undecorated <code>true</code> if no dialog decorations are
-     *         to be enabled;
-     *         <code>false</code> if dialog decorations are to be enabled.
-     * @throws <code>IllegalComponentStateException</code> if the dialog
-     *         is displayable.
+     * <p>
+     * This method can only be called while the dialog is not displayable. To
+     * make this dialog decorated, it must be opaque and have the default shape,
+     * otherwise the {@code IllegalComponentStateException} will be thrown.
+     * Refer to {@link Window#setShape}, {@link Window#setOpacity} and {@link
+     * Window#setBackground} for details
+     *
+     * @param  undecorated {@code true} if no dialog decorations are to be
+     *         enabled; {@code false} if dialog decorations are to be enabled
+     *
+     * @throws IllegalComponentStateException if the dialog is displayable
+     * @throws IllegalComponentStateException if {@code undecorated} is
+     *      {@code false}, and this dialog does not have the default shape
+     * @throws IllegalComponentStateException if {@code undecorated} is
+     *      {@code false}, and this dialog opacity is less than {@code 1.0f}
+     * @throws IllegalComponentStateException if {@code undecorated} is
+     *      {@code false}, and the alpha value of this dialog background
+     *      color is less than {@code 1.0f}
+     *
      * @see    #isUndecorated
      * @see    Component#isDisplayable
+     * @see    Window#getShape
+     * @see    Window#getOpacity
+     * @see    Window#getBackground
+     *
      * @since 1.4
      */
     public void setUndecorated(boolean undecorated) {
@@ -1264,6 +1281,18 @@
             if (isDisplayable()) {
                 throw new IllegalComponentStateException("The dialog is displayable.");
             }
+            if (!undecorated) {
+                if (getOpacity() < 1.0f) {
+                    throw new IllegalComponentStateException("The dialog is not opaque");
+                }
+                if (getShape() != null) {
+                    throw new IllegalComponentStateException("The dialog does not have a default shape");
+                }
+                Color bg = getBackground();
+                if ((bg != null) && (bg.getAlpha() < 255)) {
+                    throw new IllegalComponentStateException("The dialog background color is not opaque");
+                }
+            }
             this.undecorated = undecorated;
         }
     }
@@ -1281,6 +1310,45 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setOpacity(float opacity) {
+        synchronized (getTreeLock()) {
+            if ((opacity < 1.0f) && !isUndecorated()) {
+                throw new IllegalComponentStateException("The dialog is decorated");
+            }
+            super.setOpacity(opacity);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setShape(Shape shape) {
+        synchronized (getTreeLock()) {
+            if ((shape != null) && !isUndecorated()) {
+                throw new IllegalComponentStateException("The dialog is decorated");
+            }
+            super.setShape(shape);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setBackground(Color bgColor) {
+        synchronized (getTreeLock()) {
+            if ((bgColor != null) && (bgColor.getAlpha() < 255) && !isUndecorated()) {
+                throw new IllegalComponentStateException("The dialog is decorated");
+            }
+            super.setBackground(bgColor);
+        }
+    }
+
+    /**
      * Returns a string representing the state of this dialog. This
      * method is intended to be used only for debugging purposes, and the
      * content and format of the returned string may vary between
--- a/src/share/classes/java/awt/FileDialog.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/java/awt/FileDialog.java	Tue Nov 30 14:50:04 2010 -0800
@@ -99,7 +99,7 @@
      * Contains the File instances for all the files that the user selects.
      *
      * @serial
-     * @see getFiles
+     * @see #getFiles
      * @since 1.7
      */
     private File[] files;
--- a/src/share/classes/java/awt/Frame.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/java/awt/Frame.java	Tue Nov 30 14:50:04 2010 -0800
@@ -828,6 +828,11 @@
                         return frame.state;
                     }
                 }
+                public Rectangle getMaximizedBounds(Frame frame) {
+                    synchronized(frame.getObjectLock()) {
+                        return frame.maximizedBounds;
+                    }
+                }
             }
         );
     }
@@ -855,8 +860,10 @@
      * @see #getMaximizedBounds()
      * @since 1.4
      */
-    public synchronized void setMaximizedBounds(Rectangle bounds) {
-        this.maximizedBounds = bounds;
+    public void setMaximizedBounds(Rectangle bounds) {
+        synchronized(getObjectLock()) {
+            this.maximizedBounds = bounds;
+        }
         FramePeer peer = (FramePeer)this.peer;
         if (peer != null) {
             peer.setMaximizedBounds(bounds);
@@ -873,21 +880,40 @@
      * @since   1.4
      */
     public Rectangle getMaximizedBounds() {
-        return maximizedBounds;
+        synchronized(getObjectLock()) {
+            return maximizedBounds;
+        }
     }
 
 
     /**
      * Disables or enables decorations for this frame.
-     * This method can only be called while the frame is not displayable.
-     * @param  undecorated <code>true</code> if no frame decorations are
-     *         to be enabled;
-     *         <code>false</code> if frame decorations are to be enabled.
-     * @throws <code>IllegalComponentStateException</code> if the frame
-     *         is displayable.
+     * <p>
+     * This method can only be called while the frame is not displayable. To
+     * make this frame decorated, it must be opaque and have the default shape,
+     * otherwise the {@code IllegalComponentStateException} will be thrown.
+     * Refer to {@link Window#setShape}, {@link Window#setOpacity} and {@link
+     * Window#setBackground} for details
+     *
+     * @param  undecorated {@code true} if no frame decorations are to be
+     *         enabled; {@code false} if frame decorations are to be enabled
+     *
+     * @throws IllegalComponentStateException if the frame is displayable
+     * @throws IllegalComponentStateException if {@code undecorated} is
+     *      {@code false}, and this frame does not have the default shape
+     * @throws IllegalComponentStateException if {@code undecorated} is
+     *      {@code false}, and this frame opacity is less than {@code 1.0f}
+     * @throws IllegalComponentStateException if {@code undecorated} is
+     *      {@code false}, and the alpha value of this frame background
+     *      color is less than {@code 1.0f}
+     *
      * @see    #isUndecorated
      * @see    Component#isDisplayable
+     * @see    Window#getShape
+     * @see    Window#getOpacity
+     * @see    Window#getBackground
      * @see    javax.swing.JFrame#setDefaultLookAndFeelDecorated(boolean)
+     *
      * @since 1.4
      */
     public void setUndecorated(boolean undecorated) {
@@ -896,6 +922,18 @@
             if (isDisplayable()) {
                 throw new IllegalComponentStateException("The frame is displayable.");
             }
+            if (!undecorated) {
+                if (getOpacity() < 1.0f) {
+                    throw new IllegalComponentStateException("The frame is not opaque");
+                }
+                if (getShape() != null) {
+                    throw new IllegalComponentStateException("The frame does not have a default shape");
+                }
+                Color bg = getBackground();
+                if ((bg != null) && (bg.getAlpha() < 255)) {
+                    throw new IllegalComponentStateException("The frame background color is not opaque");
+                }
+            }
             this.undecorated = undecorated;
         }
     }
@@ -913,6 +951,45 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setOpacity(float opacity) {
+        synchronized (getTreeLock()) {
+            if ((opacity < 1.0f) && !isUndecorated()) {
+                throw new IllegalComponentStateException("The frame is decorated");
+            }
+            super.setOpacity(opacity);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setShape(Shape shape) {
+        synchronized (getTreeLock()) {
+            if ((shape != null) && !isUndecorated()) {
+                throw new IllegalComponentStateException("The frame is decorated");
+            }
+            super.setShape(shape);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setBackground(Color bgColor) {
+        synchronized (getTreeLock()) {
+            if ((bgColor != null) && (bgColor.getAlpha() < 255) && !isUndecorated()) {
+                throw new IllegalComponentStateException("The frame is decorated");
+            }
+            super.setBackground(bgColor);
+        }
+    }
+
+    /**
      * Removes the specified menu bar from this frame.
      * @param    m   the menu component to remove.
      *           If <code>m</code> is <code>null</code>, then
--- a/src/share/classes/java/awt/Window.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/java/awt/Window.java	Tue Nov 30 14:50:04 2010 -0800
@@ -3474,14 +3474,20 @@
      * 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(GraphicsDevice.WindowTranslucency)} method must indicate that
-     * the {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
-     * translucency is supported.
+     * The following conditions must be met in order to set the opacity value
+     * less than {@code 1.0f}:
+     * <ul>
+     * <li>The {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
+     * translucency must be supported by the underlying system
+     * <li>The window must be undecorated (see {@link Frame#setUndecorated}
+     * and {@link Dialog#setUndecorated})
+     * <li>The window must not be in full-screen mode (see {@link
+     * GraphicsDevice#setFullScreenWindow(Window)})
+     * </ul>
      * <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.
+     * If the requested opacity value is less than {@code 1.0f}, and any of the
+     * above conditions are not met, the window opacity will not change,
+     * and the {@code IllegalComponentStateException} will be thrown.
      * <p>
      * The translucency levels of individual pixels may also be effected by the
      * alpha component of their color (see {@link Window#setBackground(Color)}) and the
@@ -3491,15 +3497,20 @@
      *
      * @throws IllegalArgumentException if the opacity is out of the range
      *     [0..1]
+     * @throws IllegalComponentStateException if the window is decorated and
+     *     the opacity is less than {@code 1.0f}
      * @throws IllegalComponentStateException if the window is in full screen
-     *     mode, and the opacity is less than 1.0f
+     *     mode, and the opacity is less than {@code 1.0f}
      * @throws UnsupportedOperationException if the {@code
      *     GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
-     *     translucency kind is not supported and the opacity is less than 1.0f
+     *     translucency is not supported and the opacity is less than
+     *     {@code 1.0f}
      *
      * @see Window#getOpacity
      * @see Window#setBackground(Color)
      * @see Window#setShape(Shape)
+     * @see Frame#isUndecorated
+     * @see Dialog#isUndecorated
      * @see GraphicsDevice.WindowTranslucency
      * @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
      *
@@ -3557,24 +3568,26 @@
     /**
      * 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.)
+     * Setting a shape cuts off some parts of the window. Only the parts that
+     * belong to the given {@link Shape} remain visible and clickable. If
+     * the shape argument is {@code null}, this method 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:
+     * The following conditions must be met to set a non-null shape:
      * <ul>
      * <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT
-     * PERPIXEL_TRANSPARENT} translucency kind must be supported by the
+     * PERPIXEL_TRANSPARENT} translucency must be supported by the
      * underlying system
-     * <i>and</i>
-     * <li>The window must not be in the full-screen mode (see
-     * {@link GraphicsDevice#setFullScreenWindow(Window)})
+     * <li>The window must be undecorated (see {@link Frame#setUndecorated}
+     * and {@link Dialog#setUndecorated})
+     * <li>The window must not be in full-screen mode (see {@link
+     * GraphicsDevice#setFullScreenWindow(Window)})
      * </ul>
-     * If a certain condition is not met, either the {@code
-     * UnsupportedOperationException} or {@code IllegalComponentStateException}
-     * is thrown.
+     * <p>
+     * If the requested shape is not {@code null}, and any of the above
+     * conditions are not met, the shape of this window will not change,
+     * and either the {@code UnsupportedOperationException} or {@code
+     * IllegalComponentStateException} will be thrown.
      * <p>
      * The tranlucency levels of individual pixels may also be effected by the
      * alpha component of their color (see {@link Window#setBackground(Color)}) and the
@@ -3584,6 +3597,8 @@
      * @param shape the shape to set to the window
      *
      * @throws IllegalComponentStateException if the shape is not {@code
+     *     null} and the window is decorated
+     * @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
@@ -3592,6 +3607,8 @@
      * @see Window#getShape()
      * @see Window#setBackground(Color)
      * @see Window#setOpacity(float)
+     * @see Frame#isUndecorated
+     * @see Dialog#isUndecorated
      * @see GraphicsDevice.WindowTranslucency
      * @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
      *
@@ -3645,37 +3662,46 @@
      * 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:
+     * this window must be opaque (alpha equals {@code 1.0f}) or per-pixel translucent
+     * (alpha is less than {@code 1.0f}). If the given background color is
+     * {@code null}, the window is considered completely opaque.
+     * <p>
+     * All the following conditions must be met 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
+     * PERPIXEL_TRANSLUCENT} translucency must be supported by the graphics
+     * device where this window is located
+     * <li>The window must be undecorated (see {@link Frame#setUndecorated}
+     * and {@link Dialog#setUndecorated})
+     * <li>The window must not be in full-screen mode (see {@link
      * GraphicsDevice#setFullScreenWindow(Window)})
      * </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>
+     * If the alpha component of the requested background color is less than
+     * {@code 1.0f}, and any of the above conditions are not met, the background
+     * color of this window will not change, the alpha component of the given
+     * background color will not affect the mode of operation for this window,
+     * and either the {@code UnsupportedOperationException} or {@code
+     * IllegalComponentStateException} will be thrown.
      * <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
+     * 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.)
+     * the pixel semi-transparent. In this mode, the background of the window
+     * gets painted with the alpha value of the given background color. If the
+     * alpha value of the argument of this method is equal to {@code 0}, the
+     * background is not painted at all.
      * <p>
      * The actual level of translucency of a given pixel also depends on window
      * opacity (see {@link #setOpacity(float)}), as well as the current shape of
      * this window (see {@link #setShape(Shape)}).
      * <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
+     * Note that painting a pixel with the alpha value of {@code 0} may or may
+     * not disable the mouse event handling on this pixel. This is a
+     * platform-dependent behavior. To make sure the mouse events do not get
      * dispatched to a particular pixel, the pixel must be excluded from the
      * shape of the window.
      * <p>
@@ -3685,17 +3711,21 @@
      * @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
+     *     background color is less than {@code 1.0f} and the window is decorated
+     * @throws IllegalComponentStateException if the alpha value of the given
+     *     background color is less than {@code 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
+     *     background color is less than {@code 1.0f} and {@link
+     *     GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
      *     PERPIXEL_TRANSLUCENT} translucency is not supported
      *
      * @see Window#getBackground
      * @see Window#isOpaque
      * @see Window#setOpacity(float)
      * @see Window#setShape(Shape)
+     * @see Frame#isUndecorated
+     * @see Dialog#isUndecorated
      * @see GraphicsDevice.WindowTranslucency
      * @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
      * @see GraphicsConfiguration#isTranslucencyCapable()
@@ -3739,7 +3769,7 @@
      * <p>
      * The method returns {@code false} if the background color of the window
      * is not {@code null} and the alpha component of the color is less than
-     * 1.0f. The method returns {@code true} otherwise.
+     * {@code 1.0f}. The method returns {@code true} otherwise.
      *
      * @return {@code true} if the window is opaque, {@code false} otherwise
      *
--- a/src/share/classes/sun/awt/AWTAccessor.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/classes/sun/awt/AWTAccessor.java	Tue Nov 30 14:50:04 2010 -0800
@@ -224,6 +224,16 @@
     }
 
     /*
+     * An interface of accessor for the java.awt.Container class.
+     */
+    public interface ContainerAccessor {
+        /**
+         * Validates the container unconditionally.
+         */
+        void validateUnconditionally(Container cont);
+    }
+
+    /*
      * An interface of accessor for java.awt.Window class.
      */
     public interface WindowAccessor {
@@ -334,6 +344,10 @@
          * Gets the state of this frame.
          */
        int getExtendedState(Frame frame);
+        /*
+         * Gets the maximized bounds of this frame.
+         */
+       Rectangle getMaximizedBounds(Frame frame);
     }
 
     /*
@@ -440,53 +454,19 @@
     }
 
     /*
-     * The java.awt.Component class accessor object.
+     * Accessor instances are initialized in the static initializers of
+     * corresponding AWT classes by using setters defined below.
      */
     private static ComponentAccessor componentAccessor;
-
-    /*
-     * The java.awt.Window class accessor object.
-     */
+    private static ContainerAccessor containerAccessor;
     private static WindowAccessor windowAccessor;
-
-    /*
-     * The java.awt.AWTEvent class accessor object.
-     */
     private static AWTEventAccessor awtEventAccessor;
-
-    /*
-     * The java.awt.event.InputEvent class accessor object.
-     */
     private static InputEventAccessor inputEventAccessor;
-
-    /*
-     * The java.awt.Frame class accessor object.
-     */
     private static FrameAccessor frameAccessor;
-
-    /*
-     * The java.awt.KeyboardFocusManager class accessor object.
-     */
     private static KeyboardFocusManagerAccessor kfmAccessor;
-
-    /*
-     * The java.awt.MenuComponent class accessor object.
-     */
     private static MenuComponentAccessor menuComponentAccessor;
-
-    /*
-     * The java.awt.EventQueue class accessor object.
-     */
     private static EventQueueAccessor eventQueueAccessor;
-
-    /*
-     * The java.awt.PopupMenu class accessor object.
-     */
     private static PopupMenuAccessor popupMenuAccessor;
-
-    /*
-     * The java.awt.FileDialog class accessor object.
-     */
     private static FileDialogAccessor fileDialogAccessor;
 
     /*
@@ -497,7 +477,7 @@
     }
 
     /*
-     * Retrieve the accessor object for the java.awt.Window class.
+     * Retrieve the accessor object for the java.awt.Component class.
      */
     public static ComponentAccessor getComponentAccessor() {
         if (componentAccessor == null) {
@@ -508,6 +488,24 @@
     }
 
     /*
+     * Set an accessor object for the java.awt.Container class.
+     */
+    public static void setContainerAccessor(ContainerAccessor ca) {
+        containerAccessor = ca;
+    }
+
+    /*
+     * Retrieve the accessor object for the java.awt.Container class.
+     */
+    public static ContainerAccessor getContainerAccessor() {
+        if (containerAccessor == null) {
+            unsafe.ensureClassInitialized(Container.class);
+        }
+
+        return containerAccessor;
+    }
+
+    /*
      * Set an accessor object for the java.awt.Window class.
      */
     public static void setWindowAccessor(WindowAccessor wa) {
--- a/src/share/demo/applets/NervousText/example1.html	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/share/demo/applets/NervousText/example1.html	Tue Nov 30 14:50:04 2010 -0800
@@ -1,7 +1,7 @@
 <title>Nervous Text 1.1</title>
 <hr>
 <applet code="NervousText.class" width=534 height=50>
-<param name=text value="Java^T^M 2 SDK, Standard Edition 6.0">
+<param name=text value="Java SE Development Kit (JDK) 7.0">
 </applet>
 <hr>
 <a href="NervousText.java">The source.</a>
--- a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Nov 30 14:50:04 2010 -0800
@@ -57,8 +57,11 @@
 
     private native void run(String title, int mode, String dir, String file,
             FilenameFilter filter, boolean isMultipleMode);
+    private native void quit();
 
-    private native void quit();
+    @Override
+    public native void toFront();
+
 
     /**
      * Called exclusively by the native C code.
--- a/src/solaris/classes/sun/awt/X11/XFramePeer.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/solaris/classes/sun/awt/X11/XFramePeer.java	Tue Nov 30 14:50:04 2010 -0800
@@ -150,6 +150,8 @@
 
     void updateChildrenSizes() {
         super.updateChildrenSizes();
+        int height = getMenuBarHeight();
+
         // XWindow.reshape calls XBaseWindow.xSetBounds, which acquires
         // the AWT lock, so we have to acquire the AWT lock here
         // before getStateLock() to avoid a deadlock with the Toolkit thread
@@ -159,7 +161,7 @@
             synchronized(getStateLock()) {
                 int width = dimensions.getClientSize().width;
                 if (menubarPeer != null) {
-                    menubarPeer.reshape(0, 0, width, getMenuBarHeight());
+                    menubarPeer.reshape(0, 0, width, height);
                 }
             }
         } finally {
--- a/src/solaris/native/sun/awt/gtk2_interface.c	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/solaris/native/sun/awt/gtk2_interface.c	Tue Nov 30 14:50:04 2010 -0800
@@ -607,6 +607,7 @@
         fp_gtk_tree_view_new = dl_symbol("gtk_tree_view_new");
         fp_gtk_viewport_new = dl_symbol("gtk_viewport_new");
         fp_gtk_window_new = dl_symbol("gtk_window_new");
+        fp_gtk_window_present = dl_symbol("gtk_window_present");
         fp_gtk_dialog_new = dl_symbol("gtk_dialog_new");
         fp_gtk_frame_new = dl_symbol("gtk_frame_new");
 
--- a/src/solaris/native/sun/awt/gtk2_interface.h	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/solaris/native/sun/awt/gtk2_interface.h	Tue Nov 30 14:50:04 2010 -0800
@@ -749,6 +749,7 @@
 int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
 GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
 void (*fp_gtk_widget_destroy)(GtkWidget *widget);
+void (*fp_gtk_window_present)(GtkWindow *window);
 
 
 /**
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Nov 30 14:50:04 2010 -0800
@@ -80,6 +80,28 @@
     quit(env, jpeer, FALSE);
 }
 
+/*
+ * Class:     sun_awt_X11_GtkFileDialogPeer
+ * Method:    toFront
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
+(JNIEnv * env, jobject jpeer)
+{
+    GtkWidget * dialog;
+
+    fp_gdk_threads_enter();
+
+    dialog = (GtkWidget*)jlong_to_ptr(
+            (*env)->GetLongField(env, jpeer, widgetFieldID));
+
+    if (dialog != NULL) {
+        fp_gtk_window_present((GtkWindow*)dialog);
+    }
+
+    fp_gdk_threads_leave();
+}
+
 /**
  * Convert a GSList to an array of filenames (without the parent folder)
  */
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h	Tue Nov 30 14:50:04 2010 -0800
@@ -33,6 +33,14 @@
 JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
 (JNIEnv *, jobject);
 
+/*
+ * Class:     sun_awt_X11_GtkFileDialogPeer
+ * Method:    toFront
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
+(JNIEnv *, jobject);
+
 #ifdef __cplusplus
 }
 #endif
--- a/src/windows/classes/sun/awt/windows/WFramePeer.java	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/windows/classes/sun/awt/windows/WFramePeer.java	Tue Nov 30 14:50:04 2010 -0800
@@ -79,10 +79,50 @@
         if (b == null) {
             clearMaximizedBounds();
         } else {
-            setMaximizedBounds(b.x, b.y, b.width, b.height);
+            Rectangle adjBounds = (Rectangle)b.clone();
+            adjustMaximizedBounds(adjBounds);
+            setMaximizedBounds(adjBounds.x, adjBounds.y, adjBounds.width, adjBounds.height);
         }
     }
 
+    /**
+     * The incoming bounds describe the maximized size and position of the
+     * window on the monitor that displays the window. But the window manager
+     * expects that the bounds are based on the size and position of the
+     * primary monitor, even if the window ultimately maximizes onto a
+     * secondary monitor. And the window manager adjusts these values to
+     * compensate for differences between the primary monitor and the monitor
+     * that displays the window.
+     * The method translates the incoming bounds to the values acceptable
+     * by the window manager. For more details, please refer to 6699851.
+     */
+    private void adjustMaximizedBounds(Rectangle b) {
+        GraphicsConfiguration currentDevGC = getGraphicsConfiguration();
+
+        GraphicsDevice primaryDev = GraphicsEnvironment
+            .getLocalGraphicsEnvironment().getDefaultScreenDevice();
+        GraphicsConfiguration primaryDevGC = primaryDev.getDefaultConfiguration();
+
+        if (currentDevGC != null && currentDevGC != primaryDevGC) {
+            Rectangle currentDevBounds = currentDevGC.getBounds();
+            Rectangle primaryDevBounds = primaryDevGC.getBounds();
+
+            b.width -= (currentDevBounds.width - primaryDevBounds.width);
+            b.height -= (currentDevBounds.height - primaryDevBounds.height);
+        }
+    }
+
+    @Override
+    public boolean updateGraphicsData(GraphicsConfiguration gc) {
+        boolean result = super.updateGraphicsData(gc);
+        Rectangle bounds = AWTAccessor.getFrameAccessor().
+                               getMaximizedBounds((Frame)target);
+        if (bounds != null) {
+            setMaximizedBounds(bounds);
+        }
+        return result;
+    }
+
     @Override
     boolean isTargetUndecorated() {
         return ((Frame)target).isUndecorated();
--- a/src/windows/native/sun/windows/awt_Choice.cpp	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/windows/native/sun/windows/awt_Choice.cpp	Tue Nov 30 14:50:04 2010 -0800
@@ -86,6 +86,7 @@
 AwtChoice::AwtChoice() {
     m_hList = NULL;
     m_listDefWindowProc = NULL;
+    m_selectedItem = -1;
 }
 
 LPCTSTR AwtChoice::GetClassName() {
@@ -437,9 +438,10 @@
 MsgRouting AwtChoice::WmNotify(UINT notifyCode)
 {
     if (notifyCode == CBN_SELCHANGE) {
-        int itemSelect = (int)SendMessage(CB_GETCURSEL);
-        if (itemSelect != CB_ERR){
-            DoCallback("handleAction", "(I)V", itemSelect);
+        int selectedItem = (int)SendMessage(CB_GETCURSEL);
+        if (selectedItem != CB_ERR && m_selectedItem != selectedItem){
+            m_selectedItem = selectedItem;
+            DoCallback("handleAction", "(I)V", selectedItem);
         }
     } else if (notifyCode == CBN_DROPDOWN) {
 
--- a/src/windows/native/sun/windows/awt_Choice.h	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/windows/native/sun/windows/awt_Choice.h	Tue Nov 30 14:50:04 2010 -0800
@@ -94,6 +94,7 @@
     static BOOL sm_isMouseMoveInList;
     HWND m_hList;
     WNDPROC m_listDefWindowProc;
+    int m_selectedItem;
     static LRESULT CALLBACK ListWindowProc(HWND hwnd, UINT message,
                                            WPARAM wParam, LPARAM lParam);
 };
--- a/src/windows/resource/java.manifest	Tue Nov 30 14:49:26 2010 -0800
+++ b/src/windows/resource/java.manifest	Tue Nov 30 14:50:04 2010 -0800
@@ -3,7 +3,7 @@
 <assemblyIdentity
     version="1.0.0.0"
     processorArchitecture="X86"
-    name="Sun Microsystems, Inc., Java(tm) 2 Standard Edition"
+    name="Oracle Corporation, Java(tm) 2 Standard Edition"
     type="win32"
 />
 <description>AWT</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Color/OpacityChange/OpacityChange.java	Tue Nov 30 14:50:04 2010 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6783910
+  @summary java.awt.Color.brighter()/darker() methods make color opaque
+  @author Andrei Dmitriev: area=awt-color
+  @run main OpacityChange
+*/
+
+import java.awt.*;
+
+public class OpacityChange {
+    private final static int INITIAL_ALPHA = 125;
+
+    public static void main(String argv[]) {
+        Color color = new Color(20, 20, 20, INITIAL_ALPHA);
+        System.out.println("Initial alpha: " + color.getAlpha());
+        Color colorBrighter = color.brighter();
+        System.out.println("New alpha (after brighter): " + colorBrighter.getAlpha());
+
+        Color colorDarker = color.darker();
+        System.out.println("New alpha (after darker): " + colorDarker.getAlpha());
+
+
+        if (INITIAL_ALPHA != colorBrighter.getAlpha()) {
+            throw new RuntimeException("Brighter color alpha has changed from : " +INITIAL_ALPHA + " to " + colorBrighter.getAlpha());
+        }
+        if (INITIAL_ALPHA != colorDarker.getAlpha()) {
+            throw new RuntimeException("Darker color alpha has changed from : " +INITIAL_ALPHA + " to " + colorDarker.getAlpha());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/MenuBar/DeadlockTest1/DeadlockTest1.java	Tue Nov 30 14:50:04 2010 -0800
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6990904
+  @summary on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
+  @author Andrei Dmitriev: area=awt-menubar
+  @run main/timeout=30 DeadlockTest1
+*/
+
+import java.awt.*;
+
+public class DeadlockTest1 {
+    Frame f = new Frame("Menu Frame");
+
+    DeadlockTest1() {
+        MenuBar menubar = new MenuBar();
+
+        Menu file = new Menu("File");
+        Menu edit = new Menu("Edit");
+        Menu help = new Menu("Help");
+
+        MenuItem open = new MenuItem("Open");
+        MenuItem close = new MenuItem("Close");
+        MenuItem copy = new MenuItem("Copy");
+        MenuItem paste = new MenuItem("Paste");
+
+        file.add(open);
+        file.add(close);
+
+        edit.add(copy);
+        edit.add(paste);
+        menubar.add(file);
+        menubar.add(edit);
+        menubar.add(help);
+        menubar.setHelpMenu(help);
+
+        f.setMenuBar(menubar);
+        f.setSize(400,200);
+        f.setVisible(true);
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException z) {
+            throw new RuntimeException(z);
+        }
+        f.dispose();
+     }
+
+    public static void main(String argv[]) {
+        new DeadlockTest1();
+    }
+}