8074028: Remove API references to java.awt.peer

Reviewed-by: alanb, ant, yan, prr
This commit is contained in:
Sergey Bylokhov 2015-04-17 16:54:13 +03:00
parent 971438ead7
commit b9aead1b2c
147 changed files with 625 additions and 701 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,14 +25,18 @@
package com.apple.eawt; package com.apple.eawt;
import java.awt.*; import java.awt.Image;
import java.awt.peer.*; import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.Toolkit;
import java.awt.Window;
import java.beans.Beans; import java.beans.Beans;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
import sun.lwawt.*; import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*; import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CPlatformWindow;
/** /**
* The <code>Application</code> class allows you to integrate your Java application with the native Mac OS X environment. * The <code>Application</code> class allows you to integrate your Java application with the native Mac OS X environment.
@ -385,10 +389,8 @@ public class Application {
* *
* @since Java for Mac OS X 10.7 Update 1 * @since Java for Mac OS X 10.7 Update 1
*/ */
@SuppressWarnings("deprecation")
public void requestToggleFullScreen(final Window window) { public void requestToggleFullScreen(final Window window) {
final ComponentPeer peer = window.getPeer(); final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
if (!(peer instanceof LWWindowPeer)) return; if (!(peer instanceof LWWindowPeer)) return;
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow(); Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
if (!(platformWindow instanceof CPlatformWindow)) return; if (!(platformWindow instanceof CPlatformWindow)) return;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package com.apple.eawt;
import java.awt.*; import java.awt.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*; import sun.lwawt.macosx.*;
import sun.lwawt.macosx.CImage.Creator; import sun.lwawt.macosx.CImage.Creator;
@ -41,7 +42,6 @@ class _AppDockIconHandler {
_AppDockIconHandler() { } _AppDockIconHandler() { }
@SuppressWarnings("deprecation")
public void setDockMenu(final PopupMenu menu) { public void setDockMenu(final PopupMenu menu) {
fDockMenu = menu; fDockMenu = menu;
@ -61,8 +61,8 @@ class _AppDockIconHandler {
// instantiate the menu peer and set the native fDockMenu ivar // instantiate the menu peer and set the native fDockMenu ivar
menu.addNotify(); menu.addNotify();
final long nsMenuPtr = ((CMenu)fDockMenu.getPeer()).getNativeMenu(); CMenu peer = AWTAccessor.getMenuComponentAccessor().getPeer(fDockMenu);
nativeSetDockMenu(nsMenuPtr); nativeSetDockMenu(peer.getNativeMenu());
} }
public PopupMenu getDockMenu() { public PopupMenu getDockMenu() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import javax.swing.*;
import javax.swing.plaf.MenuBarUI; import javax.swing.plaf.MenuBarUI;
import com.apple.laf.ScreenMenuBar; import com.apple.laf.ScreenMenuBar;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar; import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI; import com.apple.laf.AquaMenuBarUI;
@ -49,7 +50,10 @@ class _AppMenuBarHandler {
} }
// callback from the native delegate -init function // callback from the native delegate -init function
private static void initMenuStates(final boolean aboutMenuItemVisible, final boolean aboutMenuItemEnabled, final boolean prefsMenuItemVisible, final boolean prefsMenuItemEnabled) { private static void initMenuStates(final boolean aboutMenuItemVisible,
final boolean aboutMenuItemEnabled,
final boolean prefsMenuItemVisible,
final boolean prefsMenuItemEnabled) {
synchronized (instance) { synchronized (instance) {
instance.aboutMenuItemVisible = aboutMenuItemVisible; instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled; instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
@ -92,7 +96,6 @@ class _AppMenuBarHandler {
return (frame.getExtendedState() & Frame.ICONIFIED) != 0; return (frame.getExtendedState() & Frame.ICONIFIED) != 0;
} }
@SuppressWarnings("deprecation")
static void installDefaultMenuBar(final JMenuBar menuBar) { static void installDefaultMenuBar(final JMenuBar menuBar) {
if (menuBar == null) { if (menuBar == null) {
// intentionally clearing the default menu // intentionally clearing the default menu
@ -114,7 +117,7 @@ class _AppMenuBarHandler {
} }
screenMenuBar.addNotify(); screenMenuBar.addNotify();
final MenuComponentPeer peer = screenMenuBar.getPeer(); final Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar);
if (!(peer instanceof CMenuBar)) { if (!(peer instanceof CMenuBar)) {
// such a thing should not be possible // such a thing should not be possible
throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,11 +27,11 @@ package com.apple.laf;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import java.util.Hashtable; import java.util.Hashtable;
import javax.swing.*; import javax.swing.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.lwawt.LWToolkit; import sun.lwawt.LWToolkit;
import sun.lwawt.macosx.*; import sun.lwawt.macosx.*;
@ -212,24 +212,36 @@ final class ScreenMenu extends Menu
// Send a mouseExited to the previously hilited item, if it wasn't 0. // Send a mouseExited to the previously hilited item, if it wasn't 0.
if (target != fLastMouseEventTarget) { if (target != fLastMouseEventTarget) {
if (fLastMouseEventTarget != null) { if (fLastMouseEventTarget != null) {
LWToolkit.postEvent(new MouseEvent(fLastMouseEventTarget, MouseEvent.MOUSE_EXITED, when, modifiers, x - fLastTargetRect.x, y - fLastTargetRect.y, 0, false)); LWToolkit.postEvent(
new MouseEvent(fLastMouseEventTarget,
MouseEvent.MOUSE_EXITED, when,
modifiers, x - fLastTargetRect.x,
y - fLastTargetRect.y, 0,
false));
} }
// Send a mouseEntered to the current hilited item, if it wasn't 0. // Send a mouseEntered to the current hilited item, if it
// wasn't 0.
if (target != null) { if (target != null) {
LWToolkit.postEvent(new MouseEvent(target, MouseEvent.MOUSE_ENTERED, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false)); LWToolkit.postEvent(
new MouseEvent(target, MouseEvent.MOUSE_ENTERED,
when, modifiers,
x - targetRect.x,
y - targetRect.y, 0, false));
} }
fLastMouseEventTarget = target; fLastMouseEventTarget = target;
fLastTargetRect = targetRect; fLastTargetRect = targetRect;
} }
// Post a mouse event to the current item. // Post a mouse event to the current item.
if (target == null) return; if (target == null) return;
LWToolkit.postEvent(new MouseEvent(target, kind, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false)); LWToolkit.postEvent(
new MouseEvent(target, kind, when, modifiers,
x - targetRect.x, y - targetRect.y, 0,
false));
} }
}); });
} }
@Override @Override
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
super.addNotify(); super.addNotify();
@ -248,7 +260,8 @@ final class ScreenMenu extends Menu
if (tooltipText != null) { if (tooltipText != null) {
setToolTipText(tooltipText); setToolTipText(tooltipText);
} }
final MenuComponentPeer peer = getPeer(); final Object peer = AWTAccessor.getMenuComponentAccessor()
.getPeer(this);
if (peer instanceof CMenu) { if (peer instanceof CMenu) {
final CMenu menu = (CMenu) peer; final CMenu menu = (CMenu) peer;
final long nativeMenu = menu.getNativeMenu(); final long nativeMenu = menu.getNativeMenu();
@ -355,9 +368,8 @@ final class ScreenMenu extends Menu
public void setIndeterminate(boolean indeterminate) { } public void setIndeterminate(boolean indeterminate) { }
@Override @Override
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) { public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return; if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer; final CMenuItem cmi = (CMenuItem)peer;
@ -365,9 +377,8 @@ final class ScreenMenu extends Menu
} }
@Override @Override
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) { public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return; if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer; final CMenuItem cmi = (CMenuItem)peer;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,19 +25,21 @@
package com.apple.laf; package com.apple.laf;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar; import sun.lwawt.macosx.CMenuBar;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.lang.reflect.*;
import java.security.*;
import java.util.*; import java.util.*;
import javax.swing.*; import javax.swing.*;
import static sun.awt.AWTAccessor.*;
@SuppressWarnings("serial") // JDK implementation class @SuppressWarnings("serial") // JDK implementation class
public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenMenuPropertyHandler, ComponentListener { public class ScreenMenuBar extends MenuBar
implements ContainerListener, ScreenMenuPropertyHandler,
ComponentListener {
static boolean sJMenuBarHasHelpMenus = false; //$ could check by calling getHelpMenu in a try block static boolean sJMenuBarHasHelpMenus = false; //$ could check by calling getHelpMenu in a try block
JMenuBar fSwingBar; JMenuBar fSwingBar;
@ -246,22 +248,23 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM
fSubmenus.remove(menu); fSubmenus.remove(menu);
} }
@SuppressWarnings("deprecation")
public Menu add(final Menu m, final int index) { public Menu add(final Menu m, final int index) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (m.getParent() != null) { if (m.getParent() != null) {
m.getParent().remove(m); m.getParent().remove(m);
} }
final Vector<Menu> menus = AWTAccessor.getMenuBarAccessor().getMenus(this); final Vector<Menu> menus = getMenuBarAccessor().getMenus(this);
menus.insertElementAt(m, index); menus.insertElementAt(m, index);
AWTAccessor.getMenuComponentAccessor().setParent(m, this); final MenuComponentAccessor acc = getMenuComponentAccessor();
acc.setParent(m, this);
final CMenuBar peer = (CMenuBar)getPeer(); final CMenuBar peer = acc.getPeer(this);
if (peer == null) return m; if (peer == null) return m;
peer.setNextInsertionIndex(index); peer.setNextInsertionIndex(index);
if (m.getPeer() == null) { final CMenuBar mPeer = acc.getPeer(m);
if (mPeer == null) {
m.addNotify(); m.addNotify();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,15 +27,18 @@ package com.apple.laf;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuItem; import sun.lwawt.macosx.CMenuItem;
@SuppressWarnings("serial") // JDK implementation class @SuppressWarnings("serial") // JDK implementation class
final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler { final class ScreenMenuItem extends MenuItem
implements ActionListener, ComponentListener,
ScreenMenuPropertyHandler {
ScreenMenuPropertyListener fListener; ScreenMenuPropertyListener fListener;
JMenuItem fMenuItem; JMenuItem fMenuItem;
@ -97,9 +100,8 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
fMenuItem.removeComponentListener(this); fMenuItem.removeComponentListener(this);
} }
@SuppressWarnings("deprecation")
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) { static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
final MenuComponentPeer peer = menuItem.getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
if (!(peer instanceof CMenuItem)) { if (!(peer instanceof CMenuItem)) {
//Is it possible? //Is it possible?
return; return;
@ -166,18 +168,16 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
} }
} }
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) { public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return; if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer; final CMenuItem cmi = (CMenuItem)peer;
cmi.setToolTipText(text); cmi.setToolTipText(text);
} }
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) { public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return; if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer; final CMenuItem cmi = (CMenuItem)peer;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,17 +27,20 @@ package com.apple.laf;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ButtonUI; import javax.swing.plaf.ButtonUI;
import com.apple.laf.AquaMenuItemUI.IndeterminateListener; import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*; import sun.lwawt.macosx.*;
@SuppressWarnings("serial") // JDK implementation class @SuppressWarnings("serial") // JDK implementation class
final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener { final class ScreenMenuItemCheckbox extends CheckboxMenuItem
implements ActionListener, ComponentListener, ScreenMenuPropertyHandler,
ItemListener {
JMenuItem fMenuItem; JMenuItem fMenuItem;
MenuContainer fParent; MenuContainer fParent;
@ -57,12 +60,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
} }
ScreenMenuPropertyListener fPropertyListener; ScreenMenuPropertyListener fPropertyListener;
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
super.addNotify(); super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem // Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer(); CCheckboxMenuItem ccb = AWTAccessor.getMenuComponentAccessor().getPeer(this);
ccb.setAutoToggle(false); ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this); fMenuItem.addComponentListener(this);
@ -155,17 +158,15 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
setVisible(false); setVisible(false);
} }
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) { public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return; if (!(peer instanceof CMenuItem)) return;
((CMenuItem)peer).setToolTipText(text); ((CMenuItem)peer).setToolTipText(text);
} }
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) { public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return; if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer; final CMenuItem cmi = (CMenuItem)peer;
@ -208,9 +209,8 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
} }
} }
@SuppressWarnings("deprecation")
public void setIndeterminate(final boolean indeterminate) { public void setIndeterminate(final boolean indeterminate) {
final MenuComponentPeer peer = getPeer(); Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (peer instanceof CCheckboxMenuItem) { if (peer instanceof CCheckboxMenuItem) {
((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate); ((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -206,17 +206,15 @@ public final class CGraphicsDevice extends GraphicsDevice
return true; return true;
} }
@SuppressWarnings("deprecation")
private static void enterFullScreenExclusive(Window w) { private static void enterFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer(); FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) { if (peer != null) {
peer.enterFullScreenMode(); peer.enterFullScreenMode();
} }
} }
@SuppressWarnings("deprecation")
private static void exitFullScreenExclusive(Window w) { private static void exitFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer(); FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) { if (peer != null) {
peer.exitFullScreenMode(); peer.exitFullScreenMode();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,13 +33,14 @@ import java.awt.Transparency;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.image.SunVolatileImage; import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager; import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.BackBufferCapsProvider; import sun.java2d.BackBufferCapsProvider;
import sun.java2d.SurfaceData; import sun.java2d.SurfaceData;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*; import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities; import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class CGLVolatileSurfaceManager extends VolatileSurfaceManager { public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
@ -74,11 +75,11 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a pbuffer-based SurfaceData object (or init the backbuffer * Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig) * of an existing window if this is a double buffered GraphicsConfig)
*/ */
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() { protected SurfaceData initAcceleratedSurface() {
SurfaceData sData = null; SurfaceData sData = null;
Component comp = vImg.getComponent(); Component comp = vImg.getComponent();
final ComponentPeer peer = (comp != null) ? comp.getPeer() : null; final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
final ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try { try {
boolean createVSynced = false; boolean createVSynced = false;

View File

@ -930,8 +930,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
return false; return false;
} }
final LWWindowPeer parentPeer = final LWWindowPeer parentPeer =
(LWWindowPeer) AWTAccessor.getComponentAccessor() AWTAccessor.getComponentAccessor()
.getPeer(parentWindow); .getPeer(parentWindow);
if (parentPeer == null) { if (parentPeer == null) {
focusLog.fine("request rejected, parentPeer is null"); focusLog.fine("request rejected, parentPeer is null");
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());

View File

@ -33,6 +33,7 @@ import java.util.List;
import javax.swing.*; import javax.swing.*;
import sun.awt.*; import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.*; import sun.java2d.*;
import sun.java2d.loops.Blit; import sun.java2d.loops.Blit;
import sun.java2d.loops.CompositeType; import sun.java2d.loops.CompositeType;
@ -505,7 +506,7 @@ public class LWWindowPeer
@Override @Override
public void repositionSecurityWarning() { public void repositionSecurityWarning() {
if (warningWindow != null) { if (warningWindow != null) {
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
Window target = getTarget(); Window target = getTarget();
int x = compAccessor.getX(target); int x = compAccessor.getX(target);
int y = compAccessor.getY(target); int y = compAccessor.getY(target);
@ -563,8 +564,7 @@ public class LWWindowPeer
public void blockWindows(List<Window> windows) { public void blockWindows(List<Window> windows) {
//TODO: LWX will probably need some collectJavaToplevels to speed this up //TODO: LWX will probably need some collectJavaToplevels to speed this up
for (Window w : windows) { for (Window w : windows) {
WindowPeer wp = WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
(WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) { if (wp != null) {
wp.setModalBlocked((Dialog)getTarget(), true); wp.setModalBlocked((Dialog)getTarget(), true);
} }
@ -1247,7 +1247,8 @@ public class LWWindowPeer
private boolean isOneOfOwnersOf(LWWindowPeer peer) { private boolean isOneOfOwnersOf(LWWindowPeer peer) {
Window owner = (peer != null ? peer.getTarget().getOwner() : null); Window owner = (peer != null ? peer.getTarget().getOwner() : null);
while (owner != null) { while (owner != null) {
if ((LWWindowPeer)owner.getPeer() == this) { final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (acc.getPeer(owner) == this) {
return true; return true;
} }
owner = owner.getOwner(); owner = owner.getOwner();
@ -1321,8 +1322,8 @@ public class LWWindowPeer
while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
owner = owner.getOwner(); owner = owner.getOwner();
} }
return owner == null ? null : return owner == null ? null : AWTAccessor.getComponentAccessor()
(LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner); .getPeer(owner);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,6 +39,7 @@ import javax.accessibility.*;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import sun.awt.AWTAccessor;
import sun.awt.dnd.*; import sun.awt.dnd.*;
import sun.lwawt.LWComponentPeer; import sun.lwawt.LWComponentPeer;
import sun.lwawt.LWWindowPeer; import sun.lwawt.LWWindowPeer;
@ -88,7 +89,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
super.startDrag(dsc, cursor, dragImage, dragImageOffset); super.startDrag(dsc, cursor, dragImage, dragImageOffset);
} }
@SuppressWarnings("deprecation")
protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) { protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
DragGestureEvent trigger = getTrigger(); DragGestureEvent trigger = getTrigger();
InputEvent triggerEvent = trigger.getTriggerEvent(); InputEvent triggerEvent = trigger.getTriggerEvent();
@ -135,7 +135,9 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
try { try {
//It sure will be LWComponentPeer instance as rootComponent is a Window //It sure will be LWComponentPeer instance as rootComponent is a Window
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow(); LWComponentPeer<?, ?> peer = AWTAccessor.getComponentAccessor()
.getPeer(rootComponent);
PlatformWindow platformWindow = peer.getPlatformWindow();
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow); long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation"); if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke;
import java.awt.Point; import java.awt.Point;
import java.awt.Toolkit; import java.awt.Toolkit;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame; import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer; import sun.lwawt.LWWindowPeer;
@ -46,9 +47,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
show(); show();
} }
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
if (getPeer() == null) { if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit(); LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
LWWindowPeer peer = toolkit.createEmbeddedFrame(this); LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
setPeer(peer); setPeer(peer);
@ -61,10 +61,9 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void unregisterAccelerator(AWTKeyStroke stroke) {} public void unregisterAccelerator(AWTKeyStroke stroke) {}
@SuppressWarnings("deprecation")
protected long getLayerPtr() { protected long getLayerPtr() {
LWWindowPeer peer = (LWWindowPeer)getPeer(); return AWTAccessor.getComponentAccessor().<LWWindowPeer>getPeer(this)
return peer.getLayerPtr(); .getLayerPtr();
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,9 +38,12 @@ import java.text.AttributedCharacterIterator.Attribute;
import java.text.*; import java.text.*;
import javax.swing.text.JTextComponent; import javax.swing.text.JTextComponent;
import sun.awt.AWTAccessor;
import sun.awt.im.InputMethodAdapter; import sun.awt.im.InputMethodAdapter;
import sun.lwawt.*; import sun.lwawt.*;
import static sun.awt.AWTAccessor.ComponentAccessor;
public class CInputMethod extends InputMethodAdapter { public class CInputMethod extends InputMethodAdapter {
private InputMethodContext fIMContext; private InputMethodContext fIMContext;
private Component fAwtFocussedComponent; private Component fAwtFocussedComponent;
@ -385,12 +388,11 @@ public class CInputMethod extends InputMethodAdapter {
// java.awt.Toolkit#getNativeContainer() is not available // java.awt.Toolkit#getNativeContainer() is not available
// from this package // from this package
@SuppressWarnings("deprecation")
private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) { private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
if (comp==null) if (comp==null)
return null; return null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = acc.getPeer(comp);
if (peer==null) if (peer==null)
return null; return null;
@ -398,7 +400,7 @@ public class CInputMethod extends InputMethodAdapter {
comp = comp.getParent(); comp = comp.getParent();
if (comp==null) if (comp==null)
return null; return null;
peer = comp.getPeer(); peer = acc.getPeer(comp);
if (peer==null) if (peer==null)
return null; return null;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,8 @@ import java.awt.Menu;
import java.awt.MenuBar; import java.awt.MenuBar;
import java.awt.peer.MenuBarPeer; import java.awt.peer.MenuBarPeer;
import sun.awt.AWTAccessor;
public class CMenuBar extends CMenuComponent implements MenuBarPeer { public class CMenuBar extends CMenuComponent implements MenuBarPeer {
private int nextInsertionIndex = -1; private int nextInsertionIndex = -1;
@ -43,9 +45,8 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void addHelpMenu(Menu m) { public void addHelpMenu(Menu m) {
CMenu cMenu = (CMenu)m.getPeer(); CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m);
nativeSetHelpMenu(getModel(), cMenu.getModel()); nativeSetHelpMenu(getModel(), cMenu.getModel());
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,12 +31,11 @@ import java.awt.event.*;
import java.awt.peer.WindowPeer; import java.awt.peer.WindowPeer;
import java.beans.*; import java.beans.*;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Objects;
import javax.swing.*; import javax.swing.*;
import sun.awt.*; import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.SurfaceData; import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLSurfaceData; import sun.java2d.opengl.CGLSurfaceData;
import sun.lwawt.*; import sun.lwawt.*;
@ -193,8 +192,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public CPlatformWindow convertJComponentToTarget(final JRootPane p) { public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
Component root = SwingUtilities.getRoot(p); Component root = SwingUtilities.getRoot(p);
if (root == null || (LWWindowPeer)root.getPeer() == null) return null; final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow(); if (root == null || acc.getPeer(root) == null) return null;
return (CPlatformWindow)((LWWindowPeer)acc.getPeer(root)).getPlatformWindow();
} }
}; };
@ -523,15 +523,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
} }
@Override // PlatformWindow @Override // PlatformWindow
@SuppressWarnings("deprecation")
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
final long nsWindowPtr = getNSWindowPtr(); final long nsWindowPtr = getNSWindowPtr();
// Process parent-child relationship when hiding // Process parent-child relationship when hiding
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!visible) { if (!visible) {
// Unparent my children // Unparent my children
for (Window w : target.getOwnedWindows()) { for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer(); WindowPeer p = acc.getPeer(w);
if (p instanceof LWWindowPeer) { if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) { if (pw != null && pw.isVisible()) {
@ -627,7 +627,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Add my own children to myself // Add my own children to myself
for (Window w : target.getOwnedWindows()) { for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer(); final Object p = acc.getPeer(w);
if (p instanceof LWWindowPeer) { if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow(); CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) { if (pw != null && pw.isVisible()) {
@ -679,13 +679,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
} }
@Override // PlatformWindow @Override // PlatformWindow
@SuppressWarnings("deprecation")
public void toFront() { public void toFront() {
final long nsWindowPtr = getNSWindowPtr(); final long nsWindowPtr = getNSWindowPtr();
LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit(); LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if( w != null && w.getPeer() != null final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
&& ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME if( w != null && acc.getPeer(w) != null
&& ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
&& !lwcToolkit.isApplicationActive()) { && !lwcToolkit.isApplicationActive()) {
lwcToolkit.activateApplicationIgnoringOtherApps(); lwcToolkit.activateApplicationIgnoringOtherApps();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,8 @@ import java.awt.peer.TrayIconPeer;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import static sun.awt.AWTAccessor.*;
public class CTrayIcon extends CFRetainedResource implements TrayIconPeer { public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
private TrayIcon target; private TrayIcon target;
private PopupMenu popup; private PopupMenu popup;
@ -68,15 +70,15 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
updateImage(); updateImage();
} }
@SuppressWarnings("deprecation")
private CPopupMenu checkAndCreatePopupPeer() { private CPopupMenu checkAndCreatePopupPeer() {
CPopupMenu menuPeer = null; CPopupMenu menuPeer = null;
if (popup != null) { if (popup != null) {
try { try {
menuPeer = (CPopupMenu)popup.getPeer(); final MenuComponentAccessor acc = getMenuComponentAccessor();
menuPeer = acc.getPeer(popup);
if (menuPeer == null) { if (menuPeer == null) {
popup.addNotify(); popup.addNotify();
menuPeer = (CPopupMenu)popup.getPeer(); menuPeer = acc.getPeer(popup);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame; import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer; import sun.lwawt.LWWindowPeer;
@ -48,10 +49,9 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
this.nsViewPtr = nsViewPtr; this.nsViewPtr = nsViewPtr;
} }
@SuppressWarnings("deprecation")
@Override @Override
public void addNotify() { public void addNotify() {
if (getPeer() == null) { if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit(); LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this)); setPeer(toolkit.createEmbeddedFrame(this));
} }
@ -78,11 +78,12 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Synthetic event delivery for focus management * Synthetic event delivery for focus management
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(boolean activated) { public void synthesizeWindowActivation(boolean activated) {
if (isActive != activated) { if (isActive != activated) {
isActive = activated; isActive = activated;
((LWWindowPeer)getPeer()).notifyActivation(activated, null); final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
peer.notifyActivation(activated, null);
} }
} }
@ -91,13 +92,14 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Designed to be called from the main thread * Designed to be called from the main thread
* This method should be called once from the initialization of the SWT_AWT Bridge * This method should be called once from the initialization of the SWT_AWT Bridge
*/ */
@SuppressWarnings("deprecation")
public void validateWithBounds(final int x, final int y, final int width, final int height) { public void validateWithBounds(final int x, final int y, final int width, final int height) {
try { try {
final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
LWCToolkit.invokeAndWait(new Runnable() { LWCToolkit.invokeAndWait(new Runnable() {
@Override @Override
public void run() { public void run() {
((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height); peer.setBoundsPrivate(0, 0, width, height);
validate(); validate();
setVisible(true); setVisible(true);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -70,10 +70,9 @@ public class Canvas extends Component implements Accessible {
} }
@Override @Override
@SuppressWarnings("deprecation")
void setGraphicsConfiguration(GraphicsConfiguration gc) { void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
CanvasPeer peer = (CanvasPeer)getPeer(); CanvasPeer peer = (CanvasPeer) this.peer;
if (peer != null) { if (peer != null) {
gc = peer.getAppropriateGraphicsConfiguration(gc); gc = peer.getAppropriateGraphicsConfiguration(gc);
} }

View File

@ -198,7 +198,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #addNotify * @see #addNotify
* @see #removeNotify * @see #removeNotify
*/ */
transient ComponentPeer peer; transient volatile ComponentPeer peer;
/** /**
* The parent of the object. It may be <code>null</code> * The parent of the object. It may be <code>null</code>
@ -924,8 +924,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
public Cursor getCursor(Component comp) { public Cursor getCursor(Component comp) {
return comp.getCursor_NoClientCode(); return comp.getCursor_NoClientCode();
} }
public ComponentPeer getPeer(Component comp) { @SuppressWarnings("unchecked")
return comp.peer; public <T extends ComponentPeer> T getPeer(Component comp) {
return (T) comp.peer;
} }
public void setPeer(Component comp, ComponentPeer peer) { public void setPeer(Component comp, ComponentPeer peer) {
comp.peer = peer; comp.peer = peer;
@ -1068,17 +1069,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
return getParent_NoClientCode(); return getParent_NoClientCode();
} }
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers;
* replaced by <code>boolean isDisplayable()</code>.
* @return the peer for this component
*/
@Deprecated
public ComponentPeer getPeer() {
return peer;
}
/** /**
* Associate a <code>DropTarget</code> with this component. * Associate a <code>DropTarget</code> with this component.
* The <code>Component</code> will receive drops only if it * The <code>Component</code> will receive drops only if it
@ -1179,7 +1169,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
graphicsConfig = gc; graphicsConfig = gc;
ComponentPeer peer = getPeer(); ComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
return peer.updateGraphicsData(gc); return peer.updateGraphicsData(gc);
} }
@ -1281,7 +1271,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2 * @since 1.2
*/ */
public boolean isDisplayable() { public boolean isDisplayable() {
return getPeer() != null; return peer != null;
} }
/** /**
@ -2582,7 +2572,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2 * @since 1.2
*/ */
public boolean isOpaque() { public boolean isOpaque() {
if (getPeer() == null) { if (peer == null) {
return false; return false;
} }
else { else {
@ -2608,7 +2598,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2 * @since 1.2
*/ */
public boolean isLightweight() { public boolean isLightweight() {
return getPeer() instanceof LightweightPeer; return peer instanceof LightweightPeer;
} }
@ -3126,7 +3116,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
* obtained * obtained
* @return the font metrics for <code>font</code> * @return the font metrics for <code>font</code>
* @see #getFont * @see #getFont
* @see #getPeer
* @see java.awt.peer.ComponentPeer#getFontMetrics(Font) * @see java.awt.peer.ComponentPeer#getFontMetrics(Font)
* @see Toolkit#getFontMetrics(Font) * @see Toolkit#getFontMetrics(Font)
* @since 1.0 * @since 1.0
@ -3186,7 +3175,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (nativeContainer == null) return; if (nativeContainer == null) return;
ComponentPeer cPeer = nativeContainer.getPeer(); ComponentPeer cPeer = nativeContainer.peer;
if (cPeer != null) { if (cPeer != null) {
cPeer.updateCursorImmediately(); cPeer.updateCursorImmediately();
@ -5019,7 +5008,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (source != null) { if (source != null) {
Container target = source.getNativeContainer(); Container target = source.getNativeContainer();
if (target != null) { if (target != null) {
tpeer = target.getPeer(); tpeer = target.peer;
} }
} }
} }
@ -9851,7 +9840,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
if (!isLightweight()) { if (!isLightweight()) {
ComponentPeer peer = getPeer(); ComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
// The Region class has some optimizations. That's why // The Region class has some optimizations. That's why
// we should manually check whether it's empty and // we should manually check whether it's empty and
@ -9975,7 +9964,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
for (int i = indexAbove; i > -1; i--) { for (int i = indexAbove; i > -1; i--) {
Component comp = cont.getComponent(i); Component comp = cont.getComponent(i);
if (comp != null && comp.isDisplayable() && !comp.isLightweight()) { if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
return comp.getPeer(); return comp.peer;
} }
} }
// traversing the hierarchy up to the closest HW container; // traversing the hierarchy up to the closest HW container;

View File

@ -820,7 +820,7 @@ public class Container extends Component {
} }
} else { } else {
// Q: Need to update NativeInLightFixer? // Q: Need to update NativeInLightFixer?
comp.getPeer().reparent(parentPeer); comp.peer.reparent(parentPeer);
} }
} }
} }
@ -840,10 +840,10 @@ public class Container extends Component {
// If component is lightweight container we need to reparent all its explicit heavyweight children // If component is lightweight container we need to reparent all its explicit heavyweight children
if (comp instanceof Container) { if (comp instanceof Container) {
// Traverse component's tree till depth-first until encountering heavyweight component // Traverse component's tree till depth-first until encountering heavyweight component
reparentTraverse((ContainerPeer)getPeer(), (Container)comp); reparentTraverse((ContainerPeer)peer, (Container)comp);
} }
} else { } else {
comp.getPeer().reparent((ContainerPeer)getPeer()); comp.peer.reparent((ContainerPeer) peer);
} }
} }
@ -4195,7 +4195,7 @@ public class Container extends Component {
} }
} else { } else {
if (comp.isVisible()) { if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = comp.peer;
if (peer != null) { if (peer != null) {
peer.setVisible(true); peer.setVisible(true);
} }
@ -4217,7 +4217,7 @@ public class Container extends Component {
} }
} else { } else {
if (comp.isVisible()) { if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = comp.peer;
if (peer != null) { if (peer != null) {
peer.setVisible(false); peer.setVisible(false);
} }
@ -4239,7 +4239,7 @@ public class Container extends Component {
((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin); ((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin);
} }
} else { } else {
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = comp.peer;
if (peer != null) { if (peer != null) {
peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(), peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(),
comp.getWidth(), comp.getHeight(), comp.getWidth(), comp.getHeight(),

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -93,7 +93,6 @@ public class DefaultFocusTraversalPolicy
* @return <code>true</code> if aComponent meets the above requirements; * @return <code>true</code> if aComponent meets the above requirements;
* <code>false</code> otherwise * <code>false</code> otherwise
*/ */
@SuppressWarnings("deprecation")
protected boolean accept(Component aComponent) { protected boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() && if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isEnabled())) aComponent.isEnabled()))
@ -123,7 +122,7 @@ public class DefaultFocusTraversalPolicy
return focusable; return focusable;
} }
ComponentPeer peer = aComponent.getPeer(); ComponentPeer peer = aComponent.peer;
return (peer != null && peer.isFocusable()); return (peer != null && peer.isFocusable());
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -796,7 +796,6 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
* @return <code>true</code> * @return <code>true</code>
* @see Component#dispatchEvent * @see Component#dispatchEvent
*/ */
@SuppressWarnings("deprecation")
public boolean dispatchKeyEvent(KeyEvent e) { public boolean dispatchKeyEvent(KeyEvent e) {
Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent(); Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();
@ -824,14 +823,14 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// Allow the peer to process KeyEvent // Allow the peer to process KeyEvent
Component source = e.getComponent(); Component source = e.getComponent();
ComponentPeer peer = source.getPeer(); ComponentPeer peer = source.peer;
if (peer == null || peer instanceof LightweightPeer) { if (peer == null || peer instanceof LightweightPeer) {
// if focus owner is lightweight then its native container // if focus owner is lightweight then its native container
// processes event // processes event
Container target = source.getNativeContainer(); Container target = source.getNativeContainer();
if (target != null) { if (target != null) {
peer = target.getPeer(); peer = target.peer;
} }
} }
if (peer != null) { if (peer != null) {
@ -1049,7 +1048,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
Component source = (Component)ke.getSource(); Component source = (Component)ke.getSource();
Container target = source.getNativeContainer(); Container target = source.getNativeContainer();
if (target != null) { if (target != null) {
ComponentPeer peer = target.getPeer(); ComponentPeer peer = target.peer;
if (peer != null) { if (peer != null) {
peer.handleEvent(ke); peer.handleEvent(ke);
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,11 +36,9 @@ import javax.accessibility.*;
import sun.awt.AppContext; import sun.awt.AppContext;
import sun.awt.AWTPermissions; import sun.awt.AWTPermissions;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.awt.PeerEvent;
import sun.awt.util.IdentityArrayList; import sun.awt.util.IdentityArrayList;
import sun.awt.util.IdentityLinkedList; import sun.awt.util.IdentityLinkedList;
import java.security.AccessControlException; import java.security.AccessControlException;
import java.util.function.BooleanSupplier;
/** /**
* A Dialog is a top-level window with a title and a border * A Dialog is a top-level window with a title and a border
@ -749,10 +747,9 @@ public class Dialog extends Window {
* @see Component#isDisplayable * @see Component#isDisplayable
* @see #removeNotify * @see #removeNotify
*/ */
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (parent != null && parent.getPeer() == null) { if (parent != null && parent.peer == null) {
parent.addNotify(); parent.addNotify();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -314,10 +314,9 @@ public class FileDialog extends Dialog {
* Creates the file dialog's peer. The peer allows us to change the look * Creates the file dialog's peer. The peer allows us to change the look
* of the file dialog without changing its functionality. * of the file dialog without changing its functionality.
*/ */
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
if (parent != null && parent.getPeer() == null) { if (parent != null && parent.peer == null) {
parent.addNotify(); parent.addNotify();
} }
if (peer == null) if (peer == null)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,6 @@ import java.security.AccessController;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.text.AttributedCharacterIterator.Attribute; import java.text.AttributedCharacterIterator.Attribute;
import java.text.CharacterIterator; import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -239,6 +238,11 @@ public class Font implements java.io.Serializable
public boolean isCreatedFont(Font font) { public boolean isCreatedFont(Font font) {
return font.createdFont; return font.createdFont;
} }
@Override
public FontPeer getFontPeer(final Font font) {
return font.getFontPeer();
}
} }
static { static {
@ -434,24 +438,15 @@ public class Font implements java.io.Serializable
private static final long serialVersionUID = -4206021311591459213L; private static final long serialVersionUID = -4206021311591459213L;
/** /**
* Gets the peer of this <code>Font</code>. * Gets the peer of this {@code Font}.
* @return the peer of the <code>Font</code>. *
* @since 1.1 * @return the peer of the {@code Font}.
* @deprecated Font rendering is now platform independent.
*/ */
@Deprecated
public FontPeer getPeer(){
return getPeer_NoClientCode();
}
// NOTE: This method is called by privileged threads.
// We implement this functionality in a package-private method
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() { private FontPeer getFontPeer() {
if(peer == null) { if(peer == null) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
this.peer = tk.getFontPeer(name, style); peer = tk.getFontPeer(name, style);
} }
return peer; return peer;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -3054,11 +3054,10 @@ public abstract class KeyboardFocusManager
return (wto != wfrom); return (wto != wfrom);
} }
@SuppressWarnings("deprecation")
static Component getHeavyweight(Component comp) { static Component getHeavyweight(Component comp) {
if (comp == null || comp.getPeer() == null) { if (comp == null || comp.peer == null) {
return null; return null;
} else if (comp.getPeer() instanceof LightweightPeer) { } else if (comp.peer instanceof LightweightPeer) {
return comp.getNativeContainer(); return comp.getNativeContainer();
} else { } else {
return comp; return comp;

View File

@ -57,7 +57,7 @@ public abstract class MenuComponent implements java.io.Serializable {
} }
} }
transient MenuComponentPeer peer; transient volatile MenuComponentPeer peer;
transient MenuContainer parent; transient MenuContainer parent;
/** /**
@ -142,6 +142,11 @@ public abstract class MenuComponent implements java.io.Serializable {
menuComp.appContext = appContext; menuComp.appContext = appContext;
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T extends MenuComponentPeer> T getPeer(MenuComponent menuComp) {
return (T) menuComp.peer;
}
@Override
public MenuContainer getParent(MenuComponent menuComp) { public MenuContainer getParent(MenuComponent menuComp) {
return menuComp.parent; return menuComp.parent;
} }
@ -225,16 +230,6 @@ public abstract class MenuComponent implements java.io.Serializable {
return parent; return parent;
} }
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers.
* @return the peer for this component
*/
@Deprecated
public MenuComponentPeer getPeer() {
return peer;
}
/** /**
* Gets the font used for this menu component. * Gets the font used for this menu component.
* @return the font used in this menu component, if there is one; * @return the font used in this menu component, if there is one;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -153,7 +153,6 @@ public class PopupMenu extends Menu {
* parent's hierarchy * parent's hierarchy
* @exception RuntimeException if the parent is not showing on screen * @exception RuntimeException if the parent is not showing on screen
*/ */
@SuppressWarnings("deprecation")
public void show(Component origin, int x, int y) { public void show(Component origin, int x, int y) {
// Use localParent for thread safety. // Use localParent for thread safety.
MenuContainer localParent = parent; MenuContainer localParent = parent;
@ -177,7 +176,7 @@ public class PopupMenu extends Menu {
throw new IllegalArgumentException("origin not in parent's hierarchy"); throw new IllegalArgumentException("origin not in parent's hierarchy");
} }
} }
if (compParent.getPeer() == null || !compParent.isShowing()) { if (compParent.peer == null || !compParent.isShowing()) {
throw new RuntimeException("parent not showing on screen"); throw new RuntimeException("parent not showing on screen");
} }
if (peer == null) { if (peer == null) {

View File

@ -29,7 +29,6 @@ import java.awt.geom.Path2D;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.im.InputContext; import java.awt.im.InputContext;
import java.awt.image.BufferStrategy; import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.awt.peer.WindowPeer; import java.awt.peer.WindowPeer;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
@ -56,7 +55,6 @@ import sun.awt.AppContext;
import sun.awt.CausedFocusEvent; import sun.awt.CausedFocusEvent;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.awt.util.IdentityArrayList; import sun.awt.util.IdentityArrayList;
import sun.java2d.Disposer;
import sun.java2d.pipe.Region; import sun.java2d.pipe.Region;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
@ -755,11 +753,10 @@ public class Window extends Container implements Accessible {
* @see Container#removeNotify * @see Container#removeNotify
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
Container parent = this.parent; Container parent = this.parent;
if (parent != null && parent.getPeer() == null) { if (parent != null && parent.peer == null) {
parent.addNotify(); parent.addNotify();
} }
if (peer == null) { if (peer == null) {
@ -802,7 +799,7 @@ public class Window extends Container implements Accessible {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void pack() { public void pack() {
Container parent = this.parent; Container parent = this.parent;
if (parent != null && parent.getPeer() == null) { if (parent != null && parent.peer == null) {
parent.addNotify(); parent.addNotify();
} }
if (peer == null) { if (peer == null) {
@ -1072,10 +1069,9 @@ public class Window extends Container implements Accessible {
} }
} }
@SuppressWarnings("deprecation")
static void updateChildFocusableWindowState(Window w) { static void updateChildFocusableWindowState(Window w) {
if (w.getPeer() != null && w.isShowing()) { if (w.peer != null && w.isShowing()) {
((WindowPeer)w.getPeer()).updateFocusableWindowState(); ((WindowPeer)w.peer).updateFocusableWindowState();
} }
for (int i = 0; i < w.ownedWindowList.size(); i++) { for (int i = 0; i < w.ownedWindowList.size(); i++) {
Window child = w.ownedWindowList.elementAt(i).get(); Window child = w.ownedWindowList.elementAt(i).get();
@ -1160,10 +1156,9 @@ public class Window extends Container implements Accessible {
* as reported in javadoc. So we need to implement this functionality even if a * as reported in javadoc. So we need to implement this functionality even if a
* child overrides dispose() in a wrong way without calling super.dispose(). * child overrides dispose() in a wrong way without calling super.dispose().
*/ */
@SuppressWarnings("deprecation")
void disposeImpl() { void disposeImpl() {
dispose(); dispose();
if (getPeer() != null) { if (peer != null) {
doDispose(); doDispose();
} }
} }
@ -3651,7 +3646,7 @@ public class Window extends Container implements Accessible {
} }
} }
this.opacity = opacity; this.opacity = opacity;
WindowPeer peer = (WindowPeer)getPeer(); WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) { if (peer != null) {
peer.setOpacity(opacity); peer.setOpacity(opacity);
} }
@ -3728,7 +3723,6 @@ public class Window extends Container implements Accessible {
* *
* @since 1.7 * @since 1.7
*/ */
@SuppressWarnings("deprecation")
public void setShape(Shape shape) { public void setShape(Shape shape) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (shape != null) { if (shape != null) {
@ -3746,7 +3740,7 @@ public class Window extends Container implements Accessible {
} }
} }
this.shape = (shape == null) ? null : new Path2D.Float(shape); this.shape = (shape == null) ? null : new Path2D.Float(shape);
WindowPeer peer = (WindowPeer)getPeer(); WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) { if (peer != null) {
peer.applyShape(shape == null ? null : Region.getInstance(shape, null)); peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
} }
@ -3846,7 +3840,6 @@ public class Window extends Container implements Accessible {
* @see GraphicsConfiguration#isTranslucencyCapable() * @see GraphicsConfiguration#isTranslucencyCapable()
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public void setBackground(Color bgColor) { public void setBackground(Color bgColor) {
Color oldBg = getBackground(); Color oldBg = getBackground();
super.setBackground(bgColor); super.setBackground(bgColor);
@ -3874,7 +3867,7 @@ public class Window extends Container implements Accessible {
} else if ((oldAlpha < 255) && (alpha == 255)) { } else if ((oldAlpha < 255) && (alpha == 255)) {
setLayersOpaque(this, true); setLayersOpaque(this, true);
} }
WindowPeer peer = (WindowPeer)getPeer(); WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) { if (peer != null) {
peer.setOpaque(alpha == 255); peer.setOpaque(alpha == 255);
} }
@ -3899,10 +3892,9 @@ public class Window extends Container implements Accessible {
return bg != null ? bg.getAlpha() == 255 : true; return bg != null ? bg.getAlpha() == 255 : true;
} }
@SuppressWarnings("deprecation")
private void updateWindow() { private void updateWindow() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
WindowPeer peer = (WindowPeer)getPeer(); WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) { if (peer != null) {
peer.updateWindow(); peer.updateWindow();
} }
@ -4090,7 +4082,6 @@ public class Window extends Container implements Accessible {
window.securityWarningHeight = height; window.securityWarningHeight = height;
} }
@SuppressWarnings("deprecation")
public void setSecurityWarningPosition(Window window, public void setSecurityWarningPosition(Window window,
Point2D point, float alignmentX, float alignmentY) Point2D point, float alignmentX, float alignmentY)
{ {
@ -4100,7 +4091,7 @@ public class Window extends Container implements Accessible {
window.securityWarningAlignmentY = alignmentY; window.securityWarningAlignmentY = alignmentY;
synchronized (window.getTreeLock()) { synchronized (window.getTreeLock()) {
WindowPeer peer = (WindowPeer)window.getPeer(); WindowPeer peer = (WindowPeer) window.peer;
if (peer != null) { if (peer != null) {
peer.repositionSecurityWarning(); peer.repositionSecurityWarning();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,6 +49,9 @@ import java.awt.peer.ComponentPeer;
import java.awt.peer.LightweightPeer; import java.awt.peer.LightweightPeer;
import java.awt.dnd.peer.DropTargetPeer; import java.awt.dnd.peer.DropTargetPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
/** /**
* The <code>DropTarget</code> is associated * The <code>DropTarget</code> is associated
@ -499,15 +502,15 @@ public class DropTarget implements DropTargetListener, Serializable {
* *
*/ */
@SuppressWarnings("deprecation")
public void addNotify(ComponentPeer peer) { public void addNotify(ComponentPeer peer) {
if (peer == componentPeer) return; if (peer == componentPeer) return;
componentPeer = peer; componentPeer = peer;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
for (Component c = component; for (Component c = component;
c != null && peer instanceof LightweightPeer; c = c.getParent()) { c != null && peer instanceof LightweightPeer; c = c.getParent()) {
peer = c.getPeer(); peer = acc.getPeer(c);
} }
if (peer instanceof DropTargetPeer) { if (peer instanceof DropTargetPeer) {

View File

@ -57,6 +57,7 @@ import javax.swing.plaf.*;
import static javax.swing.ClientPropertyKey.*; import static javax.swing.ClientPropertyKey.*;
import javax.accessibility.*; import javax.accessibility.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
import sun.swing.UIClientPropertyKey; import sun.swing.UIClientPropertyKey;
@ -4218,9 +4219,10 @@ public abstract class JComponent extends Container implements Serializable,
* @param c the {@code Component} to be checked * @param c the {@code Component} to be checked
* @return true if this component is lightweight * @return true if this component is lightweight
*/ */
@SuppressWarnings("deprecation")
public static boolean isLightweightComponent(Component c) { public static boolean isLightweightComponent(Component c) {
return c.getPeer() instanceof LightweightPeer; // TODO we cannot call c.isLightweight() because it is incorrectly
// overriden in DelegateContainer on osx.
return AWTAccessor.getComponentAccessor().isLightweight(c);
} }
@ -5033,7 +5035,6 @@ public abstract class JComponent extends Container implements Serializable,
this.paintingChild = paintingChild; this.paintingChild = paintingChild;
} }
@SuppressWarnings("deprecation")
void _paintImmediately(int x, int y, int w, int h) { void _paintImmediately(int x, int y, int w, int h) {
Graphics g; Graphics g;
Container c; Container c;
@ -5159,7 +5160,7 @@ public abstract class JComponent extends Container implements Serializable,
} }
// If the clip width or height is negative, don't bother painting // If the clip width or height is negative, don't bother painting
if(c == null || c.getPeer() == null || if(c == null || !c.isDisplayable() ||
paintImmediatelyClip.width <= 0 || paintImmediatelyClip.width <= 0 ||
paintImmediatelyClip.height <= 0) { paintImmediatelyClip.height <= 0) {
recycleRectangle(paintImmediatelyClip); recycleRectangle(paintImmediatelyClip);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,8 @@ import javax.accessibility.*;
import java.io.Serializable; import java.io.Serializable;
import sun.awt.AWTAccessor;
/** /**
* The "viewport" or "porthole" through which you see the underlying * The "viewport" or "porthole" through which you see the underlying
* information. When you scroll, what moves is the viewport. It is like * information. When you scroll, what moves is the viewport. It is like
@ -380,7 +382,6 @@ public class JViewport extends JComponent implements Accessible
* @param contentRect the <code>Rectangle</code> to display * @param contentRect the <code>Rectangle</code> to display
* @see JComponent#isValidateRoot * @see JComponent#isValidateRoot
* @see java.awt.Component#isValid * @see java.awt.Component#isValid
* @see java.awt.Component#getPeer
*/ */
public void scrollRectToVisible(Rectangle contentRect) { public void scrollRectToVisible(Rectangle contentRect) {
Component view = getView(); Component view = getView();
@ -1448,7 +1449,6 @@ public class JViewport extends JComponent implements Accessible
* Returns true if the component needs to be completely repainted after * Returns true if the component needs to be completely repainted after
* a blit and a paint is received. * a blit and a paint is received.
*/ */
@SuppressWarnings("deprecation")
private boolean needsRepaintAfterBlit() { private boolean needsRepaintAfterBlit() {
// Find the first heavy weight ancestor. isObscured and // Find the first heavy weight ancestor. isObscured and
// canDetermineObscurity are only appropriate for heavy weights. // canDetermineObscurity are only appropriate for heavy weights.
@ -1459,7 +1459,8 @@ public class JViewport extends JComponent implements Accessible
} }
if (heavyParent != null) { if (heavyParent != null) {
ComponentPeer peer = heavyParent.getPeer(); ComponentPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(heavyParent);
if (peer != null && peer.canDetermineObscurity() && if (peer != null && peer.canDetermineObscurity() &&
!peer.isObscured()) { !peer.isObscured()) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -401,7 +401,6 @@ public class RepaintManager
* *
* @see JComponent#repaint * @see JComponent#repaint
*/ */
@SuppressWarnings("deprecation")
private void addDirtyRegion0(Container c, int x, int y, int w, int h) { private void addDirtyRegion0(Container c, int x, int y, int w, int h) {
/* Special cases we don't have to bother with. /* Special cases we don't have to bother with.
*/ */
@ -432,7 +431,7 @@ public class RepaintManager
// it could lead to the possibility of getting locks out // it could lead to the possibility of getting locks out
// of order and deadlocking. // of order and deadlocking.
for (Container p = c; p != null; p = p.getParent()) { for (Container p = c; p != null; p = p.getParent()) {
if (!p.isVisible() || (p.getPeer() == null)) { if (!p.isVisible() || !p.isDisplayable()) {
return; return;
} }
if ((p instanceof Window) || (p instanceof Applet)) { if ((p instanceof Window) || (p instanceof Applet)) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@
package javax.swing.plaf.basic; package javax.swing.plaf.basic;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.swing.DefaultLookup; import sun.swing.DefaultLookup;
import sun.swing.UIAction; import sun.swing.UIAction;
import javax.swing.*; import javax.swing.*;
@ -1191,7 +1193,6 @@ public class BasicSplitPaneUI extends SplitPaneUI
* Should be messaged before the dragging session starts, resets * Should be messaged before the dragging session starts, resets
* lastDragLocation and dividerSize. * lastDragLocation and dividerSize.
*/ */
@SuppressWarnings("deprecation")
protected void startDragging() { protected void startDragging() {
Component leftC = splitPane.getLeftComponent(); Component leftC = splitPane.getLeftComponent();
Component rightC = splitPane.getRightComponent(); Component rightC = splitPane.getRightComponent();
@ -1199,10 +1200,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
beginDragDividerLocation = getDividerLocation(splitPane); beginDragDividerLocation = getDividerLocation(splitPane);
draggingHW = false; draggingHW = false;
if(leftC != null && (cPeer = leftC.getPeer()) != null && final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if(leftC != null && (cPeer = acc.getPeer(leftC)) != null &&
!(cPeer instanceof LightweightPeer)) { !(cPeer instanceof LightweightPeer)) {
draggingHW = true; draggingHW = true;
} else if(rightC != null && (cPeer = rightC.getPeer()) != null } else if(rightC != null && (cPeer = acc.getPeer(rightC)) != null
&& !(cPeer instanceof LightweightPeer)) { && !(cPeer instanceof LightweightPeer)) {
draggingHW = true; draggingHW = true;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,8 +29,6 @@ import sun.misc.Unsafe;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import java.awt.*; import java.awt.*;
import java.awt.KeyboardFocusManager;
import java.awt.DefaultKeyboardFocusManager;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.InvocationEvent; import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -38,6 +36,7 @@ import java.awt.geom.Point2D;
import java.awt.image.BufferStrategy; import java.awt.image.BufferStrategy;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.awt.peer.MenuComponentPeer;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.security.AccessControlContext; import java.security.AccessControlContext;
@ -171,7 +170,7 @@ public final class AWTAccessor {
/** /**
* Returns the peer of the component. * Returns the peer of the component.
*/ */
ComponentPeer getPeer(Component comp); <T extends ComponentPeer> T getPeer(Component comp);
/** /**
* Sets the peer of the component to the specified peer. * Sets the peer of the component to the specified peer.
@ -480,6 +479,11 @@ public final class AWTAccessor {
*/ */
void setAppContext(MenuComponent menuComp, AppContext appContext); void setAppContext(MenuComponent menuComp, AppContext appContext);
/**
* Returns the peer of the menu component.
*/
<T extends MenuComponentPeer> T getPeer(MenuComponent menuComp);
/** /**
* Returns the menu container of the menu component. * Returns the menu container of the menu component.
*/ */

View File

@ -27,14 +27,12 @@ package sun.awt;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.image.*;
import java.awt.peer.*; import java.awt.peer.*;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.util.Set; import java.util.Set;
import java.awt.AWTKeyStroke; import java.awt.AWTKeyStroke;
import java.applet.Applet; import java.applet.Applet;
import sun.applet.AppletPanel;
/** /**
* A generic container used for embedding Java components, usually applets. * A generic container used for embedding Java components, usually applets.
@ -320,10 +318,9 @@ public abstract class EmbeddedFrame extends Frame
return true; return true;
} }
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (getPeer() == null) { if (!isDisplayable()) {
setPeer(new NullEmbeddedFramePeer()); setPeer(new NullEmbeddedFramePeer());
} }
super.addNotify(); super.addNotify();
@ -331,10 +328,10 @@ public abstract class EmbeddedFrame extends Frame
} }
// These three functions consitute RFE 4100710. Do not remove. // These three functions consitute RFE 4100710. Do not remove.
@SuppressWarnings("deprecation")
public void setCursorAllowed(boolean isCursorAllowed) { public void setCursorAllowed(boolean isCursorAllowed) {
this.isCursorAllowed = isCursorAllowed; this.isCursorAllowed = isCursorAllowed;
getPeer().updateCursorImmediately(); final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
peer.updateCursorImmediately();
} }
public boolean isCursorAllowed() { public boolean isCursorAllowed() {
return isCursorAllowed; return isCursorAllowed;
@ -345,7 +342,6 @@ public abstract class EmbeddedFrame extends Frame
: Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
} }
@SuppressWarnings("deprecation")
protected void setPeer(final ComponentPeer p){ protected void setPeer(final ComponentPeer p){
AWTAccessor.getComponentAccessor().setPeer(EmbeddedFrame.this, p); AWTAccessor.getComponentAccessor().setPeer(EmbeddedFrame.this, p);
}; };
@ -458,9 +454,8 @@ public abstract class EmbeddedFrame extends Frame
* @see #getBoundsPrivate * @see #getBoundsPrivate
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("deprecation")
protected void setBoundsPrivate(int x, int y, int width, int height) { protected void setBoundsPrivate(int x, int y, int width, int height) {
final FramePeer peer = (FramePeer)getPeer(); final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
if (peer != null) { if (peer != null) {
peer.setBoundsPrivate(x, y, width, height); peer.setBoundsPrivate(x, y, width, height);
} }
@ -490,9 +485,8 @@ public abstract class EmbeddedFrame extends Frame
* @see #setBoundsPrivate * @see #setBoundsPrivate
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("deprecation")
protected Rectangle getBoundsPrivate() { protected Rectangle getBoundsPrivate() {
final FramePeer peer = (FramePeer)getPeer(); final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
if (peer != null) { if (peer != null) {
return peer.getBoundsPrivate(); return peer.getBoundsPrivate();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,6 @@
package sun.awt; package sun.awt;
import java.awt.Component; import java.awt.Component;
import java.awt.KeyboardFocusManager;
import java.awt.Window; import java.awt.Window;
import java.awt.Canvas; import java.awt.Canvas;
import java.awt.Scrollbar; import java.awt.Scrollbar;
@ -36,9 +35,7 @@ import java.awt.event.FocusEvent;
import java.awt.peer.KeyboardFocusManagerPeer; import java.awt.peer.KeyboardFocusManagerPeer;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.lang.reflect.InvocationTargetException; import sun.awt.AWTAccessor.ComponentAccessor;
import java.lang.reflect.Method;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer { public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer {
@ -75,7 +72,6 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
* 1) accepts focus on click (in general) * 1) accepts focus on click (in general)
* 2) may be a focus owner (in particular) * 2) may be a focus owner (in particular)
*/ */
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) { public static boolean shouldFocusOnClick(Component component) {
boolean acceptFocusOnClick = false; boolean acceptFocusOnClick = false;
@ -84,6 +80,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
// CANVAS & SCROLLBAR accept focus on click // CANVAS & SCROLLBAR accept focus on click
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (component instanceof Canvas || if (component instanceof Canvas ||
component instanceof Scrollbar) component instanceof Scrollbar)
{ {
@ -96,11 +93,10 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
// Other components // Other components
} else { } else {
ComponentPeer peer = (component != null ? component.getPeer() : null); ComponentPeer peer = (component != null ? acc.getPeer(component) : null);
acceptFocusOnClick = (peer != null ? peer.isFocusable() : false); acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
} }
return acceptFocusOnClick && return acceptFocusOnClick && acc.canBeFocusOwner(component);
AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
} }
/* /*
@ -120,7 +116,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
} }
Component currentOwner = currentFocusOwner; Component currentOwner = currentFocusOwner;
if (currentOwner != null && currentOwner.getPeer() == null) { if (currentOwner != null && !currentOwner.isDisplayable()) {
currentOwner = null; currentOwner = null;
} }
if (currentOwner != null) { if (currentOwner != null) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -91,7 +91,7 @@ public abstract class LightweightFrame extends Frame {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override public void addNotify() { @Override public void addNotify() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (getPeer() == null) { if (!isDisplayable()) {
SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit(); SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit();
try { try {
setPeer(stk.createLightweightFrame(this)); setPeer(stk.createLightweightFrame(this));
@ -115,9 +115,9 @@ public abstract class LightweightFrame extends Frame {
* @param activate if <code>true</code>, activates the frame; * @param activate if <code>true</code>, activates the frame;
* otherwise, deactivates the frame * otherwise, deactivates the frame
*/ */
@SuppressWarnings("deprecation")
public void emulateActivation(boolean activate) { public void emulateActivation(boolean activate) {
((FramePeer)getPeer()).emulateActivation(activate); final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
peer.emulateActivation(activate);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,11 +47,10 @@ public abstract class SunGraphicsCallback {
g.clipRect(0, 0, bounds.width, bounds.height); g.clipRect(0, 0, bounds.width, bounds.height);
} }
@SuppressWarnings("deprecation")
public final void runOneComponent(Component comp, Rectangle bounds, public final void runOneComponent(Component comp, Rectangle bounds,
Graphics g, Shape clip, Graphics g, Shape clip,
int weightFlags) { int weightFlags) {
if (comp == null || comp.getPeer() == null || !comp.isVisible()) { if (comp == null || !comp.isDisplayable() || !comp.isVisible()) {
return; return;
} }
boolean lightweight = comp.isLightweight(); boolean lightweight = comp.isLightweight();

View File

@ -26,6 +26,7 @@
package sun.font; package sun.font;
import java.awt.Font; import java.awt.Font;
import java.awt.peer.FontPeer;
public abstract class FontAccess { public abstract class FontAccess {
@ -45,4 +46,5 @@ public abstract class FontAccess {
public abstract void setFont2D(Font f, Font2DHandle h); public abstract void setFont2D(Font f, Font2DHandle h);
public abstract void setCreatedFont(Font f); public abstract void setCreatedFont(Font f);
public abstract boolean isCreatedFont(Font f); public abstract boolean isCreatedFont(Font f);
public abstract FontPeer getFontPeer(Font f);
} }

View File

@ -46,6 +46,7 @@ import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.peer.FontPeer;
import java.awt.print.Pageable; import java.awt.print.Pageable;
import java.awt.print.PageFormat; import java.awt.print.PageFormat;
import java.awt.print.Paper; import java.awt.print.Paper;
@ -93,6 +94,7 @@ import sun.awt.FontConfiguration;
import sun.awt.FontDescriptor; import sun.awt.FontDescriptor;
import sun.awt.PlatformFont; import sun.awt.PlatformFont;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.font.FontAccess;
import sun.font.FontManagerFactory; import sun.font.FontManagerFactory;
import sun.font.FontUtilities; import sun.font.FontUtilities;
@ -1214,13 +1216,13 @@ public class PSPrinterJob extends RasterPrinterJob {
* of distinct PS fonts needed to draw this text. This saves us * of distinct PS fonts needed to draw this text. This saves us
* doing this processing one extra time. * doing this processing one extra time.
*/ */
@SuppressWarnings("deprecation")
protected int platformFontCount(Font font, String str) { protected int platformFontCount(Font font, String str) {
if (mFontProps == null) { if (mFontProps == null) {
return 0; return 0;
} }
CharsetString[] acs = PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false); .getFontPeer(font);
CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) { if (acs == null) {
/* AWT can't convert all chars so use 2D path */ /* AWT can't convert all chars so use 2D path */
return 0; return 0;
@ -1229,7 +1231,6 @@ public class PSPrinterJob extends RasterPrinterJob {
return (psFonts == null) ? 0 : psFonts.length; return (psFonts == null) ? 0 : psFonts.length;
} }
@SuppressWarnings("deprecation")
protected boolean textOut(Graphics g, String str, float x, float y, protected boolean textOut(Graphics g, String str, float x, float y,
Font mLastFont, FontRenderContext frc, Font mLastFont, FontRenderContext frc,
float width) { float width) {
@ -1254,9 +1255,9 @@ public class PSPrinterJob extends RasterPrinterJob {
if (str.length() == 0) { if (str.length() == 0) {
return true; return true;
} }
CharsetString[] acs = PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
((PlatformFont) .getFontPeer(mLastFont);
(mLastFont.getPeer())).makeMultiCharsetString(str, false); CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) { if (acs == null) {
/* AWT can't convert all chars so use 2D path */ /* AWT can't convert all chars so use 2D path */
return false; return false;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -61,6 +61,7 @@ import javax.swing.RepaintManager;
import javax.swing.RootPaneContainer; import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import sun.awt.AWTAccessor;
import sun.awt.DisplayChangedListener; import sun.awt.DisplayChangedListener;
import sun.awt.LightweightFrame; import sun.awt.LightweightFrame;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
@ -241,7 +242,6 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
} }
@Override @Override
@SuppressWarnings("deprecation")
public void notifyDisplayChanged(final int scaleFactor) { public void notifyDisplayChanged(final int scaleFactor) {
if (scaleFactor != this.scaleFactor) { if (scaleFactor != this.scaleFactor) {
if (!copyBufferEnabled) content.paintLock(); if (!copyBufferEnabled) content.paintLock();
@ -254,18 +254,19 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
} }
this.scaleFactor = scaleFactor; this.scaleFactor = scaleFactor;
} }
if (getPeer() instanceof DisplayChangedListener) { final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
((DisplayChangedListener)getPeer()).displayChanged(); if (peer instanceof DisplayChangedListener) {
((DisplayChangedListener) peer).displayChanged();
} }
repaint(); repaint();
} }
@Override @Override
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
super.addNotify(); super.addNotify();
if (getPeer() instanceof DisplayChangedListener) { final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
((DisplayChangedListener)getPeer()).displayChanged(); if (peer instanceof DisplayChangedListener) {
((DisplayChangedListener) peer).displayChanged();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -326,9 +326,8 @@ abstract public class XBaseMenuWindow extends XWindow {
* check for adding duplicate items * check for adding duplicate items
* @param item item to add * @param item item to add
*/ */
@SuppressWarnings("deprecation")
public void addItem(MenuItem item) { public void addItem(MenuItem item) {
XMenuItemPeer mp = (XMenuItemPeer)item.getPeer(); XMenuItemPeer mp = AWTAccessor.getMenuComponentAccessor().getPeer(item);
if (mp != null) { if (mp != null) {
mp.setContainer(this); mp.setContainer(this);
synchronized(getMenuTreeLock()) { synchronized(getMenuTreeLock()) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
import java.awt.event.PaintEvent; import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.InvocationEvent;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer; import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage; import java.awt.image.VolatileImage;
@ -63,6 +62,8 @@ import java.security.*;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import sun.awt.*; import sun.awt.*;
import sun.awt.event.IgnorePaintEvent; import sun.awt.event.IgnorePaintEvent;
@ -182,7 +183,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
if (container instanceof Window) { if (container instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(container.getPeer()); XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(container);
if (wpeer != null) { if (wpeer != null) {
return (wpeer.winAttr.visibilityState != return (wpeer.winAttr.visibilityState !=
XWindowAttributesData.AWT_UNOBSCURED); XWindowAttributesData.AWT_UNOBSCURED);
@ -319,7 +321,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
if (parentWindow == null) { if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null"); return rejectFocusRequestHelper("WARNING: Parent window is null");
} }
XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer(); XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer == null) { if (wpeer == null) {
return rejectFocusRequestHelper("WARNING: Parent window's peer is null"); return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
} }
@ -390,7 +393,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
/** /**
* @see java.awt.peer.ComponentPeer * @see java.awt.peer.ComponentPeer
*/ */
@SuppressWarnings("deprecation")
public void setEnabled(final boolean value) { public void setEnabled(final boolean value) {
if (enableLog.isLoggable(PlatformLogger.Level.FINE)) { if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this); enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
@ -399,8 +401,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
// If any of our heavyweight ancestors are disable, we should be too // If any of our heavyweight ancestors are disable, we should be too
// See 6176875 for more information // See 6176875 for more information
final Container cp = SunToolkit.getNativeContainer(target); final Container cp = SunToolkit.getNativeContainer(target);
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (cp != null) { if (cp != null) {
status &= ((XComponentPeer) cp.getPeer()).isEnabled(); status &= acc.<XComponentPeer>getPeer(cp).isEnabled();
} }
synchronized (getStateLock()) { synchronized (getStateLock()) {
if (enabled == status) { if (enabled == status) {
@ -412,7 +415,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
if (target instanceof Container) { if (target instanceof Container) {
final Component[] list = ((Container) target).getComponents(); final Component[] list = ((Container) target).getComponents();
for (final Component child : list) { for (final Component child : list) {
final ComponentPeer p = child.getPeer(); final ComponentPeer p = acc.getPeer(child);
if (p != null) { if (p != null) {
p.setEnabled(status && child.isEnabled()); p.setEnabled(status && child.isEnabled());
} }
@ -489,7 +492,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
XWindowPeer getParentTopLevel() { XWindowPeer getParentTopLevel() {
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target)); Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
// Search for parent window // Search for parent window
while (parent != null && !(parent instanceof Window)) { while (parent != null && !(parent instanceof Window)) {
@ -1327,11 +1330,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
} }
@SuppressWarnings("deprecation")
private void addTree(Collection<Long> order, Set<Long> set, Container cont) { private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
for (int i = 0; i < cont.getComponentCount(); i++) { for (int i = 0; i < cont.getComponentCount(); i++) {
Component comp = cont.getComponent(i); Component comp = cont.getComponent(i);
ComponentPeer peer = comp.getPeer(); Object peer = AWTAccessor.getComponentAccessor().getPeer(comp);
if (peer instanceof XComponentPeer) { if (peer instanceof XComponentPeer) {
Long window = Long.valueOf(((XComponentPeer)peer).getWindow()); Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
if (!set.contains(window)) { if (!set.contains(window)) {
@ -1348,7 +1350,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
/****** DropTargetPeer implementation ********************/ /****** DropTargetPeer implementation ********************/
@SuppressWarnings("deprecation")
public void addDropTarget(DropTarget dt) { public void addDropTarget(DropTarget dt) {
Component comp = target; Component comp = target;
while(!(comp == null || comp instanceof Window)) { while(!(comp == null || comp instanceof Window)) {
@ -1356,14 +1357,13 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
if (comp instanceof Window) { if (comp instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(comp.getPeer()); XWindowPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(comp);
if (wpeer != null) { if (wpeer != null) {
wpeer.addDropTarget(); wpeer.addDropTarget();
} }
} }
} }
@SuppressWarnings("deprecation")
public void removeDropTarget(DropTarget dt) { public void removeDropTarget(DropTarget dt) {
Component comp = target; Component comp = target;
while(!(comp == null || comp instanceof Window)) { while(!(comp == null || comp instanceof Window)) {
@ -1371,7 +1371,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
if (comp instanceof Window) { if (comp instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(comp.getPeer()); XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(comp);
if (wpeer != null) { if (wpeer != null) {
wpeer.removeDropTarget(); wpeer.removeDropTarget();
} }

View File

@ -1226,7 +1226,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
Window owner = XWindowPeer.getDecoratedOwner(actualFocusedWindow); Window owner = XWindowPeer.getDecoratedOwner(actualFocusedWindow);
if (owner != null && owner == target) { if (owner != null && owner == target) {
setActualFocusedWindow((XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(actualFocusedWindow)); setActualFocusedWindow(AWTAccessor.getComponentAccessor().getPeer(actualFocusedWindow));
} }
} }
super.handleWindowFocusOut(oppositeWindow, serial); super.handleWindowFocusOut(oppositeWindow, serial);

View File

@ -117,7 +117,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
try { try {
javaToplevels = XWindowPeer.collectJavaToplevels(); javaToplevels = XWindowPeer.collectJavaToplevels();
for (Window w : toBlock) { for (Window w : toBlock) {
XWindowPeer wp = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); XWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) { if (wp != null) {
wp.setModalBlocked((Dialog)target, true, javaToplevels); wp.setModalBlocked((Dialog)target, true, javaToplevels);
} }
@ -139,7 +139,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
XWindowPeer focusedWindowPeer = null; XWindowPeer focusedWindowPeer = null;
if (focusedWindow != null) { if (focusedWindow != null) {
focusedWindowPeer = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(focusedWindow); focusedWindowPeer = AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
} else { } else {
/* /*
* For the case when a potential blocked window is not yet focused * For the case when a potential blocked window is not yet focused

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -110,7 +110,6 @@ public final class XDragSourceContextPeer
return theInstance; return theInstance;
} }
@SuppressWarnings("deprecation")
protected void startDrag(Transferable transferable, protected void startDrag(Transferable transferable,
long[] formats, Map<Long, DataFlavor> formatMap) { long[] formats, Map<Long, DataFlavor> formatMap) {
Component component = getTrigger().getComponent(); Component component = getTrigger().getComponent();
@ -121,7 +120,7 @@ public final class XDragSourceContextPeer
c = AWTAccessor.getComponentAccessor().getParent(c)); c = AWTAccessor.getComponentAccessor().getParent(c));
if (c instanceof Window) { if (c instanceof Window) {
wpeer = (XWindowPeer)c.getPeer(); wpeer = AWTAccessor.getComponentAccessor().getPeer(c);
} }
if (wpeer == null) { if (wpeer == null) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import sun.awt.AWTAccessor;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import sun.awt.AppContext; import sun.awt.AppContext;
@ -188,12 +189,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer {
// If source is an XEmbedCanvasPeer, passes the event to it for processing and // If source is an XEmbedCanvasPeer, passes the event to it for processing and
// return true if the event is forwarded to the XEmbed child. // return true if the event is forwarded to the XEmbed child.
// Otherwise, does nothing and return false. // Otherwise, does nothing and return false.
@SuppressWarnings("deprecation")
private boolean processSunDropTargetEvent(SunDropTargetEvent event) { private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
Object source = event.getSource(); Object source = event.getSource();
if (source instanceof Component) { if (source instanceof Component) {
ComponentPeer peer = ((Component)source).getPeer(); Object peer = AWTAccessor.getComponentAccessor()
.getPeer((Component) source);
if (peer instanceof XEmbedCanvasPeer) { if (peer instanceof XEmbedCanvasPeer) {
XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer; XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
/* The native context is the pointer to the XClientMessageEvent /* The native context is the pointer to the XClientMessageEvent

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -166,7 +166,6 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
XToolkit.postEvent(XToolkit.targetToAppContext(proxy), event); XToolkit.postEvent(XToolkit.targetToAppContext(proxy), event);
} }
@SuppressWarnings("deprecation")
boolean simulateMotifRequestFocus(Component lightweightChild, boolean temporary, boolean simulateMotifRequestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time) boolean focusedWindowChangeAllowed, long time)
{ {
@ -174,7 +173,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
lightweightChild = (Component)proxy; lightweightChild = (Component)proxy;
} }
Component currentOwner = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner(); Component currentOwner = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner();
if (currentOwner != null && currentOwner.getPeer() == null) { if (currentOwner != null && !currentOwner.isDisplayable()) {
currentOwner = null; currentOwner = null;
} }
FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner ); FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner );

View File

@ -26,8 +26,11 @@
package sun.awt.X11; package sun.awt.X11;
import java.awt.AWTKeyStroke; import java.awt.AWTKeyStroke;
import java.awt.Component;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame; import sun.awt.EmbeddedFrame;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
@ -63,10 +66,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
} }
} }
@SuppressWarnings("deprecation")
public void addNotify() public void addNotify()
{ {
if (getPeer() == null) { if (!isDisplayable()) {
XToolkit toolkit = (XToolkit)Toolkit.getDefaultToolkit(); XToolkit toolkit = (XToolkit)Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this)); setPeer(toolkit.createEmbeddedFrame(this));
} }
@ -80,9 +82,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
/* /*
* The method shouldn't be called in case of active XEmbed. * The method shouldn't be called in case of active XEmbed.
*/ */
@SuppressWarnings("deprecation")
public boolean traverseIn(boolean direction) { public boolean traverseIn(boolean direction) {
XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer(); XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (peer != null) { if (peer != null) {
if (peer.supportsXEmbed() && peer.isXEmbedActive()) { if (peer.supportsXEmbed() && peer.isXEmbedActive()) {
log.fine("The method shouldn't be called when XEmbed is active!"); log.fine("The method shouldn't be called when XEmbed is active!");
@ -93,9 +95,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
return false; return false;
} }
@SuppressWarnings("deprecation")
protected boolean traverseOut(boolean direction) { protected boolean traverseOut(boolean direction) {
XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer(); XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (direction == FORWARD) { if (direction == FORWARD) {
xefp.traverseOutForward(); xefp.traverseOutForward();
} }
@ -108,9 +110,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
/* /*
* The method shouldn't be called in case of active XEmbed. * The method shouldn't be called in case of active XEmbed.
*/ */
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(boolean doActivate) { public void synthesizeWindowActivation(boolean doActivate) {
XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer(); XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (peer != null) { if (peer != null) {
if (peer.supportsXEmbed() && peer.isXEmbedActive()) { if (peer.supportsXEmbed() && peer.isXEmbedActive()) {
log.fine("The method shouldn't be called when XEmbed is active!"); log.fine("The method shouldn't be called when XEmbed is active!");
@ -120,16 +122,17 @@ public class XEmbeddedFrame extends EmbeddedFrame {
} }
} }
@SuppressWarnings("deprecation")
public void registerAccelerator(AWTKeyStroke stroke) { public void registerAccelerator(AWTKeyStroke stroke) {
XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer(); XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (xefp != null) { if (xefp != null) {
xefp.registerAccelerator(stroke); xefp.registerAccelerator(stroke);
} }
} }
@SuppressWarnings("deprecation")
public void unregisterAccelerator(AWTKeyStroke stroke) { public void unregisterAccelerator(AWTKeyStroke stroke) {
XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer(); XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (xefp != null) { if (xefp != null) {
xefp.unregisterAccelerator(stroke); xefp.unregisterAccelerator(stroke);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@ package sun.awt.X11;
import java.awt.*; import java.awt.*;
import java.util.HashMap; import java.util.HashMap;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.lang.reflect.*;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher { public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
@ -46,13 +45,14 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche
XToolkit.removeEventDispatcher(embedder.getWindow(), this); XToolkit.removeEventDispatcher(embedder.getWindow(), this);
} }
@SuppressWarnings("deprecation")
void add(long child) { void add(long child) {
if (checkXEmbed(child)) { if (checkXEmbed(child)) {
Component proxy = createChildProxy(child); Component proxy = createChildProxy(child);
((Container)embedder.getTarget()).add("Center", proxy); ((Container)embedder.getTarget()).add("Center", proxy);
if (proxy.getPeer() != null) { XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
children.put(Long.valueOf(child), proxy.getPeer()); .getPeer(proxy);
if (peer != null) {
children.put(Long.valueOf(child), peer);
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,15 +32,19 @@ import java.awt.peer.*;
import java.io.*; import java.io.*;
import java.util.Locale; import java.util.Locale;
import java.util.Arrays; import java.util.Arrays;
import com.sun.java.swing.plaf.motif.*;
import javax.swing.plaf.ComponentUI;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListener, ItemListener, KeyEventDispatcher, XChoicePeerListener { class XFileDialogPeer extends XDialogPeer
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer"); implements FileDialogPeer, ActionListener, ItemListener,
KeyEventDispatcher, XChoicePeerListener {
private static final PlatformLogger log =
PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer");
FileDialog target; FileDialog target;
@ -286,7 +290,8 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
fileDialog.setSize(400, 400); fileDialog.setSize(400, 400);
// Update choice's popup width // Update choice's popup width
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); XChoicePeer choicePeer = AWTAccessor.getComponentAccessor()
.getPeer(pathChoice);
choicePeer.setDrawSelectedItem(false); choicePeer.setDrawSelectedItem(false);
choicePeer.setAlignUnder(pathField); choicePeer.setAlignUnder(pathField);
@ -642,7 +647,6 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
} }
} }
@SuppressWarnings("deprecation")
public boolean dispatchKeyEvent(KeyEvent keyEvent) { public boolean dispatchKeyEvent(KeyEvent keyEvent) {
int id = keyEvent.getID(); int id = keyEvent.getID();
int keyCode = keyEvent.getKeyCode(); int keyCode = keyEvent.getKeyCode();
@ -653,13 +657,15 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
while (comp != null) { while (comp != null) {
// Fix for 6240084 Disposing a file dialog when the drop-down is active does not dispose the dropdown menu, on Xtoolkit // Fix for 6240084 Disposing a file dialog when the drop-down is active does not dispose the dropdown menu, on Xtoolkit
// See also 6259493 // See also 6259493
ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (comp == pathChoice) { if (comp == pathChoice) {
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); XChoicePeer choicePeer = acc.getPeer(pathChoice);
if (choicePeer.isUnfurled()){ if (choicePeer.isUnfurled()){
return false; return false;
} }
} }
if (comp.getPeer() == this) { Object peer = acc.getPeer(comp);
if (peer == this) {
handleCancel(); handleCancel();
return true; return true;
} }
@ -796,16 +802,18 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
} }
super.setVisible(b); super.setVisible(b);
XChoicePeer choicePeer = AWTAccessor.getComponentAccessor()
.getPeer(pathChoice);
if (b == true){ if (b == true){
// See 6240074 for more information // See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.addXChoicePeerListener(this); choicePeer.addXChoicePeerListener(this);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addKeyEventDispatcher(this);
}else{ }else{
// See 6240074 for more information // See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.removeXChoicePeerListener(); choicePeer.removeXChoicePeerListener();
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this); KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removeKeyEventDispatcher(this);
} }
selectionField.requestFocusInWindow(); selectionField.requestFocusInWindow();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -124,7 +124,8 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
} }
} else { } else {
menubar = mb; menubar = mb;
menubarPeer = (XMenuBarPeer) mb.getPeer(); menubarPeer = AWTAccessor.getMenuComponentAccessor()
.getPeer(mb);
if (menubarPeer != null) { if (menubarPeer != null) {
menubarPeer.init((Frame)target); menubarPeer.init((Frame)target);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,8 @@ import java.awt.Container;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.im.spi.InputMethodContext; import java.awt.im.spi.InputMethodContext;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.X11InputMethod; import sun.awt.X11InputMethod;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
@ -137,9 +139,10 @@ public class XInputMethod extends X11InputMethod {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
@SuppressWarnings("deprecation")
long getCurrentParentWindow() { long getCurrentParentWindow() {
return ((XWindow)clientComponentWindow.getPeer()).getContentWindow(); XWindow peer = AWTAccessor.getComponentAccessor()
.getPeer(clientComponentWindow);
return peer.getContentWindow();
} }
/* /*

View File

@ -70,13 +70,13 @@ public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
synchronized(this) { synchronized(this) {
if (currentFocusedWindow != null) { if (currentFocusedWindow != null) {
from = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow); from = AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
} }
currentFocusedWindow = win; currentFocusedWindow = win;
if (currentFocusedWindow != null) { if (currentFocusedWindow != null) {
to = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow); to = AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -163,9 +163,8 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
postPaintEvent(); postPaintEvent();
} }
@SuppressWarnings("deprecation")
public void addHelpMenu(Menu m) { public void addHelpMenu(Menu m) {
XMenuPeer mp = (XMenuPeer)m.getPeer(); XMenuPeer mp = AWTAccessor.getMenuComponentAccessor().getPeer(m);
synchronized(getMenuTreeLock()) { synchronized(getMenuTreeLock()) {
helpMenu = mp; helpMenu = mp;
} }
@ -180,10 +179,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
/** /**
* called from XFramePeer.setMenuBar * called from XFramePeer.setMenuBar
*/ */
@SuppressWarnings("deprecation")
public void init(Frame frame) { public void init(Frame frame) {
this.target = frame; this.target = frame;
this.framePeer = (XFramePeer)frame.getPeer(); this.framePeer = AWTAccessor.getComponentAccessor().getPeer(frame);
XCreateWindowParams params = getDelayedParams(); XCreateWindowParams params = getDelayedParams();
params.remove(DELAYED); params.remove(DELAYED);
params.add(PARENT_WINDOW, framePeer.getShell()); params.add(PARENT_WINDOW, framePeer.getShell());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,10 +28,11 @@ package sun.awt.X11;
import java.awt.Point; import java.awt.Point;
import java.awt.Window; import java.awt.Window;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.peer.MouseInfoPeer; import java.awt.peer.MouseInfoPeer;
import sun.awt.AWTAccessor;
public class XMouseInfoPeer implements MouseInfoPeer { public class XMouseInfoPeer implements MouseInfoPeer {
/** /**
@ -83,8 +84,8 @@ public class XMouseInfoPeer implements MouseInfoPeer {
// java.awt.Component.findUnderMouseInWindow checks that // java.awt.Component.findUnderMouseInWindow checks that
// the peer is non-null by checking that the component // the peer is non-null by checking that the component
// is showing. // is showing.
XWindow peer = AWTAccessor.getComponentAccessor().getPeer(w);
long contentWindow = ((XWindow)w.getPeer()).getContentWindow(); long contentWindow = peer.getContentWindow();
long parent = XlibUtil.getParentWindow(contentWindow); long parent = XlibUtil.getParentWindow(contentWindow);
XToolkit.awtLock(); XToolkit.awtLock();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@ package sun.awt.X11;
import java.awt.*; import java.awt.*;
import java.awt.peer.*; import java.awt.peer.*;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.SunGraphicsCallback; import sun.awt.SunGraphicsCallback;
public class XPanelPeer extends XCanvasPeer implements PanelPeer { public class XPanelPeer extends XCanvasPeer implements PanelPeer {
@ -76,17 +78,17 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
} }
@SuppressWarnings("deprecation")
public void setBackground(Color c) { public void setBackground(Color c) {
Component comp; Component comp;
int i; int i;
Container cont = (Container) target; Container cont = (Container) target;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
synchronized(target.getTreeLock()) { synchronized(target.getTreeLock()) {
int n = cont.getComponentCount(); int n = cont.getComponentCount();
for(i=0; i < n; i++) { for(i=0; i < n; i++) {
comp = cont.getComponent(i); comp = cont.getComponent(i);
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = acc.getPeer(comp);
if (peer != null) { if (peer != null) {
Color color = comp.getBackground(); Color color = comp.getBackground();
if (color == null || color.equals(c)) { if (color == null || color.equals(c)) {
@ -102,15 +104,15 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
setForegroundForHierarchy((Container) target, c); setForegroundForHierarchy((Container) target, c);
} }
@SuppressWarnings("deprecation")
private void setForegroundForHierarchy(Container cont, Color c) { private void setForegroundForHierarchy(Container cont, Color c) {
synchronized(target.getTreeLock()) { synchronized(target.getTreeLock()) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
int n = cont.getComponentCount(); int n = cont.getComponentCount();
for(int i=0; i < n; i++) { for(int i=0; i < n; i++) {
Component comp = cont.getComponent(i); Component comp = cont.getComponent(i);
Color color = comp.getForeground(); Color color = comp.getForeground();
if (color == null || color.equals(c)) { if (color == null || color.equals(c)) {
ComponentPeer cpeer = comp.getPeer(); ComponentPeer cpeer = acc.getPeer(comp);
if (cpeer != null) { if (cpeer != null) {
cpeer.setForeground(c); cpeer.setForeground(c);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ package sun.awt.X11;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import sun.awt.AWTAccessor;
import sun.awt.RepaintArea; import sun.awt.RepaintArea;
/** /**
@ -55,10 +56,10 @@ final class XRepaintArea extends RepaintArea {
/** /**
* Calls <code>Component.paint(Graphics)</code> with given Graphics. * Calls <code>Component.paint(Graphics)</code> with given Graphics.
*/ */
@SuppressWarnings("deprecation")
protected void paintComponent(Component comp, Graphics g) { protected void paintComponent(Component comp, Graphics g) {
if (comp != null) { if (comp != null) {
final XComponentPeer peer = (XComponentPeer) comp.getPeer(); final XComponentPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(comp);
if (peer != null) { if (peer != null) {
peer.paintPeer(g); peer.paintPeer(g);
} }

View File

@ -1163,12 +1163,6 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
return (Window) xwin.target; return (Window) xwin.target;
} }
@Override
@SuppressWarnings("deprecation")
public ComponentPeer getPeer() {
return (ComponentPeer) (xwin);
}
@Override @Override
public void updateUI() { public void updateUI() {
ComponentUI ui = new XAWTScrollPaneUI(); ComponentUI ui = new XAWTScrollPaneUI();

View File

@ -547,71 +547,63 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
implements ActionListener, DocumentListener { implements ActionListener, DocumentListener {
private boolean isFocused = false; private boolean isFocused = false;
private final XComponentPeer peer; private final XComponentPeer xwin;
XAWTTextField(String text, XComponentPeer peer, Container parent) { XAWTTextField(String text, XComponentPeer xwin, Container parent) {
super(text); super(text);
this.peer = peer; this.xwin = xwin;
setDoubleBuffered(true); setDoubleBuffered(true);
setFocusable(false); setFocusable(false);
AWTAccessor.getComponentAccessor().setParent(this,parent); AWTAccessor.getComponentAccessor().setParent(this,parent);
setBackground(peer.getPeerBackground()); setBackground(xwin.getPeerBackground());
setForeground(peer.getPeerForeground()); setForeground(xwin.getPeerForeground());
setFont(peer.getPeerFont()); setFont(xwin.getPeerFont());
setCaretPosition(0); setCaretPosition(0);
addActionListener(this); addActionListener(this);
addNotify(); addNotify();
} }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void actionPerformed( ActionEvent actionEvent ) { public void actionPerformed( ActionEvent actionEvent ) {
peer.postEvent(new ActionEvent(peer.target, xwin.postEvent(
ActionEvent.ACTION_PERFORMED, new ActionEvent(xwin.target, ActionEvent.ACTION_PERFORMED,
getText(), getText(), actionEvent.getWhen(),
actionEvent.getWhen(), actionEvent.getModifiers()));
actionEvent.getModifiers()));
} }
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
if (peer != null) { if (xwin != null) {
peer.postEvent(new TextEvent(peer.target, xwin.postEvent(new TextEvent(xwin.target,
TextEvent.TEXT_VALUE_CHANGED)); TextEvent.TEXT_VALUE_CHANGED));
} }
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
if (peer != null) { if (xwin != null) {
peer.postEvent(new TextEvent(peer.target, xwin.postEvent(new TextEvent(xwin.target,
TextEvent.TEXT_VALUE_CHANGED)); TextEvent.TEXT_VALUE_CHANGED));
} }
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
if (peer != null) { if (xwin != null) {
peer.postEvent(new TextEvent(peer.target, xwin.postEvent(new TextEvent(xwin.target,
TextEvent.TEXT_VALUE_CHANGED)); TextEvent.TEXT_VALUE_CHANGED));
} }
} }
@Override
@SuppressWarnings("deprecation")
public ComponentPeer getPeer() {
return (ComponentPeer) peer;
}
public void repaintNow() { public void repaintNow() {
paintImmediately(getBounds()); paintImmediately(getBounds());
} }
@Override @Override
public Graphics getGraphics() { public Graphics getGraphics() {
return peer.getGraphics(); return xwin.getGraphics();
} }
@Override @Override

View File

@ -605,7 +605,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
Component owner = Component owner =
XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner(); XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner();
if (owner != null) { if (owner != null) {
XWindow ownerWindow = (XWindow) AWTAccessor.getComponentAccessor().getPeer(owner); XWindow ownerWindow = AWTAccessor.getComponentAccessor().getPeer(owner);
if (ownerWindow != null) { if (ownerWindow != null) {
w = ownerWindow.getContentWindow(); w = ownerWindow.getContentWindow();
} }
@ -2449,17 +2449,17 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
awtUnlock(); awtUnlock();
} }
} }
@SuppressWarnings("deprecation")
public void grab(Window w) { public void grab(Window w) {
if (w.getPeer() != null) { final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
((XWindowPeer)w.getPeer()).setGrab(true); if (peer != null) {
((XWindowPeer) peer).setGrab(true);
} }
} }
@SuppressWarnings("deprecation")
public void ungrab(Window w) { public void ungrab(Window w) {
if (w.getPeer() != null) { final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
((XWindowPeer)w.getPeer()).setGrab(false); if (peer != null) {
((XWindowPeer) peer).setGrab(false);
} }
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,8 +30,6 @@ import java.awt.event.*;
import java.awt.peer.TrayIconPeer; import java.awt.peer.TrayIconPeer;
import sun.awt.*; import sun.awt.*;
import java.awt.image.*; import java.awt.image.*;
import java.text.BreakIterator;
import java.util.concurrent.ArrayBlockingQueue;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -347,7 +345,6 @@ public class XTrayIconPeer implements TrayIconPeer,
} }
// It's synchronized with disposal by EDT. // It's synchronized with disposal by EDT.
@SuppressWarnings("deprecation")
public void showPopupMenu(int x, int y) { public void showPopupMenu(int x, int y) {
if (isDisposed()) if (isDisposed())
return; return;
@ -366,7 +363,9 @@ public class XTrayIconPeer implements TrayIconPeer,
} }
if (popup != null) { if (popup != null) {
Point loc = ((XBaseWindow)eframe.getPeer()).toLocal(new Point(x, y)); final XBaseWindow peer = AWTAccessor.getComponentAccessor()
.getPeer(eframe);
Point loc = peer.toLocal(new Point(x, y));
popup.show(eframe, loc.x, loc.y); popup.show(eframe, loc.x, loc.y);
} }
} }
@ -416,9 +415,9 @@ public class XTrayIconPeer implements TrayIconPeer,
canvas.addMouseMotionListener(eventProxy); canvas.addMouseMotionListener(eventProxy);
} }
@SuppressWarnings("deprecation")
long getWindow() { long getWindow() {
return ((XEmbeddedFramePeer)eframe.getPeer()).getWindow(); return AWTAccessor.getComponentAccessor()
.<XEmbeddedFramePeer>getPeer(eframe).getWindow();
} }
public boolean isDisposed() { public boolean isDisposed() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import sun.awt.*; import sun.awt.*;
@ -282,15 +283,15 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
return reparented; return reparented;
} }
@SuppressWarnings("deprecation")
static long getParentWindowID(Component target) { static long getParentWindowID(Component target) {
ComponentPeer peer = target.getParent().getPeer();
Component temp = target.getParent(); Component temp = target.getParent();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(temp);
while (!(peer instanceof XWindow)) while (!(peer instanceof XWindow))
{ {
temp = temp.getParent(); temp = temp.getParent();
peer = temp.getPeer(); peer = acc.getPeer(temp);
} }
if (peer != null && peer instanceof XWindow) if (peer != null && peer instanceof XWindow)
@ -299,17 +300,17 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
@SuppressWarnings("deprecation")
static XWindow getParentXWindowObject(Component target) { static XWindow getParentXWindowObject(Component target) {
if (target == null) return null; if (target == null) return null;
Component temp = target.getParent(); Component temp = target.getParent();
if (temp == null) return null; if (temp == null) return null;
ComponentPeer peer = temp.getPeer(); final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(temp);
if (peer == null) return null; if (peer == null) return null;
while ((peer != null) && !(peer instanceof XWindow)) while ((peer != null) && !(peer instanceof XWindow))
{ {
temp = temp.getParent(); temp = temp.getParent();
peer = temp.getPeer(); peer = acc.getPeer(temp);
} }
if (peer != null && peer instanceof XWindow) if (peer != null && peer instanceof XWindow)
return (XWindow) peer; return (XWindow) peer;
@ -552,7 +553,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
int h = xe.get_height(); int h = xe.get_height();
Component target = getEventSource(); Component target = getEventSource();
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
if (!compAccessor.getIgnoreRepaint(target) if (!compAccessor.getIgnoreRepaint(target)
&& compAccessor.getWidth(target) != 0 && compAccessor.getWidth(target) != 0

View File

@ -46,6 +46,7 @@ import java.util.Vector;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
@ -225,7 +226,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
Window t_window = (Window)target; Window t_window = (Window)target;
Window owner = t_window.getOwner(); Window owner = t_window.getOwner();
if (owner != null) { if (owner != null) {
ownerPeer = (XWindowPeer)owner.getPeer(); ownerPeer = AWTAccessor.getComponentAccessor().getPeer(owner);
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Owner is " + owner); focusLog.finer("Owner is " + owner);
focusLog.finer("Owner peer is " + ownerPeer); focusLog.finer("Owner peer is " + ownerPeer);
@ -401,15 +402,15 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
} }
} }
@SuppressWarnings("deprecation")
public void recursivelySetIcon(java.util.List<IconInfo> icons) { public void recursivelySetIcon(java.util.List<IconInfo> icons) {
dumpIcons(winAttr.icons); dumpIcons(winAttr.icons);
setIconHints(icons); setIconHints(icons);
Window target = (Window)this.target; Window target = (Window)this.target;
Window[] children = target.getOwnedWindows(); Window[] children = target.getOwnedWindows();
int cnt = children.length; int cnt = children.length;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
ComponentPeer childPeer = children[i].getPeer(); final ComponentPeer childPeer = acc.getPeer(children[i]);
if (childPeer != null && childPeer instanceof XWindowPeer) { if (childPeer != null && childPeer instanceof XWindowPeer) {
if (((XWindowPeer)childPeer).winAttr.iconsInherited) { if (((XWindowPeer)childPeer).winAttr.iconsInherited) {
((XWindowPeer)childPeer).winAttr.icons = icons; ((XWindowPeer)childPeer).winAttr.icons = icons;
@ -1161,7 +1162,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (warningWindow != null) { if (warningWindow != null) {
// We can't use the coordinates stored in the XBaseWindow since // We can't use the coordinates stored in the XBaseWindow since
// they are zeros for decorated frames. // they are zeros for decorated frames.
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
int x = compAccessor.getX(target); int x = compAccessor.getX(target);
int y = compAccessor.getY(target); int y = compAccessor.getY(target);
int width = compAccessor.getWidth(target); int width = compAccessor.getWidth(target);
@ -1486,7 +1487,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
if (isReparented() && delayedModalBlocking) { if (isReparented() && delayedModalBlocking) {
addToTransientFors((XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(modalBlocker)); addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
delayedModalBlocking = false; delayedModalBlocking = false;
} }
} finally { } finally {
@ -1570,7 +1571,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
try { try {
// State lock should always be after awtLock // State lock should always be after awtLock
synchronized(getStateLock()) { synchronized(getStateLock()) {
XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d); XDialogPeer blockerPeer = AWTAccessor.getComponentAccessor().getPeer(d);
if (blocked) { if (blocked) {
if (log.isLoggable(PlatformLogger.Level.FINE)) { if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("{0} is blocked by {1}", this, blockerPeer); log.fine("{0} is blocked by {1}", this, blockerPeer);
@ -1852,7 +1853,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// current chain iterator in the order from next to prev // current chain iterator in the order from next to prev
XWindowPeer chainToSplit = prevTransientFor; XWindowPeer chainToSplit = prevTransientFor;
while (chainToSplit != null) { while (chainToSplit != null) {
XWindowPeer blocker = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker); XWindowPeer blocker = AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker);
if (thisChainBlockers.contains(blocker)) { if (thisChainBlockers.contains(blocker)) {
// add to this dialog's chain // add to this dialog's chain
setToplevelTransientFor(thisChain, chainToSplit, true, false); setToplevelTransientFor(thisChain, chainToSplit, true, false);
@ -1913,7 +1914,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
} }
focusLog.fine("Parent window is not active"); focusLog.fine("Parent window is not active");
XDecoratedPeer wpeer = (XDecoratedPeer)AWTAccessor.getComponentAccessor().getPeer(ownerWindow); XDecoratedPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(ownerWindow);
if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) { if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) {
focusLog.fine("Parent window accepted focus request - generating focus for this window"); focusLog.fine("Parent window accepted focus request - generating focus for this window");
return true; return true;
@ -2259,7 +2260,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
while (w != null && toplevel != this && !(toplevel instanceof XDialogPeer)) { while (w != null && toplevel != this && !(toplevel instanceof XDialogPeer)) {
w = (Window) AWTAccessor.getComponentAccessor().getParent(w); w = (Window) AWTAccessor.getComponentAccessor().getParent(w);
if (w != null) { if (w != null) {
toplevel = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(w); toplevel = AWTAccessor.getComponentAccessor().getPeer(w);
} }
} }
if (w == null || (w != this.target && w instanceof Dialog)) { if (w == null || (w != this.target && w instanceof Dialog)) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -326,18 +326,16 @@ public class X11GraphicsDevice
return (isFullScreenSupported() && (getFullScreenWindow() != null)); return (isFullScreenSupported() && (getFullScreenWindow() != null));
} }
@SuppressWarnings("deprecation")
private static void enterFullScreenExclusive(Window w) { private static void enterFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer(); X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) { if (peer != null) {
enterFullScreenExclusive(peer.getContentWindow()); enterFullScreenExclusive(peer.getContentWindow());
peer.setFullScreenExclusiveModeState(true); peer.setFullScreenExclusiveModeState(true);
} }
} }
@SuppressWarnings("deprecation")
private static void exitFullScreenExclusive(Window w) { private static void exitFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer(); X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) { if (peer != null) {
peer.setFullScreenExclusiveModeState(false); peer.setFullScreenExclusiveModeState(false);
exitFullScreenExclusive(peer.getContentWindow()); exitFullScreenExclusive(peer.getContentWindow());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,9 @@ import java.awt.Component;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.X11ComponentPeer; import sun.awt.X11ComponentPeer;
import sun.awt.image.SunVolatileImage; import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager; import sun.awt.image.VolatileSurfaceManager;
@ -73,12 +76,11 @@ public class GLXVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a pbuffer-based SurfaceData object (or init the backbuffer * Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig) * of an existing window if this is a double buffered GraphicsConfig)
*/ */
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() { protected SurfaceData initAcceleratedSurface() {
SurfaceData sData; SurfaceData sData;
Component comp = vImg.getComponent(); Component comp = vImg.getComponent();
X11ComponentPeer peer = final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
(comp != null) ? (X11ComponentPeer)comp.getPeer() : null; X11ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try { try {
boolean createVSynced = false; boolean createVSynced = false;

View File

@ -84,12 +84,10 @@ Java_java_awt_Font_initIDs
(JNIEnv *env, jclass cls) (JNIEnv *env, jclass cls)
{ {
#ifndef HEADLESS #ifndef HEADLESS
/** We call "NoClientCode" methods because they won't invoke client
code on the privileged toolkit thread **/
CHECK_NULL(fontIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J")); CHECK_NULL(fontIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J"));
CHECK_NULL(fontIDs.style = (*env)->GetFieldID(env, cls, "style", "I")); CHECK_NULL(fontIDs.style = (*env)->GetFieldID(env, cls, "style", "I"));
CHECK_NULL(fontIDs.size = (*env)->GetFieldID(env, cls, "size", "I")); CHECK_NULL(fontIDs.size = (*env)->GetFieldID(env, cls, "size", "I"));
CHECK_NULL(fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getPeer_NoClientCode", CHECK_NULL(fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getFontPeer",
"()Ljava/awt/peer/FontPeer;")); "()Ljava/awt/peer/FontPeer;"));
CHECK_NULL(fontIDs.getFamily = (*env)->GetMethodID(env, cls, "getFamily_NoClientCode", CHECK_NULL(fontIDs.getFamily = (*env)->GetMethodID(env, cls, "getFamily_NoClientCode",
"()Ljava/lang/String;")); "()Ljava/lang/String;"));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -329,7 +329,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
} }
@Override @Override
@SuppressWarnings("deprecation")
public synchronized void setFullScreenWindow(Window w) { public synchronized void setFullScreenWindow(Window w) {
Window old = getFullScreenWindow(); Window old = getFullScreenWindow();
if (w == old) { if (w == old) {
@ -353,7 +352,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
// entering the fullscreen mode. // entering the fullscreen mode.
defaultDisplayMode = null; defaultDisplayMode = null;
} }
WWindowPeer peer = (WWindowPeer)old.getPeer(); WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(old);
if (peer != null) { if (peer != null) {
peer.setFullScreenExclusiveModeState(false); peer.setFullScreenExclusiveModeState(false);
// we used to destroy the buffers on exiting fs mode, this // we used to destroy the buffers on exiting fs mode, this
@ -372,7 +371,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
defaultDisplayMode = getDisplayMode(); defaultDisplayMode = getDisplayMode();
addFSWindowListener(w); addFSWindowListener(w);
// Enter full screen exclusive mode. // Enter full screen exclusive mode.
WWindowPeer peer = (WWindowPeer)w.getPeer(); WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) { if (peer != null) {
synchronized(peer) { synchronized(peer) {
enterFullScreenExclusive(screen, peer); enterFullScreenExclusive(screen, peer);
@ -405,7 +404,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
} }
@Override @Override
@SuppressWarnings("deprecation")
public synchronized void setDisplayMode(DisplayMode dm) { public synchronized void setDisplayMode(DisplayMode dm) {
if (!isDisplayChangeSupported()) { if (!isDisplayChangeSupported()) {
super.setDisplayMode(dm); super.setDisplayMode(dm);
@ -419,7 +417,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
} }
Window w = getFullScreenWindow(); Window w = getFullScreenWindow();
if (w != null) { if (w != null) {
WWindowPeer peer = (WWindowPeer)w.getPeer(); WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(), configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(),
dm.getBitDepth(), dm.getRefreshRate()); dm.getBitDepth(), dm.getRefreshRate());
// resize the fullscreen window to the dimensions of the new // resize the fullscreen window to the dimensions of the new

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,8 @@ import java.awt.event.ItemEvent;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
final class WChoicePeer extends WComponentPeer implements ChoicePeer { final class WChoicePeer extends WComponentPeer implements ChoicePeer {
@ -94,7 +96,6 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
native void create(WComponentPeer parent); native void create(WComponentPeer parent);
@Override @Override
@SuppressWarnings("deprecation")
void initialize() { void initialize() {
Choice opt = (Choice)target; Choice opt = (Choice)target;
int itemCount = opt.getItemCount(); int itemCount = opt.getItemCount();
@ -111,7 +112,8 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
Window parentWindow = SunToolkit.getContainingWindow((Component)target); Window parentWindow = SunToolkit.getContainingWindow((Component)target);
if (parentWindow != null) { if (parentWindow != null) {
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer(); final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer != null) { if (wpeer != null) {
windowListener = new WindowAdapter() { windowListener = new WindowAdapter() {
@Override @Override
@ -130,13 +132,13 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected void disposeImpl() { protected void disposeImpl() {
// TODO: we should somehow reset the listener when the choice // TODO: we should somehow reset the listener when the choice
// is moved to another toplevel without destroying its peer. // is moved to another toplevel without destroying its peer.
Window parentWindow = SunToolkit.getContainingWindow((Component)target); Window parentWindow = SunToolkit.getContainingWindow((Component)target);
if (parentWindow != null) { if (parentWindow != null) {
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer(); final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer != null) { if (wpeer != null) {
wpeer.removeWindowListener(windowListener); wpeer.removeWindowListener(windowListener);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -569,7 +569,6 @@ public abstract class WComponentPeer extends WObjectPeer
final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
@Override @Override
@SuppressWarnings("deprecation")
public Graphics getGraphics() { public Graphics getGraphics() {
if (isDisposed()) { if (isDisposed()) {
return null; return null;
@ -578,8 +577,9 @@ public abstract class WComponentPeer extends WObjectPeer
Component target = (Component)getTarget(); Component target = (Component)getTarget();
Window window = SunToolkit.getContainingWindow(target); Window window = SunToolkit.getContainingWindow(target);
if (window != null) { if (window != null) {
Graphics g = final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
((WWindowPeer)window.getPeer()).getTranslucentGraphics(); .getPeer(window);
Graphics g = wpeer.getTranslucentGraphics();
// getTranslucentGraphics() returns non-null value for non-opaque windows only // getTranslucentGraphics() returns non-null value for non-opaque windows only
if (g != null) { if (g != null) {
// Non-opaque windows do not support heavyweight children. // Non-opaque windows do not support heavyweight children.
@ -685,7 +685,6 @@ public abstract class WComponentPeer extends WObjectPeer
// TODO: consider moving it to KeyboardFocusManagerPeerImpl // TODO: consider moving it to KeyboardFocusManagerPeerImpl
@Override @Override
@SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary, public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time, boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause) CausedFocusEvent.Cause cause)
@ -713,7 +712,8 @@ public abstract class WComponentPeer extends WObjectPeer
if (parentWindow == null) { if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null"); return rejectFocusRequestHelper("WARNING: Parent window is null");
} }
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer(); final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer == null) { if (wpeer == null) {
return rejectFocusRequestHelper("WARNING: Parent window's peer is null"); return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
} }
@ -1104,7 +1104,6 @@ public abstract class WComponentPeer extends WObjectPeer
// in the browser on Vista when DWM is enabled. // in the browser on Vista when DWM is enabled.
// @return true if the toplevel container is not an EmbeddedFrame or // @return true if the toplevel container is not an EmbeddedFrame or
// if this EmbeddedFrame is acceleration capable, false otherwise // if this EmbeddedFrame is acceleration capable, false otherwise
@SuppressWarnings("deprecation")
private static final boolean isContainingTopLevelAccelCapable(Component c) { private static final boolean isContainingTopLevelAccelCapable(Component c) {
while (c != null && !(c instanceof WEmbeddedFrame)) { while (c != null && !(c instanceof WEmbeddedFrame)) {
c = c.getParent(); c = c.getParent();
@ -1112,7 +1111,9 @@ public abstract class WComponentPeer extends WObjectPeer
if (c == null) { if (c == null) {
return true; return true;
} }
return ((WEmbeddedFramePeer)c.getPeer()).isAccelCapable(); final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.getPeer(c);
return peer.isAccelCapable();
} }
/** /**
@ -1120,7 +1121,6 @@ public abstract class WComponentPeer extends WObjectPeer
* @since 1.7 * @since 1.7
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public void applyShape(Region shape) { public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) { if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
shapeLog.finer("*** INFO: Setting shape: PEER: " + this shapeLog.finer("*** INFO: Setting shape: PEER: " + this

View File

@ -103,7 +103,7 @@ final class WDialogPeer extends WWindowPeer implements DialogPeer {
@Override @Override
public void blockWindows(java.util.List<Window> toBlock) { public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) { for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) { if (wp != null) {
wp.setModalBlocked((Dialog)target, true); wp.setModalBlocked((Dialog)target, true);
} }

View File

@ -30,8 +30,11 @@ import java.awt.*;
import java.awt.event.InvocationEvent; import java.awt.event.InvocationEvent;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.awt.image.*; import java.awt.image.*;
import sun.awt.image.ByteInterleavedRaster; import sun.awt.image.ByteInterleavedRaster;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import java.awt.peer.FramePeer;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.AccessController; import java.security.AccessController;
@ -80,9 +83,8 @@ public class WEmbeddedFrame extends EmbeddedFrame {
} }
} }
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
if (getPeer() == null) { if (!isDisplayable()) {
WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit(); WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this)); setPeer(toolkit.createEmbeddedFrame(this));
} }
@ -232,16 +234,16 @@ public class WEmbeddedFrame extends EmbeddedFrame {
public void activateEmbeddingTopLevel() { public void activateEmbeddingTopLevel() {
} }
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) { public void synthesizeWindowActivation(final boolean activate) {
final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
if (!activate || EventQueue.isDispatchThread()) { if (!activate || EventQueue.isDispatchThread()) {
((WFramePeer)getPeer()).emulateActivation(activate); peer.emulateActivation(activate);
} else { } else {
// To avoid focus concurrence b/w IE and EmbeddedFrame // To avoid focus concurrence b/w IE and EmbeddedFrame
// activation is postponed by means of posting it to EDT. // activation is postponed by means of posting it to EDT.
Runnable r = new Runnable() { Runnable r = new Runnable() {
public void run() { public void run() {
((WFramePeer)getPeer()).emulateActivation(true); peer.emulateActivation(true);
} }
}; };
WToolkit.postEvent(WToolkit.targetToAppContext(this), WToolkit.postEvent(WToolkit.targetToAppContext(this),
@ -249,10 +251,11 @@ public class WEmbeddedFrame extends EmbeddedFrame {
} }
} }
@SuppressWarnings("deprecation")
public boolean requestFocusToEmbedder() { public boolean requestFocusToEmbedder() {
if (isEmbeddedInIE) { if (isEmbeddedInIE) {
return ((WEmbeddedFramePeer) getPeer()).requestFocusToEmbedder(); final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
return peer.requestFocusToEmbedder();
} }
return false; return false;
} }

View File

@ -237,7 +237,7 @@ final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
@Override @Override
public void blockWindows(java.util.List<Window> toBlock) { public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) { for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) { if (wp != null) {
blockWindow(wp); blockWindow(wp);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,9 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.im.InputMethodAdapter; import sun.awt.im.InputMethodAdapter;
final class WInputMethod extends InputMethodAdapter final class WInputMethod extends InputMethodAdapter
@ -606,18 +609,17 @@ final class WInputMethod extends InputMethodAdapter
// java.awt.Toolkit#getNativeContainer() is not available // java.awt.Toolkit#getNativeContainer() is not available
// from this package // from this package
@SuppressWarnings("deprecation")
private WComponentPeer getNearestNativePeer(Component comp) private WComponentPeer getNearestNativePeer(Component comp)
{ {
if (comp==null) return null; if (comp==null) return null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = acc.getPeer(comp);
if (peer==null) return null; if (peer==null) return null;
while (peer instanceof java.awt.peer.LightweightPeer) { while (peer instanceof java.awt.peer.LightweightPeer) {
comp = comp.getParent(); comp = comp.getParent();
if (comp==null) return null; if (comp==null) return null;
peer = comp.getPeer(); peer = acc.getPeer(comp);
if (peer==null) return null; if (peer==null) return null;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,9 @@ package sun.awt.windows;
import java.awt.Window; import java.awt.Window;
import java.awt.Component; import java.awt.Component;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.KeyboardFocusManagerPeerImpl; import sun.awt.KeyboardFocusManagerPeerImpl;
import sun.awt.CausedFocusEvent; import sun.awt.CausedFocusEvent;
@ -46,9 +49,9 @@ final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void setCurrentFocusOwner(Component comp) { public void setCurrentFocusOwner(Component comp) {
setNativeFocusOwner(comp != null ? comp.getPeer() : null); final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
setNativeFocusOwner(comp != null ? acc.getPeer(comp) : null);
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -57,15 +57,13 @@ final class WPageDialog extends WPrintDialog {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
Container parent = getParent(); Container parent = getParent();
if (parent != null && parent.getPeer() == null) { if (parent != null && !parent.isDisplayable()) {
parent.addNotify(); parent.addNotify();
} }
if (!isDisplayable()) {
if (getPeer() == null) {
ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()). ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
createWPageDialog(this); createWPageDialog(this);
setPeer(peer); setPeer(peer);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -58,15 +58,14 @@ class WPrintDialog extends Dialog {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void addNotify() { public void addNotify() {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
Container parent = getParent(); Container parent = getParent();
if (parent != null && parent.getPeer() == null) { if (parent != null && !parent.isDisplayable()) {
parent.addNotify(); parent.addNotify();
} }
if (getPeer() == null) { if (!isDisplayable()) {
ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()). ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
createWPrintDialog(this); createWPrintDialog(this);
setPeer(peer); setPeer(peer);

View File

@ -112,7 +112,7 @@ class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
@Override @Override
public void blockWindows(java.util.List<Window> toBlock) { public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) { for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w); WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) { if (wp != null) {
blockWindow(wp); blockWindow(wp);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,13 +30,11 @@ import java.awt.Font;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException; import java.awt.HeadlessException;
import java.awt.KeyboardFocusManager;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Button; import java.awt.Button;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Event;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.FileDialog; import java.awt.FileDialog;
@ -62,6 +60,8 @@ import java.io.File;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.print.PeekGraphics; import sun.print.PeekGraphics;
import sun.print.PeekMetrics; import sun.print.PeekMetrics;
@ -2117,7 +2117,6 @@ public final class WPrinterJob extends RasterPrinterJob
short xres_quality, short xres_quality,
short yres); short yres);
@SuppressWarnings("deprecation")
public PrintRequestAttributeSet public PrintRequestAttributeSet
showDocumentProperties(Window owner, showDocumentProperties(Window owner,
PrintService service, PrintService service,
@ -2127,7 +2126,8 @@ public final class WPrinterJob extends RasterPrinterJob
setNativePrintServiceIfNeeded(service.getName()); setNativePrintServiceIfNeeded(service.getName());
} catch (PrinterException e) { } catch (PrinterException e) {
} }
long hWnd = ((WWindowPeer)(owner.getPeer())).getHWnd(); final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
long hWnd = acc.<WComponentPeer>getPeer(owner).getHWnd();
DevModeValues info = new DevModeValues(); DevModeValues info = new DevModeValues();
getDevModeValues(aset, info); getDevModeValues(aset, info);
boolean ok = boolean ok =

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.awt.event.AdjustmentEvent;
import java.awt.peer.ScrollPanePeer; import java.awt.peer.ScrollPanePeer;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.PeerEvent; import sun.awt.PeerEvent;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
@ -199,7 +200,6 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void run() { public void run() {
if (getScrollChild() == null) { if (getScrollChild() == null) {
return; return;
@ -267,8 +267,9 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
// Paint the exposed area right away. To do this - find // Paint the exposed area right away. To do this - find
// the heavyweight ancestor of the scroll child. // the heavyweight ancestor of the scroll child.
Component hwAncestor = getScrollChild(); Component hwAncestor = getScrollChild();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
while (hwAncestor != null while (hwAncestor != null
&& !(hwAncestor.getPeer() instanceof WComponentPeer)) && !(acc.getPeer(hwAncestor) instanceof WComponentPeer))
{ {
hwAncestor = hwAncestor.getParent(); hwAncestor = hwAncestor.getParent();
} }
@ -278,7 +279,7 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
"couldn't find heavyweight ancestor of scroll pane child"); "couldn't find heavyweight ancestor of scroll pane child");
} }
} }
WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer(); WComponentPeer hwPeer = acc.getPeer(hwAncestor);
hwPeer.paintDamagedAreaImmediately(); hwPeer.paintDamagedAreaImmediately();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,8 @@ import java.awt.TrayIcon;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import sun.awt.AWTAccessor;
import sun.awt.AppContext; import sun.awt.AppContext;
import sun.awt.AWTAutoShutdown; import sun.awt.AWTAutoShutdown;
import sun.awt.AWTPermissions; import sun.awt.AWTPermissions;
@ -438,9 +440,8 @@ public final class WToolkit extends SunToolkit implements Runnable {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void disableBackgroundErase(Canvas canvas) { public void disableBackgroundErase(Canvas canvas) {
WCanvasPeer peer = (WCanvasPeer)canvas.getPeer(); WCanvasPeer peer = AWTAccessor.getComponentAccessor().getPeer(canvas);
if (peer == null) { if (peer == null) {
throw new IllegalStateException("Canvas must have a valid peer"); throw new IllegalStateException("Canvas must have a valid peer");
} }
@ -1100,18 +1101,18 @@ public final class WToolkit extends SunToolkit implements Runnable {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void grab(Window w) { public void grab(Window w) {
if (w.getPeer() != null) { final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
((WWindowPeer)w.getPeer()).grab(); if (peer != null) {
((WWindowPeer) peer).grab();
} }
} }
@Override @Override
@SuppressWarnings("deprecation")
public void ungrab(Window w) { public void ungrab(Window w) {
if (w.getPeer() != null) { final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
((WWindowPeer)w.getPeer()).ungrab(); if (peer != null) {
((WWindowPeer) peer).ungrab();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,8 @@ import java.awt.TrayIcon;
import java.awt.Image; import java.awt.Image;
import java.awt.peer.TrayIconPeer; import java.awt.peer.TrayIconPeer;
import java.awt.image.*; import java.awt.image.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.awt.image.IntegerComponentRaster; import sun.awt.image.IntegerComponentRaster;
@ -80,25 +82,23 @@ final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
if (isDisposed()) if (isDisposed())
return; return;
SunToolkit.executeOnEventHandlerThread(target, new Runnable() { SunToolkit.executeOnEventHandlerThread(target, () -> {
@Override PopupMenu newPopup = ((TrayIcon)target).getPopupMenu();
@SuppressWarnings("deprecation") if (popup != newPopup) {
public void run() { if (popup != null) {
PopupMenu newPopup = ((TrayIcon)target).getPopupMenu(); popupParent.remove(popup);
if (popup != newPopup) {
if (popup != null) {
popupParent.remove(popup);
}
if (newPopup != null) {
popupParent.add(newPopup);
}
popup = newPopup;
}
if (popup != null) {
((WPopupMenuPeer)popup.getPeer()).show(popupParent, new Point(x, y));
}
} }
}); if (newPopup != null) {
popupParent.add(newPopup);
}
popup = newPopup;
}
if (popup != null) {
WPopupMenuPeer peer = AWTAccessor.getMenuComponentAccessor()
.getPeer(popup);
peer.show(popupParent, new Point(x, y));
}
});
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -409,12 +409,12 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
} }
@Override @Override
@SuppressWarnings("deprecation")
public void setModalBlocked(Dialog dialog, boolean blocked) { public void setModalBlocked(Dialog dialog, boolean blocked) {
synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
{ {
// use WWindowPeer instead of WDialogPeer because of FileDialogs and PrintDialogs // use WWindowPeer instead of WDialogPeer because of FileDialogs and PrintDialogs
WWindowPeer blockerPeer = (WWindowPeer)dialog.getPeer(); WWindowPeer blockerPeer = AWTAccessor.getComponentAccessor()
.getPeer(dialog);
if (blocked) if (blocked)
{ {
modalBlocker = blockerPeer; modalBlocker = blockerPeer;
@ -609,14 +609,13 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
super.print(g); super.print(g);
} }
@SuppressWarnings("deprecation")
private void replaceSurfaceDataRecursively(Component c) { private void replaceSurfaceDataRecursively(Component c) {
if (c instanceof Container) { if (c instanceof Container) {
for (Component child : ((Container)c).getComponents()) { for (Component child : ((Container)c).getComponents()) {
replaceSurfaceDataRecursively(child); replaceSurfaceDataRecursively(child);
} }
} }
ComponentPeer cp = c.getPeer(); final Object cp = AWTAccessor.getComponentAccessor().getPeer(c);
if (cp instanceof WComponentPeer) { if (cp instanceof WComponentPeer) {
((WComponentPeer)cp).replaceSurfaceDataLater(); ((WComponentPeer)cp).replaceSurfaceDataLater();
} }
@ -818,7 +817,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* updates the list of active windows per AppContext, so the latest active * updates the list of active windows per AppContext, so the latest active
* window is always at the end of the list. The list is stored in AppContext. * window is always at the end of the list. The list is stored in AppContext.
*/ */
@SuppressWarnings( value = {"deprecation", "unchecked"}) @SuppressWarnings("unchecked")
private static class ActiveWindowListener implements PropertyChangeListener { private static class ActiveWindowListener implements PropertyChangeListener {
@Override @Override
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
@ -828,7 +827,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
} }
AppContext appContext = SunToolkit.targetToAppContext(w); AppContext appContext = SunToolkit.targetToAppContext(w);
synchronized (appContext) { synchronized (appContext) {
WWindowPeer wp = (WWindowPeer)w.getPeer(); WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
// add/move wp to the end of the list // add/move wp to the end of the list
List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY); List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
if (l != null) { if (l != null) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,9 @@ import java.awt.event.WindowEvent;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
import java.awt.peer.WindowPeer; import java.awt.peer.WindowPeer;
import java.util.ArrayList; import java.util.ArrayList;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.Win32GraphicsDevice; import sun.awt.Win32GraphicsDevice;
import sun.awt.windows.WWindowPeer; import sun.awt.windows.WWindowPeer;
import sun.java2d.pipe.hw.ContextCapabilities; import sun.java2d.pipe.hw.ContextCapabilities;
@ -176,11 +179,10 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
long hwnd); long hwnd);
@Override @Override
@SuppressWarnings("deprecation")
protected void enterFullScreenExclusive(final int screen, WindowPeer wp) protected void enterFullScreenExclusive(final int screen, WindowPeer wp)
{ {
final WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer(); final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(realFSWindow);
D3DRenderQueue rq = D3DRenderQueue.getInstance(); D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock(); rq.lock();
try { try {
@ -247,16 +249,15 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected void addFSWindowListener(Window w) { protected void addFSWindowListener(Window w) {
// if the window is not a toplevel (has an owner) we have to use the // if the window is not a toplevel (has an owner) we have to use the
// real toplevel to enter the full-screen mode with (4933099). // real toplevel to enter the full-screen mode with (4933099).
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!(w instanceof Frame) && !(w instanceof Dialog) && if (!(w instanceof Frame) && !(w instanceof Dialog) &&
(realFSWindow = getToplevelOwner(w)) != null) (realFSWindow = getToplevelOwner(w)) != null)
{ {
ownerOrigBounds = realFSWindow.getBounds(); ownerOrigBounds = realFSWindow.getBounds();
WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer(); WWindowPeer fp = acc.getPeer(realFSWindow);
ownerWasVisible = realFSWindow.isVisible(); ownerWasVisible = realFSWindow.isVisible();
Rectangle r = w.getBounds(); Rectangle r = w.getBounds();
// we use operations on peer instead of component because calling // we use operations on peer instead of component because calling
@ -268,14 +269,13 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
} }
fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop(); fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop();
((WWindowPeer)realFSWindow.getPeer()).setAlwaysOnTop(true); ((WWindowPeer) acc.getPeer(realFSWindow)).setAlwaysOnTop(true);
fsWindowListener = new D3DFSWindowAdapter(); fsWindowListener = new D3DFSWindowAdapter();
realFSWindow.addWindowListener(fsWindowListener); realFSWindow.addWindowListener(fsWindowListener);
} }
@Override @Override
@SuppressWarnings("deprecation")
protected void removeFSWindowListener(Window w) { protected void removeFSWindowListener(Window w) {
realFSWindow.removeWindowListener(fsWindowListener); realFSWindow.removeWindowListener(fsWindowListener);
fsWindowListener = null; fsWindowListener = null;
@ -290,7 +290,8 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
* its original size (just like the Window is being resized * its original size (just like the Window is being resized
* to its original size in GraphicsDevice). * to its original size in GraphicsDevice).
*/ */
WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer(); final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(realFSWindow);
if (wpeer != null) { if (wpeer != null) {
if (ownerOrigBounds != null) { if (ownerOrigBounds != null) {
// if the window went into fs mode before it was realized it // if the window went into fs mode before it was realized it
@ -340,7 +341,6 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
int bitDepth, int bitDepth,
int refreshRate); int refreshRate);
@Override @Override
@SuppressWarnings("deprecation")
protected void configDisplayMode(final int screen, final WindowPeer w, protected void configDisplayMode(final int screen, final WindowPeer w,
final int width, final int height, final int width, final int height,
final int bitDepth, final int refreshRate) final int bitDepth, final int refreshRate)
@ -351,8 +351,8 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
refreshRate); refreshRate);
return; return;
} }
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
final WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer(); .getPeer(realFSWindow);
// REMIND: we do this before we switch the display mode, so // REMIND: we do this before we switch the display mode, so
// the dimensions may be exceeding the dimensions of the screen, // the dimensions may be exceeding the dimensions of the screen,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,6 +38,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.util.ThreadGroupUtils; import sun.awt.util.ThreadGroupUtils;
import sun.awt.Win32GraphicsConfig; import sun.awt.Win32GraphicsConfig;
import sun.awt.windows.WComponentPeer; import sun.awt.windows.WComponentPeer;
@ -531,11 +532,11 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager
* @param comp component to check for hw children * @param comp component to check for hw children
* @return true if Component has heavyweight children * @return true if Component has heavyweight children
*/ */
@SuppressWarnings("deprecation")
private static boolean hasHWChildren(Component comp) { private static boolean hasHWChildren(Component comp) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (comp instanceof Container) { if (comp instanceof Container) {
for (Component c : ((Container)comp).getComponents()) { for (Component c : ((Container)comp).getComponents()) {
if (c.getPeer() instanceof WComponentPeer || hasHWChildren(c)) { if (acc.getPeer(c) instanceof WComponentPeer || hasHWChildren(c)) {
return true; return true;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,9 @@ import java.awt.GraphicsConfiguration;
import java.awt.Image; import java.awt.Image;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.Win32GraphicsConfig; import sun.awt.Win32GraphicsConfig;
import sun.awt.image.SunVolatileImage; import sun.awt.image.SunVolatileImage;
import sun.awt.image.SurfaceManager; import sun.awt.image.SurfaceManager;
@ -79,12 +82,11 @@ public class D3DVolatileSurfaceManager
* Create a pbuffer-based SurfaceData object (or init the backbuffer * Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig). * of an existing window if this is a double buffered GraphicsConfig).
*/ */
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() { protected SurfaceData initAcceleratedSurface() {
SurfaceData sData; SurfaceData sData;
Component comp = vImg.getComponent(); Component comp = vImg.getComponent();
WComponentPeer peer = final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
(comp != null) ? (WComponentPeer)comp.getPeer() : null; WComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try { try {
boolean forceback = false; boolean forceback = false;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,9 @@ import java.awt.Component;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.image.SunVolatileImage; import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager; import sun.awt.image.VolatileSurfaceManager;
import sun.awt.windows.WComponentPeer; import sun.awt.windows.WComponentPeer;
@ -73,12 +76,11 @@ public class WGLVolatileSurfaceManager
* Create a pbuffer-based SurfaceData object (or init the backbuffer * Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig). * of an existing window if this is a double buffered GraphicsConfig).
*/ */
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() { protected SurfaceData initAcceleratedSurface() {
SurfaceData sData; SurfaceData sData;
Component comp = vImg.getComponent(); Component comp = vImg.getComponent();
WComponentPeer peer = final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
(comp != null) ? (WComponentPeer)comp.getPeer() : null; WComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try { try {
boolean createVSynced = false; boolean createVSynced = false;

View File

@ -985,7 +985,7 @@ extern "C" {
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_java_awt_Font_initIDs(JNIEnv *env, jclass cls) Java_java_awt_Font_initIDs(JNIEnv *env, jclass cls)
{ {
CHECK_NULL(AwtFont::peerMID = env->GetMethodID(cls, "getPeer", CHECK_NULL(AwtFont::peerMID = env->GetMethodID(cls, "getFontPeer",
"()Ljava/awt/peer/FontPeer;")); "()Ljava/awt/peer/FontPeer;"));
CHECK_NULL(AwtFont::pDataID = env->GetFieldID(cls, "pData", "J")); CHECK_NULL(AwtFont::pDataID = env->GetFieldID(cls, "pData", "J"));
CHECK_NULL(AwtFont::nameID = CHECK_NULL(AwtFont::nameID =

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,6 @@ public class HeadlessComponent {
comp.getName(); comp.getName();
comp.setName("goober"); comp.setName("goober");
comp.getParent(); comp.getParent();
comp.getPeer();
comp.getGraphicsConfiguration(); comp.getGraphicsConfiguration();
comp.getTreeLock(); comp.getTreeLock();
comp.getToolkit(); comp.getToolkit();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,7 +87,6 @@ public class HeadlessContainer {
lw.setName("goober"); lw.setName("goober");
lw.getName(); lw.getName();
lw.getParent(); lw.getParent();
lw.getPeer();
lw.getGraphicsConfiguration(); lw.getGraphicsConfiguration();
lw.getTreeLock(); lw.getTreeLock();
lw.getToolkit(); lw.getToolkit();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,6 @@ public class HeadlessPanel {
p.setName("goober"); p.setName("goober");
p.getName(); p.getName();
p.getParent(); p.getParent();
p.getPeer();
p.getGraphicsConfiguration(); p.getGraphicsConfiguration();
p.getTreeLock(); p.getTreeLock();
p.getToolkit(); p.getToolkit();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -224,11 +224,6 @@ public class HeadlessFont {
f2.hasUniformLineMetrics(); f2.hasUniformLineMetrics();
f3.hasUniformLineMetrics(); f3.hasUniformLineMetrics();
f4.hasUniformLineMetrics(); f4.hasUniformLineMetrics();
f1.getPeer();
f2.getPeer();
f3.getPeer();
f4.getPeer();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.*; import javax.swing.*;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame; import sun.awt.EmbeddedFrame;
import java.io.*; import java.io.*;
import test.java.awt.regtesthelpers.Util; import test.java.awt.regtesthelpers.Util;
@ -243,8 +245,9 @@ public abstract class OverlappingTestBase {
if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) { if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) {
getWindowMethodName = "getWindow"; getWindowMethodName = "getWindow";
} }
ComponentPeer peer = embedder.getPeer(); ComponentPeer peer = AWTAccessor.getComponentAccessor()
// System.err.println("Peer: " + peer); .getPeer(embedder);
// System.err.println("Peer: " + peer);
Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName); Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName);
frameWindow = (Long) getWindowMethod.invoke(peer); frameWindow = (Long) getWindowMethod.invoke(peer);
// System.err.println("frame peer ID: " + frameWindow); // System.err.println("frame peer ID: " + frameWindow);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,6 @@
import java.awt.*; import java.awt.*;
import java.awt.peer.ButtonPeer;
/** /**
* @test * @test
@ -66,23 +65,16 @@ public final class ButtonRepaint extends Button {
setLabel(""); setLabel("");
setLabel(null); setLabel(null);
setLabel(getLabel()); setLabel(getLabel());
((ButtonPeer) getPeer()).setLabel("");
((ButtonPeer) getPeer()).setLabel(null);
((ButtonPeer) getPeer()).setLabel(getLabel());
setFont(null); setFont(null);
setFont(getFont()); setFont(getFont());
getPeer().setFont(getFont());
setBackground(null); setBackground(null);
setBackground(getBackground()); setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null); setForeground(null);
setForeground(getForeground()); setForeground(getForeground());
getPeer().setForeground(getForeground());
setEnabled(isEnabled()); setEnabled(isEnabled());
getPeer().setEnabled(isEnabled());
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,6 @@
*/ */
import java.awt.*; import java.awt.*;
import java.awt.peer.CheckboxPeer;
/** /**
* @test * @test
@ -63,31 +62,21 @@ public final class CheckboxRepaint extends Checkbox {
void test() { void test() {
setState(getState()); setState(getState());
((CheckboxPeer) getPeer()).setState(getState());
setCheckboxGroup(getCheckboxGroup()); setCheckboxGroup(getCheckboxGroup());
((CheckboxPeer) getPeer()).setCheckboxGroup(getCheckboxGroup());
setLabel(""); setLabel("");
setLabel(null); setLabel(null);
setLabel(getLabel()); setLabel(getLabel());
((CheckboxPeer) getPeer()).setLabel("");
((CheckboxPeer) getPeer()).setLabel(null);
((CheckboxPeer) getPeer()).setLabel(getLabel());
setFont(null); setFont(null);
setFont(getFont()); setFont(getFont());
getPeer().setFont(getFont());
setBackground(null); setBackground(null);
setBackground(getBackground()); setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null); setForeground(null);
setForeground(getForeground()); setForeground(getForeground());
getPeer().setForeground(getForeground());
setEnabled(isEnabled()); setEnabled(isEnabled());
getPeer().setEnabled(isEnabled());
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,6 @@ import java.awt.EventQueue;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Label; import java.awt.Label;
import java.awt.peer.LabelPeer;
/** /**
* @test * @test
@ -66,28 +65,20 @@ public final class LabelRepaint extends Label {
void test() { void test() {
setAlignment(getAlignment()); setAlignment(getAlignment());
((LabelPeer) getPeer()).setAlignment(getAlignment());
setText(""); setText("");
setText(null); setText(null);
setText(getText()); setText(getText());
((LabelPeer) getPeer()).setText("");
((LabelPeer) getPeer()).setText(null);
((LabelPeer) getPeer()).setText(getText());
setFont(null); setFont(null);
setFont(getFont()); setFont(getFont());
getPeer().setFont(getFont());
setBackground(null); setBackground(null);
setBackground(getBackground()); setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null); setForeground(null);
setForeground(getForeground()); setForeground(getForeground());
getPeer().setForeground(getForeground());
setEnabled(isEnabled()); setEnabled(isEnabled());
getPeer().setEnabled(isEnabled());
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,6 @@ import java.awt.EventQueue;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.List; import java.awt.List;
import java.awt.peer.ListPeer;
/** /**
* @test * @test
@ -71,21 +70,16 @@ public final class ListRepaint extends List {
void test() { void test() {
select(0); select(0);
((ListPeer) getPeer()).select(getSelectedIndex());
setFont(null); setFont(null);
setFont(getFont()); setFont(getFont());
getPeer().setFont(getFont());
setBackground(null); setBackground(null);
setBackground(getBackground()); setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null); setForeground(null);
setForeground(getForeground()); setForeground(getForeground());
getPeer().setForeground(getForeground());
setEnabled(isEnabled()); setEnabled(isEnabled());
getPeer().setEnabled(isEnabled());
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -42,6 +42,9 @@ import javax.swing.JTextArea;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.text.DefaultCaret; import javax.swing.text.DefaultCaret;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
public class bug7129742 { public class bug7129742 {
@ -64,7 +67,8 @@ public class bug7129742 {
frame.setVisible(true); frame.setVisible(true);
try { try {
Class XTextAreaPeerClzz = textArea.getPeer().getClass(); ComponentAccessor acc = AWTAccessor.getComponentAccessor();
Class XTextAreaPeerClzz = acc.getPeer(textArea).getClass();
System.out.println(XTextAreaPeerClzz.getName()); System.out.println(XTextAreaPeerClzz.getName());
if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) { if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) {
fastreturn = true; fastreturn = true;
@ -73,7 +77,7 @@ public class bug7129742 {
Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext"); Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext");
jtextField.setAccessible(true); jtextField.setAccessible(true);
JTextArea jtext = (JTextArea)jtextField.get(textArea.getPeer()); JTextArea jtext = (JTextArea)jtextField.get(acc.getPeer(textArea));
caret = (DefaultCaret) jtext.getCaret(); caret = (DefaultCaret) jtext.getCaret();
textArea.requestFocusInWindow(); textArea.requestFocusInWindow();

Some files were not shown because too many files have changed in this diff Show More