changeset 1976:e4c0c37f6ad5

6823138: Need to replace ComponentAccessor with AWTAccessor Reviewed-by: art, anthony
author dcherepanov
date Mon, 07 Dec 2009 13:43:04 +0300
parents 44f04b551d8f
children 5ab49c5b9423
files src/share/classes/java/awt/Component.java src/share/classes/java/awt/Window.java src/share/classes/sun/awt/AWTAccessor.java src/share/classes/sun/awt/ComponentAccessor.java src/share/classes/sun/awt/GlobalCursorManager.java src/share/classes/sun/awt/SunToolkit.java src/share/classes/sun/awt/WindowAccessor.java src/solaris/classes/sun/awt/X11/XComponentPeer.java src/solaris/classes/sun/awt/X11/XContentWindow.java src/solaris/classes/sun/awt/X11/XDecoratedPeer.java src/solaris/classes/sun/awt/X11/XDialogPeer.java src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java src/solaris/classes/sun/awt/X11/XEmbedChildProxy.java src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java src/solaris/classes/sun/awt/X11/XTextAreaPeer.java src/solaris/classes/sun/awt/X11/XTextFieldPeer.java src/solaris/classes/sun/awt/X11/XToolkit.java src/solaris/classes/sun/awt/X11/XTrayIconPeer.java src/solaris/classes/sun/awt/X11/XWindow.java src/solaris/classes/sun/awt/X11/XWindowPeer.java src/windows/classes/sun/awt/windows/WCanvasPeer.java src/windows/classes/sun/awt/windows/WComponentPeer.java src/windows/classes/sun/awt/windows/WDialogPeer.java src/windows/classes/sun/awt/windows/WFileDialogPeer.java src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
diffstat 25 files changed, 314 insertions(+), 710 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/Component.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/share/classes/java/awt/Component.java	Mon Dec 07 13:43:04 2009 +0300
@@ -871,7 +871,7 @@
                 return comp.canBeFocusOwner();
             }
 
-            public boolean isVisible_NoClientCode(Component comp) {
+            public boolean isVisible(Component comp) {
                 return comp.isVisible_NoClientCode();
             }
             public void setRequestFocusController
@@ -885,6 +885,71 @@
             public void setAppContext(Component comp, AppContext appContext) {
                  comp.appContext = appContext;
             }
+            public Container getParent(Component comp) {
+                return comp.getParent_NoClientCode();
+            }
+            public void setParent(Component comp, Container parent) {
+                comp.parent = parent;
+            }
+            public void setSize(Component comp, int width, int height) {
+                comp.width = width;
+                comp.height = height;
+            }
+            public Point getLocation(Component comp) {
+                return comp.location_NoClientCode();
+            }
+            public void setLocation(Component comp, int x, int y) {
+                comp.x = x;
+                comp.y = y;
+            }
+            public boolean isEnabled(Component comp) {
+                return comp.isEnabledImpl();
+            }
+            public boolean isDisplayable(Component comp) {
+                return comp.peer != null;
+            }
+            public Cursor getCursor(Component comp) {
+                return comp.getCursor_NoClientCode();
+            }
+            public ComponentPeer getPeer(Component comp) {
+                return comp.peer;
+            }
+            public void setPeer(Component comp, ComponentPeer peer) {
+                comp.peer = peer;
+            }
+            public boolean isLightweight(Component comp) {
+                return (comp.peer instanceof LightweightPeer);
+            }
+            public boolean getIgnoreRepaint(Component comp) {
+                return comp.ignoreRepaint;
+            }
+            public int getWidth(Component comp) {
+                return comp.width;
+            }
+            public int getHeight(Component comp) {
+                return comp.height;
+            }
+            public int getX(Component comp) {
+                return comp.x;
+            }
+            public int getY(Component comp) {
+                return comp.y;
+            }
+            public Color getForeground(Component comp) {
+                return comp.foreground;
+            }
+            public Color getBackground(Component comp) {
+                return comp.background;
+            }
+            public void setBackground(Component comp, Color background) {
+                comp.background = background;
+            }
+            public Font getFont(Component comp) {
+                return comp.getFont_NoClientCode();
+            }
+            public void processEvent(Component comp, AWTEvent e) {
+                comp.processEvent(e);
+            }
         });
     }
 
@@ -8021,7 +8086,7 @@
     Container getNativeContainer() {
         Container p = parent;
         while (p != null && p.peer instanceof LightweightPeer) {
-            p = p.getParent();
+            p = p.getParent_NoClientCode();
         }
         return p;
     }
--- a/src/share/classes/java/awt/Window.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/share/classes/java/awt/Window.java	Mon Dec 07 13:43:04 2009 +0300
@@ -3964,6 +3964,18 @@
             public void setLWRequestStatus(Window changed, boolean status) {
                 changed.syncLWRequests = status;
             }
+
+            public boolean isAutoRequestFocus(Window w) {
+                return w.autoRequestFocus;
+            }
+
+            public boolean isTrayIconWindow(Window w) {
+                return w.isTrayIconWindow;
+            }
+
+            public void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
+                w.isTrayIconWindow = isTrayIconWindow;
+            }
         }); // WindowAccessor
     } // static
 
--- a/src/share/classes/sun/awt/AWTAccessor.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/share/classes/sun/awt/AWTAccessor.java	Mon Dec 07 13:43:04 2009 +0300
@@ -98,7 +98,7 @@
          * Returns whether the component is visible without invoking
          * any client code.
          */
-        boolean isVisible_NoClientCode(Component comp);
+        boolean isVisible(Component comp);
 
         /**
          * Sets the RequestFocusController.
@@ -114,6 +114,112 @@
          * Sets the appContext of the component.
          */
         void setAppContext(Component comp, AppContext appContext);
+
+        /**
+         * Returns the parent of the component.
+         */
+        Container getParent(Component comp);
+
+        /**
+         * Sets the parent of the component to the specified parent.
+         */
+        void setParent(Component comp, Container parent);
+
+        /**
+         * Resizes the component to the specified width and height.
+         */
+        void setSize(Component comp, int width, int height);
+
+        /**
+         * Returns the location of the component.
+         */
+        Point getLocation(Component comp);
+
+        /**
+         * Moves the component to the new location.
+         */
+        void setLocation(Component comp, int x, int y);
+
+        /**
+         * Determines whether this component is enabled.
+         */
+        boolean isEnabled(Component comp);
+
+        /**
+         * Determines whether this component is displayable.
+         */
+        boolean isDisplayable(Component comp);
+
+        /**
+         * Gets the cursor set in the component.
+         */
+        Cursor getCursor(Component comp);
+
+        /**
+         * Returns the peer of the component.
+         */
+        ComponentPeer getPeer(Component comp);
+
+        /**
+         * Sets the peer of the component to the specified peer.
+         */
+        void setPeer(Component comp, ComponentPeer peer);
+
+        /**
+         * Determines whether this component is lightweight.
+         */
+        boolean isLightweight(Component comp);
+
+        /**
+         * Returns whether or not paint messages received from
+         * the operating system should be ignored.
+         */
+        boolean getIgnoreRepaint(Component comp);
+
+        /**
+         * Returns the width of the component.
+         */
+        int getWidth(Component comp);
+
+        /**
+         * Returns the height of the component.
+         */
+        int getHeight(Component comp);
+
+        /**
+         * Returns the x coordinate of the component.
+         */
+        int getX(Component comp);
+
+        /**
+         * Returns the y coordinate of the component.
+         */
+        int getY(Component comp);
+
+        /**
+         * Gets the foreground color of this component.
+         */
+        Color getForeground(Component comp);
+
+        /**
+         * Gets the background color of this component.
+         */
+        Color getBackground(Component comp);
+
+        /**
+         * Sets the background of this component to the specified color.
+         */
+        void setBackground(Component comp, Color background);
+
+        /**
+         * Gets the font of the component.
+         */
+        Font getFont(Component comp);
+
+        /**
+         * Processes events occurring on this component.
+         */
+        void processEvent(Component comp, AWTEvent e);
     }
 
     /*
@@ -169,6 +275,22 @@
          * components in the specified window to the specified value.
          */
         void setLWRequestStatus(Window changed, boolean status);
+
+        /**
+         * Indicates whether this window should receive focus on subsequently
+         * being shown, or being moved to the front.
+         */
+        boolean isAutoRequestFocus(Window w);
+
+        /**
+         * Indicates whether the specified window is an utility window for TrayIcon.
+         */
+        boolean isTrayIconWindow(Window w);
+
+        /**
+         * Marks the specified window as an utility window for TrayIcon.
+         */
+        void setTrayIconWindow(Window w, boolean isTrayIconWindow);
     }
 
     /*
--- a/src/share/classes/sun/awt/ComponentAccessor.java	Fri Dec 04 15:07:15 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,483 +0,0 @@
-/*
- * Copyright 2002-2007 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.
- */
-
-package sun.awt;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.AWTEvent;
-import java.awt.Font;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Point;
-
-import java.awt.peer.ComponentPeer;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
-import sun.util.logging.PlatformLogger;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * A collection of methods for modifying package private fields in AWT components.
- * This class is meant to be used by Peer code only. Previously peer code
- * got around this problem by modifying fields from native code. However
- * as we move away from native code to Pure-java peers we need this class.
- *
- * @author Bino George
- */
-
-
-public class ComponentAccessor
-{
-    private static Class componentClass;
-    private static Field fieldX;
-    private static Field fieldY;
-    private static Field fieldWidth;
-    private static Field fieldHeight;
-    private static Method methodGetParentNoClientCode;
-    private static Method methodGetFontNoClientCode;
-    private static Method methodProcessEvent;
-    private static Method methodEnableEvents;
-    private static Field fieldParent;
-    private static Field fieldBackground;
-    private static Field fieldForeground;
-    private static Field fieldFont;
-    private static Field fieldPacked;
-    private static Field fieldIgnoreRepaint;
-    private static Field fieldPeer;
-    private static Field fieldVisible;
-    private static Method methodIsEnabledImpl;
-    private static Method methodGetCursorNoClientCode;
-    private static Method methodLocationNoClientCode;
-
-    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.ComponentAccessor");
-
-    private ComponentAccessor() {
-    }
-
-    static {
-        AccessController.doPrivileged( new PrivilegedAction() {
-                public Object run() {
-                    try {
-                        componentClass = Class.forName("java.awt.Component");
-                        fieldX  = componentClass.getDeclaredField("x");
-                        fieldX.setAccessible(true);
-                        fieldY  = componentClass.getDeclaredField("y");
-                        fieldY.setAccessible(true);
-                        fieldWidth  = componentClass.getDeclaredField("width");
-                        fieldWidth.setAccessible(true);
-                        fieldHeight  = componentClass.getDeclaredField("height");
-                        fieldHeight.setAccessible(true);
-                        fieldForeground  = componentClass.getDeclaredField("foreground");
-                        fieldForeground.setAccessible(true);
-                        fieldBackground  = componentClass.getDeclaredField("background");
-                        fieldBackground.setAccessible(true);
-                        fieldFont = componentClass.getDeclaredField("font");
-                        fieldFont.setAccessible(true);
-                        methodGetParentNoClientCode = componentClass.getDeclaredMethod("getParent_NoClientCode", (Class[]) null);
-                        methodGetParentNoClientCode.setAccessible(true);
-                        methodGetFontNoClientCode = componentClass.getDeclaredMethod("getFont_NoClientCode", (Class[]) null);
-                        methodGetFontNoClientCode.setAccessible(true);
-                        Class[] argTypes = { AWTEvent.class };
-                        methodProcessEvent = componentClass.getDeclaredMethod("processEvent",argTypes);
-                        methodProcessEvent.setAccessible(true);
-                        Class[] argTypesForMethodEnableEvents = { Long.TYPE };
-                        methodEnableEvents = componentClass.getDeclaredMethod("enableEvents",argTypesForMethodEnableEvents);
-                        methodEnableEvents.setAccessible(true);
-
-                        fieldParent  = componentClass.getDeclaredField("parent");
-                        fieldParent.setAccessible(true);
-                        fieldPacked = componentClass.getDeclaredField("isPacked");
-                        fieldPacked.setAccessible(true);
-                        fieldIgnoreRepaint = componentClass.getDeclaredField("ignoreRepaint");
-                        fieldIgnoreRepaint.setAccessible(true);
-
-                        fieldPeer = componentClass.getDeclaredField("peer");
-                        fieldPeer.setAccessible(true);
-
-                        fieldVisible = componentClass.getDeclaredField("visible");
-                        fieldVisible.setAccessible(true);
-
-                        methodIsEnabledImpl = componentClass.getDeclaredMethod("isEnabledImpl", (Class[]) null);
-                        methodIsEnabledImpl.setAccessible(true);
-
-                        methodGetCursorNoClientCode = componentClass.getDeclaredMethod("getCursor_NoClientCode", (Class[]) null);
-                        methodGetCursorNoClientCode.setAccessible(true);
-
-                        methodLocationNoClientCode = componentClass.getDeclaredMethod("location_NoClientCode", (Class[]) null);
-                        methodLocationNoClientCode.setAccessible(true);
-                    }
-                    catch (NoSuchFieldException e) {
-                        log.fine("Unable to initialize ComponentAccessor", e);
-                    }
-                    catch (ClassNotFoundException e) {
-                        log.fine("Unable to initialize ComponentAccessor", e);
-                    }
-                    catch (NoSuchMethodException e) {
-                        log.fine("Unable to initialize ComponentAccessor", e);
-                    }
-                    // to please javac
-                    return null;
-                }
-            });
-    }
-
-    public static void setX(Component c, int x)
-    {
-        try {
-            fieldX.setInt(c,x);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setY(Component c, int y)
-    {
-        try {
-            fieldY.setInt(c,y);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setWidth(Component c, int width)
-    {
-        try {
-            fieldWidth.setInt(c,width);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setHeight(Component c, int height)
-    {
-        try {
-            fieldHeight.setInt(c,height);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setBounds(Component c, int x, int y, int width, int height)
-    {
-        try {
-            fieldX.setInt(c,x);
-            fieldY.setInt(c,y);
-            fieldWidth.setInt(c,width);
-            fieldHeight.setInt(c,height);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static int getX(Component c) {
-        try {
-            return fieldX.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static int getY(Component c) {
-        try {
-            return fieldY.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static int getWidth(Component c) {
-        try {
-            return fieldWidth.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static int getHeight(Component c) {
-        try {
-            return fieldHeight.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static boolean getIsPacked(Component c) {
-        try {
-            return fieldPacked.getBoolean(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return false;
-    }
-
-    public static Container getParent_NoClientCode(Component c) {
-        Container parent=null;
-
-        try {
-            parent = (Container) methodGetParentNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return parent;
-    }
-
-    public static Font getFont_NoClientCode(Component c) {
-        Font font=null;
-
-        try {
-            font = (Font) methodGetFontNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return font;
-    }
-
-    public static void processEvent(Component c, AWTEvent event) {
-        Font font=null;
-
-        try {
-            Object[] args = new Object[1];
-            args[0] = event;
-            methodProcessEvent.invoke(c,args);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-    }
-
-    public static void enableEvents(Component c, long event_mask) {
-        try {
-            Object[] args = new Object[1];
-            args[0] = Long.valueOf(event_mask);
-            methodEnableEvents.invoke(c,args);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-    }
-
-    public static void setParent(Component c, Container parent)
-    {
-        try {
-            fieldParent.set(c,parent);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static Color getForeground(Component c)
-    {
-        Color color = null;
-        try {
-            color = (Color) fieldForeground.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return color;
-    }
-
-    public static Color getBackground(Component c)
-    {
-        Color color = null;
-        try {
-            color = (Color) fieldBackground.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return color;
-    }
-
-    public static void setBackground(Component c, Color color) {
-        try {
-            fieldBackground.set(c, color);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static Font getFont(Component c)
-    {
-        Font f = null;
-        try {
-            f = (Font) fieldFont.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return f;
-    }
-
-    public static ComponentPeer getPeer(Component c) {
-        ComponentPeer peer = null;
-        try {
-            peer = (ComponentPeer)fieldPeer.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return peer;
-    }
-
-    public static void setPeer(Component c, ComponentPeer peer) {
-        try {
-            fieldPeer.set(c, peer);
-        } catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static boolean getIgnoreRepaint(Component comp) {
-        try {
-            return fieldIgnoreRepaint.getBoolean(comp);
-        }
-        catch (IllegalAccessException e) {
-            log.fine("Unable to access the Component object", e);
-        }
-
-        return false;
-    }
-
-    public static boolean getVisible(Component c) {
-        try {
-            return fieldVisible.getBoolean(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return false;
-    }
-
-    public static boolean isEnabledImpl(Component c) {
-        boolean enabled = true;
-        try {
-            enabled = (Boolean) methodIsEnabledImpl.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-        return enabled;
-    }
-
-    public static Cursor getCursor_NoClientCode(Component c) {
-        Cursor cursor = null;
-
-        try {
-            cursor = (Cursor) methodGetCursorNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return cursor;
-    }
-
-    public static Point getLocation_NoClientCode(Component c) {
-        Point loc = null;
-
-        try {
-            loc = (Point) methodLocationNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return loc;
-    }
-
-}
--- a/src/share/classes/sun/awt/GlobalCursorManager.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/share/classes/sun/awt/GlobalCursorManager.java	Mon Dec 07 13:43:04 2009 +0300
@@ -183,7 +183,7 @@
             }
 
             if (comp instanceof Window) {
-                p = ComponentAccessor.getLocation_NoClientCode(comp);
+                p = AWTAccessor.getComponentAccessor().getLocation(comp);
             } else if (comp instanceof Container) {
                 p = getLocationOnScreen(comp);
             }
@@ -202,7 +202,7 @@
                 }
             }
 
-            setCursor(comp, ComponentAccessor.getCursor_NoClientCode(comp), useCache);
+            setCursor(comp, AWTAccessor.getComponentAccessor().getCursor(comp), useCache);
 
         } catch (IllegalComponentStateException e) {
             // Shouldn't happen, but if it does, abort.
--- a/src/share/classes/sun/awt/SunToolkit.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/share/classes/sun/awt/SunToolkit.java	Mon Dec 07 13:43:04 2009 +0300
@@ -1119,6 +1119,18 @@
     }
 
     /**
+     * Gives native peers the ability to query the closest HW component.
+     * If the given component is heavyweight, then it returns this. Otherwise,
+     * it goes one level up in the hierarchy and tests next component.
+     */
+    public static Component getHeavyweightComponent(Component c) {
+        while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) {
+            c = AWTAccessor.getComponentAccessor().getParent(c);
+        }
+        return c;
+    }
+
+    /**
      * Returns a new input method window, with behavior as specified in
      * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
      * If the inputContext is not null, the window should return it from its
--- a/src/share/classes/sun/awt/WindowAccessor.java	Fri Dec 04 15:07:15 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright 2007 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.
- */
-
-package sun.awt;
-
-import java.awt.Window;
-
-import java.lang.reflect.Field;
-
-import sun.util.logging.PlatformLogger;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-public class WindowAccessor {
-
-    private static Class windowClass;
-    private static Field fieldIsAutoRequestFocus;
-    private static Field fieldIsTrayIconWindow;
-
-    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.WindowAccessor");
-
-    private WindowAccessor() {
-    }
-
-    static {
-        AccessController.doPrivileged( new PrivilegedAction() {
-                public Object run() {
-                    try {
-                        windowClass = Class.forName("java.awt.Window");
-                        fieldIsAutoRequestFocus = windowClass.getDeclaredField("autoRequestFocus");
-                        fieldIsAutoRequestFocus.setAccessible(true);
-                        fieldIsTrayIconWindow = windowClass.getDeclaredField("isTrayIconWindow");
-                        fieldIsTrayIconWindow.setAccessible(true);
-
-                    } catch (NoSuchFieldException e) {
-                        log.fine("Unable to initialize WindowAccessor: ", e);
-                    } catch (ClassNotFoundException e) {
-                        log.fine("Unable to initialize WindowAccessor: ", e);
-                    }
-                    return null;
-                }
-            });
-    }
-
-    public static boolean isAutoRequestFocus(Window w) {
-        try {
-            return fieldIsAutoRequestFocus.getBoolean(w);
-
-        } catch (IllegalAccessException e) {
-            log.fine("Unable to access the Window object", e);
-        }
-        return true;
-    }
-
-    public static boolean isTrayIconWindow(Window w) {
-        try {
-            return fieldIsTrayIconWindow.getBoolean(w);
-
-        } catch (IllegalAccessException e) {
-            log.fine("Unable to access the Window object", e);
-        }
-        return false;
-    }
-
-    public static void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
-        try {
-            fieldIsTrayIconWindow.set(w, isTrayIconWindow);
-
-        } catch (IllegalAccessException e) {
-            log.fine("Unable to access the Window object", e);
-        }
-    }
-}
--- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -212,27 +212,6 @@
         return true;
     }
 
-    static XComponentPeer getNativeContainer(Component comp) {
-        if (comp == null) {
-            return null;
-        }
-
-        synchronized(comp.getTreeLock()) {
-            while (comp != null && (ComponentAccessor.getPeer(comp) instanceof LightweightPeer)) {
-                comp = ComponentAccessor.getParent_NoClientCode(comp);
-            }
-
-            if (comp != null) {
-                ComponentPeer peer = ComponentAccessor.getPeer(comp);
-                if (peer != null && peer instanceof XComponentPeer) {
-                    return (XComponentPeer)peer;
-                }
-            }
-        }
-
-        return null;
-    }
-
     /*************************************************
      * FOCUS STUFF
      *************************************************/
@@ -508,13 +487,14 @@
     }
 
     XWindowPeer getParentTopLevel() {
-        Container parent = (target instanceof Container) ? ((Container)target) : (ComponentAccessor.getParent_NoClientCode(target));
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
         // Search for parent window
         while (parent != null && !(parent instanceof Window)) {
-            parent = ComponentAccessor.getParent_NoClientCode(parent);
+            parent = compAccessor.getParent(parent);
         }
         if (parent != null) {
-            return (XWindowPeer)ComponentAccessor.getPeer(parent);
+            return (XWindowPeer)compAccessor.getPeer(parent);
         } else {
             return null;
         }
@@ -828,7 +808,7 @@
 
     public void endLayout() {
         if (!paintPending && !paintArea.isEmpty()
-            && !ComponentAccessor.getIgnoreRepaint(target))
+            && !AWTAccessor.getComponentAccessor().getIgnoreRepaint(target))
         {
             // if not waiting for native painting repaint damaged area
             postEvent(new PaintEvent(target, PaintEvent.PAINT,
@@ -1239,11 +1219,11 @@
     // End of multi-buffering
 
     public void notifyTextComponentChange(boolean add){
-        Container parent = ComponentAccessor.getParent_NoClientCode(target);
+        Container parent = AWTAccessor.getComponentAccessor().getParent(target);
         while(!(parent == null ||
                 parent instanceof java.awt.Frame ||
                 parent instanceof java.awt.Dialog)) {
-        parent = ComponentAccessor.getParent_NoClientCode(parent);
+            parent = AWTAccessor.getComponentAccessor().getParent(parent);
         }
 
 /*      FIX ME - FIX ME need to implement InputMethods
--- a/src/solaris/classes/sun/awt/X11/XContentWindow.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XContentWindow.java	Mon Dec 07 13:43:04 2009 +0300
@@ -32,7 +32,7 @@
 
 import sun.util.logging.PlatformLogger;
 
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 /**
  * This class implements window which serves as content window for decorated frames.
@@ -135,8 +135,7 @@
     // NOTE: This method may be called by privileged threads.
     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
     public void handleResize(Rectangle bounds) {
-        ComponentAccessor.setWidth((Component)target, bounds.width);
-        ComponentAccessor.setHeight((Component)target, bounds.height);
+        AWTAccessor.getComponentAccessor().setSize((Component)target, bounds.width, bounds.height);
         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
     }
 
--- a/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -32,7 +32,7 @@
 
 import sun.util.logging.PlatformLogger;
 
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 
 abstract class XDecoratedPeer extends XWindowPeer {
@@ -167,10 +167,11 @@
     }
 
     public Graphics getGraphics() {
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
         return getGraphics(content.surfaceData,
-                           ComponentAccessor.getForeground(target),
-                           ComponentAccessor.getBackground(target),
-                           ComponentAccessor.getFont_NoClientCode(target));
+                           compAccessor.getForeground(target),
+                           compAccessor.getBackground(target),
+                           compAccessor.getFont(target));
     }
 
     public void setTitle(String title) {
@@ -404,8 +405,7 @@
 
     public void handleMoved(WindowDimensions dims) {
         Point loc = dims.getLocation();
-        ComponentAccessor.setX((Component)target, loc.x);
-        ComponentAccessor.setY((Component)target, loc.y);
+        AWTAccessor.getComponentAccessor().setLocation((Component)target, loc.x, loc.y);
         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
     }
 
@@ -511,8 +511,8 @@
                 // its location changes.
                 Point oldLocation = getLocation();
 
-                Point newLocation = new Point(ComponentAccessor.getX((Component)target),
-                                              ComponentAccessor.getY((Component)target));
+                Point newLocation = new Point(AWTAccessor.getComponentAccessor().getX((Component)target),
+                                              AWTAccessor.getComponentAccessor().getY((Component)target));
 
                 if (!newLocation.equals(oldLocation)) {
                     handleMoved(newDimensions);
@@ -710,10 +710,7 @@
         updateChildrenSizes();
 
         // Bounds of the window
-        Rectangle targetBounds = new Rectangle(ComponentAccessor.getX((Component)target),
-                ComponentAccessor.getY((Component)target),
-                ComponentAccessor.getWidth((Component)target),
-                ComponentAccessor.getHeight((Component)target));
+        Rectangle targetBounds = AWTAccessor.getComponentAccessor().getBounds((Component)target);
 
         Point newLocation = targetBounds.getLocation();
         if (xe.get_send_event() || runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) {
@@ -1042,10 +1039,11 @@
     }
 
     final void dumpTarget() {
-        int getWidth = ComponentAccessor.getWidth((Component)target);
-        int getHeight = ComponentAccessor.getHeight((Component)target);
-        int getTargetX = ComponentAccessor.getX((Component)target);
-        int getTargetY = ComponentAccessor.getY((Component)target);
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        int getWidth = compAccessor.getWidth((Component)target);
+        int getHeight = compAccessor.getHeight((Component)target);
+        int getTargetX = compAccessor.getX((Component)target);
+        int getTargetY = compAccessor.getY((Component)target);
         System.err.println(">>> Target: " + getTargetX + ", " + getTargetY + ", " + getWidth + ", " + getHeight);
     }
 
@@ -1208,7 +1206,7 @@
             Window owner = XWindowPeer.getDecoratedOwner(actualFocusedWindow);
 
             if (owner != null && owner == target) {
-                setActualFocusedWindow((XWindowPeer) ComponentAccessor.getPeer(actualFocusedWindow));
+                setActualFocusedWindow((XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(actualFocusedWindow));
             }
         }
         super.handleWindowFocusOut(oppositeWindow, serial);
--- a/src/solaris/classes/sun/awt/X11/XDialogPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XDialogPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -28,7 +28,7 @@
 import java.awt.*;
 import java.awt.peer.*;
 import java.awt.event.*;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 import sun.awt.*;
 
@@ -117,7 +117,7 @@
         try {
             javaToplevels = XWindowPeer.collectJavaToplevels();
             for (Window w : toBlock) {
-                XWindowPeer wp = (XWindowPeer)ComponentAccessor.getPeer(w);
+                XWindowPeer wp = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
                 if (wp != null) {
                     wp.setModalBlocked((Dialog)target, true, javaToplevels);
                 }
@@ -139,7 +139,7 @@
         XWindowPeer focusedWindowPeer = null;
 
         if (focusedWindow != null) {
-            focusedWindowPeer = (XWindowPeer)ComponentAccessor.getPeer(focusedWindow);
+            focusedWindowPeer = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
         } else {
             /*
              * For the case when a potential blocked window is not yet focused
--- a/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -39,11 +39,10 @@
 
 import sun.util.logging.PlatformLogger;
 
-import sun.awt.ComponentAccessor;
-
 import sun.awt.dnd.SunDragSourceContextPeer;
 import sun.awt.dnd.SunDropTargetContextPeer;
 import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 /**
  * The XDragSourceContextPeer class is the class responsible for handling
@@ -117,7 +116,7 @@
         XWindowPeer wpeer = null;
 
         for (c = component; c != null && !(c instanceof Window);
-             c = ComponentAccessor.getParent_NoClientCode(c));
+             c = AWTAccessor.getComponentAccessor().getParent(c));
 
         if (c instanceof Window) {
             wpeer = (XWindowPeer)c.getPeer();
--- a/src/solaris/classes/sun/awt/X11/XEmbedChildProxy.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XEmbedChildProxy.java	Mon Dec 07 13:43:04 2009 +0300
@@ -27,7 +27,7 @@
 
 import java.awt.Component;
 import java.awt.Toolkit;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class XEmbedChildProxy extends Component {
     long handle;
@@ -39,8 +39,9 @@
 
     public void addNotify() {
         synchronized(getTreeLock()) {
-            if (ComponentAccessor.getPeer(this) == null) {
-                ComponentAccessor.setPeer(this, ((XToolkit)Toolkit.getDefaultToolkit()).createEmbedProxy(this));
+            if (AWTAccessor.getComponentAccessor().getPeer(this) == null) {
+                AWTAccessor.getComponentAccessor().
+                    setPeer(this,((XToolkit)Toolkit.getDefaultToolkit()).createEmbedProxy(this));
             }
             super.addNotify();
         }
--- a/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	Mon Dec 07 13:43:04 2009 +0300
@@ -31,7 +31,7 @@
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 import sun.awt.GlobalCursorManager;
 import sun.awt.SunToolkit;
@@ -94,11 +94,11 @@
                 nc = nativeContainer.get();
             }
         } else {
-            nc = getNativeContainer(comp);
+           nc = SunToolkit.getHeavyweightComponent(comp);
         }
 
         if (nc != null) {
-            ComponentPeer nc_peer = ComponentAccessor.getPeer(nc);
+            ComponentPeer nc_peer = AWTAccessor.getComponentAccessor().getPeer(nc);
             if (nc_peer instanceof XComponentPeer) {
                 synchronized (this) {
                     nativeContainer = new WeakReference<Component>(nc);
@@ -133,13 +133,6 @@
         updateGrabbedCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     }
 
-    private Component getNativeContainer(Component comp) {
-        while (comp != null && ComponentAccessor.getPeer(comp) instanceof LightweightPeer) {
-            comp = ComponentAccessor.getParent_NoClientCode(comp);
-        }
-        return comp;
-    }
-
     protected void getCursorPos(Point p) {
 
         if (!((XToolkit)Toolkit.getDefaultToolkit()).getLastCursorPos(p)) {
@@ -186,27 +179,29 @@
     }
 
     private Cursor getCapableCursor(Component comp) {
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+
         Component c = comp;
         while ((c != null) && !(c instanceof Window)
-               && ComponentAccessor.isEnabledImpl(c)
-               && ComponentAccessor.getVisible(c)
-               && ComponentAccessor.getPeer(c) != null)
+               && compAccessor.isEnabled(c)
+               && compAccessor.isVisible(c)
+               && compAccessor.isDisplayable(c))
         {
-            c = ComponentAccessor.getParent_NoClientCode(c);
+            c = compAccessor.getParent(c);
         }
         if (c instanceof Window) {
-            return (ComponentAccessor.isEnabledImpl(c)
-                    && ComponentAccessor.getVisible(c)
-                    && (ComponentAccessor.getPeer(c) != null)
-                    && ComponentAccessor.isEnabledImpl(comp))
+            return (compAccessor.isEnabled(c)
+                    && compAccessor.isVisible(c)
+                    && compAccessor.isDisplayable(c)
+                    && compAccessor.isEnabled(comp))
                    ?
-                    ComponentAccessor.getCursor_NoClientCode(comp)
+                    compAccessor.getCursor(comp)
                    :
                     Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
         } else if (c == null) {
             return null;
         }
-        return getCapableCursor(ComponentAccessor.getParent_NoClientCode(c));
+        return getCapableCursor(compAccessor.getParent(c));
     }
 
     /* This methods needs to be called from within XToolkit.awtLock / XToolkit.awtUnlock section. */
--- a/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -60,7 +60,7 @@
 import javax.swing.plaf.BorderUIResource;
 import java.awt.im.InputMethodRequests;
 import sun.awt.CausedFocusEvent;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 
 class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
@@ -119,13 +119,14 @@
         textPane.setVisible(true);
         textPane.validate();
 
-        foreground = ComponentAccessor.getForeground(target);
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        foreground = compAccessor.getForeground(target);
         if (foreground == null)  {
             foreground = SystemColor.textText;
         }
         setForeground(foreground);
 
-        background = ComponentAccessor.getBackground(target);
+        background = compAccessor.getBackground(target);
         if (background == null) {
             if (target.isEditable()) background = SystemColor.text;
             else background = SystemColor.control;
@@ -134,8 +135,8 @@
 
         if (!target.isBackgroundSet()) {
             // This is a way to set the background color of the TextArea
-            // without calling setBackground - go through reflection
-            ComponentAccessor.setBackground(target, background);
+            // without calling setBackground - go through accessor
+            compAccessor.setBackground(target, background);
         }
         if (!target.isForegroundSet()) {
             target.setForeground(SystemColor.textText);
@@ -311,13 +312,13 @@
     }
 
     void handleJavaKeyEvent(KeyEvent e) {
-        ComponentAccessor.processEvent(jtext,e);
+        AWTAccessor.getComponentAccessor().processEvent(jtext,e);
     }
 
     public boolean handlesWheelScrolling() { return true; }
 
     void handleJavaMouseWheelEvent(MouseWheelEvent e) {
-        ComponentAccessor.processEvent(textPane,e);
+        AWTAccessor.getComponentAccessor().processEvent(textPane,e);
     }
 
     public void handleJavaMouseEvent( MouseEvent e ) {
@@ -1111,7 +1112,7 @@
             this.xwin = xwin;
             setDoubleBuffered(true);
             jt.addFocusListener(this);
-            ComponentAccessor.setParent(this,parent);
+            AWTAccessor.getComponentAccessor().setParent(this,parent);
             setViewportBorder(new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight) );
             this.jtext = jt;
             setFocusable(false);
@@ -1308,7 +1309,7 @@
                         c = current.getButton();
                         p = toLocalSpace( c, p );
                     }
-                    ComponentAccessor.processEvent( c, newMouseEvent( c, p, event ) );
+                    AWTAccessor.getComponentAccessor().processEvent( c, newMouseEvent( c, p, event ) );
                     break;
             }
         }
--- a/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -55,7 +55,7 @@
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.CausedFocusEvent;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XTextField");
@@ -115,13 +115,14 @@
 
         setBounds(x, y, width, height, SET_BOUNDS);
 
-        foreground = ComponentAccessor.getForeground(target);
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        foreground = compAccessor.getForeground(target);
         if (foreground == null)
             foreground = SystemColor.textText;
 
         setForeground(foreground);
 
-        background = ComponentAccessor.getBackground(target);
+        background = compAccessor.getBackground(target);
         if (background == null) {
             if (((TextField)target).isEditable()) background = SystemColor.text;
             else background = SystemColor.control;
@@ -130,8 +131,8 @@
 
         if (!target.isBackgroundSet()) {
             // This is a way to set the background color of the TextArea
-            // without calling setBackground - go through reflection
-            ComponentAccessor.setBackground(target, background);
+            // without calling setBackground - go through accessor
+            compAccessor.setBackground(target, background);
         }
         if (!target.isForegroundSet()) {
             target.setForeground(SystemColor.textText);
@@ -392,7 +393,7 @@
     }
 
     void handleJavaKeyEvent(KeyEvent e) {
-        ComponentAccessor.processEvent(xtext,e);
+        AWTAccessor.getComponentAccessor().processEvent(xtext,e);
     }
 
 
@@ -620,7 +621,7 @@
             this.peer = peer;
             setDoubleBuffered(true);
             setFocusable(false);
-            ComponentAccessor.setParent(this,parent);
+            AWTAccessor.getComponentAccessor().setParent(this,parent);
             setBackground(peer.getPeerBackground());
             setForeground(peer.getPeerForeground());
             setFont(peer.getPeerFont());
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java	Mon Dec 07 13:43:04 2009 +0300
@@ -626,7 +626,7 @@
                     Component owner =
                         XKeyboardFocusManagerPeer.getCurrentNativeFocusOwner();
                     if (owner != null) {
-                        XWindow ownerWindow = (XWindow) ComponentAccessor.getPeer(owner);
+                        XWindow ownerWindow = (XWindow) AWTAccessor.getComponentAccessor().getPeer(owner);
                         if (ownerWindow != null) {
                             w = ownerWindow.getContentWindow();
                         }
--- a/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -295,7 +295,7 @@
     }
 
     public static void suppressWarningString(Window w) {
-        WindowAccessor.setTrayIconWindow(w, true);
+        AWTAccessor.getWindowAccessor().setTrayIconWindow(w, true);
     }
 
     public void setToolTip(String tooltip) {
--- a/src/solaris/classes/sun/awt/X11/XWindow.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java	Mon Dec 07 13:43:04 2009 +0300
@@ -325,9 +325,9 @@
         if (!(target instanceof Container) || win == null || win.getTarget() == null) {
             return false;
         }
-        Container parent = ComponentAccessor.getParent_NoClientCode(win.target);
+        Container parent = AWTAccessor.getComponentAccessor().getParent(win.target);
         while (parent != null && parent != target) {
-            parent = ComponentAccessor.getParent_NoClientCode(parent);
+            parent = AWTAccessor.getComponentAccessor().getParent(parent);
         }
         return (parent == target);
     }
@@ -560,10 +560,11 @@
         int h = xe.get_height();
 
         Component target = (Component)getEventSource();
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
 
-        if (!ComponentAccessor.getIgnoreRepaint(target)
-            && ComponentAccessor.getWidth(target) != 0
-            && ComponentAccessor.getHeight(target) != 0)
+        if (!compAccessor.getIgnoreRepaint(target)
+            && compAccessor.getWidth(target) != 0
+            && compAccessor.getHeight(target) != 0)
         {
             handleExposeEvent(target, x, y, w, h);
         }
@@ -950,7 +951,7 @@
                     XAwtState.setComponentMouseEntered(null);
                 }
             } else {
-                ((XComponentPeer) ComponentAccessor.getPeer(target))
+                ((XComponentPeer) AWTAccessor.getComponentAccessor().getPeer(target))
                     .pSetCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             }
         }
@@ -1387,7 +1388,7 @@
             Component comp = target;
 
             while (comp != null && !(comp instanceof Window)) {
-                comp = ComponentAccessor.getParent_NoClientCode(comp);
+                comp = AWTAccessor.getComponentAccessor().getParent(comp);
             }
 
             // applets, embedded, etc - translate directly
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -51,8 +51,6 @@
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.AWTAccessor;
-import sun.awt.ComponentAccessor;
-import sun.awt.WindowAccessor;
 import sun.awt.DisplayChangedListener;
 import sun.awt.SunToolkit;
 import sun.awt.X11GraphicsDevice;
@@ -254,7 +252,7 @@
         if (((Window)target).getWarningString() != null) {
             // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
             // and TrayIcon balloon windows without a warning window.
-            if (!WindowAccessor.isTrayIconWindow((Window)target)) {
+            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) {
                 warningWindow = new XWarningWindow((Window)target, getWindow(), this);
             }
         }
@@ -546,7 +544,7 @@
 
     boolean isAutoRequestFocus() {
         if (XToolkit.isToolkitThread()) {
-            return WindowAccessor.isAutoRequestFocus((Window)target);
+            return AWTAccessor.getWindowAccessor().isAutoRequestFocus((Window)target);
         } else {
             return ((Window)target).isAutoRequestFocus();
         }
@@ -1086,10 +1084,11 @@
         if (warningWindow != null) {
             // We can't use the coordinates stored in the XBaseWindow since
             // they are zeros for decorated frames.
-            int x = ComponentAccessor.getX(target);
-            int y = ComponentAccessor.getY(target);
-            int width = ComponentAccessor.getWidth(target);
-            int height = ComponentAccessor.getHeight(target);
+            AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+            int x = compAccessor.getX(target);
+            int y = compAccessor.getY(target);
+            int width = compAccessor.getWidth(target);
+            int height = compAccessor.getHeight(target);
             warningWindow.reposition(x, y, width, height);
         }
     }
@@ -1172,7 +1171,7 @@
         if (isSimpleWindow()) {
             if (target == XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow()) {
                 Window owner = getDecoratedOwner((Window)target);
-                ((XWindowPeer)ComponentAccessor.getPeer(owner)).requestWindowFocus();
+                ((XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(owner)).requestWindowFocus();
             }
         }
     }
@@ -1399,7 +1398,7 @@
         XToolkit.awtLock();
         try {
             if (isReparented() && delayedModalBlocking) {
-                addToTransientFors((XDialogPeer) ComponentAccessor.getPeer(modalBlocker));
+                addToTransientFors((XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
                 delayedModalBlocking = false;
             }
         } finally {
@@ -1483,7 +1482,7 @@
         try {
             // State lock should always be after awtLock
             synchronized(getStateLock()) {
-                XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d);
+                XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d);
                 if (blocked) {
                     log.fine("{0} is blocked by {1}", this, blockerPeer);
                     modalBlocker = d;
@@ -1763,7 +1762,7 @@
         // current chain iterator in the order from next to prev
         XWindowPeer chainToSplit = prevTransientFor;
         while (chainToSplit != null) {
-            XWindowPeer blocker = (XWindowPeer) ComponentAccessor.getPeer(chainToSplit.modalBlocker);
+            XWindowPeer blocker = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker);
             if (thisChainBlockers.contains(blocker)) {
                 // add to this dialog's chain
                 setToplevelTransientFor(thisChain, chainToSplit, true, false);
@@ -1791,7 +1790,7 @@
 
     static Window getDecoratedOwner(Window window) {
         while ((null != window) && !(window instanceof Frame || window instanceof Dialog)) {
-            window = (Window) ComponentAccessor.getParent_NoClientCode(window);
+            window = (Window) AWTAccessor.getComponentAccessor().getParent(window);
         }
         return window;
     }
@@ -1824,7 +1823,7 @@
         }
         focusLog.fine("Parent window is not active");
 
-        XDecoratedPeer wpeer = (XDecoratedPeer)ComponentAccessor.getPeer(ownerWindow);
+        XDecoratedPeer wpeer = (XDecoratedPeer)AWTAccessor.getComponentAccessor().getPeer(ownerWindow);
         if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) {
             focusLog.fine("Parent window accepted focus request - generating focus for this window");
             return true;
@@ -2154,9 +2153,9 @@
                     if (toplevel != null) {
                         Window w = (Window)toplevel.target;
                         while (w != null && toplevel != this && !(toplevel instanceof XDialogPeer)) {
-                            w = (Window) ComponentAccessor.getParent_NoClientCode(w);
+                            w = (Window) AWTAccessor.getComponentAccessor().getParent(w);
                             if (w != null) {
-                                toplevel = (XWindowPeer) ComponentAccessor.getPeer(w);
+                                toplevel = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
                             }
                         }
                         if (w == null || (w != this.target && w instanceof Dialog)) {
--- a/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -28,8 +28,6 @@
 import java.awt.peer.*;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
-import sun.awt.AWTAccessor;
-import sun.awt.ComponentAccessor;
 import sun.awt.SunToolkit;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.PaintEventDispatcher;
--- a/src/windows/classes/sun/awt/windows/WComponentPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -57,7 +57,7 @@
 
 import java.awt.dnd.DropTarget;
 import java.awt.dnd.peer.DropTargetPeer;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 import sun.util.logging.PlatformLogger;
 
@@ -817,7 +817,7 @@
     }
 
     private void postPaintIfNecessary(int x, int y, int w, int h) {
-        if ( !ComponentAccessor.getIgnoreRepaint( (Component) target) ) {
+        if ( !AWTAccessor.getComponentAccessor().getIgnoreRepaint( (Component) target) ) {
             PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
                 createPaintEvent((Component)target, x, y, w, h);
             if (event != null) {
--- a/src/windows/classes/sun/awt/windows/WDialogPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/windows/classes/sun/awt/windows/WDialogPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -98,7 +98,7 @@
 
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
-            WWindowPeer wp = (WWindowPeer)ComponentAccessor.getPeer(w);
+            WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 wp.setModalBlocked((Dialog)target, true);
             }
--- a/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -35,7 +35,7 @@
 import java.util.MissingResourceException;
 import java.util.Vector;
 import sun.awt.AppContext;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
 
@@ -187,7 +187,7 @@
 
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
-            WWindowPeer wp = (WWindowPeer)ComponentAccessor.getPeer(w);
+            WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 blockWindow(wp);
             }
--- a/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Mon Dec 07 13:43:04 2009 +0300
@@ -31,7 +31,7 @@
 import java.awt.dnd.DropTarget;
 import java.util.Vector;
 import sun.awt.AppContext;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
 
@@ -103,7 +103,7 @@
 
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
-            WWindowPeer wp = (WWindowPeer)ComponentAccessor.getPeer(w);
+            WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 blockWindow(wp);
             }