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.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,14 +25,18 @@
package com.apple.eawt;
import java.awt.*;
import java.awt.peer.*;
import java.awt.Image;
import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.Toolkit;
import java.awt.Window;
import java.beans.Beans;
import javax.swing.JMenuBar;
import sun.lwawt.*;
import sun.lwawt.macosx.*;
import sun.awt.AWTAccessor;
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.
@ -385,10 +389,8 @@ public class Application {
*
* @since Java for Mac OS X 10.7 Update 1
*/
@SuppressWarnings("deprecation")
public void requestToggleFullScreen(final Window window) {
final ComponentPeer peer = window.getPeer();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
if (!(peer instanceof LWWindowPeer)) return;
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
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.
*
* 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.lang.reflect.*;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
import sun.lwawt.macosx.CImage.Creator;
@ -41,7 +42,6 @@ class _AppDockIconHandler {
_AppDockIconHandler() { }
@SuppressWarnings("deprecation")
public void setDockMenu(final PopupMenu menu) {
fDockMenu = menu;
@ -61,8 +61,8 @@ class _AppDockIconHandler {
// instantiate the menu peer and set the native fDockMenu ivar
menu.addNotify();
final long nsMenuPtr = ((CMenu)fDockMenu.getPeer()).getNativeMenu();
nativeSetDockMenu(nsMenuPtr);
CMenu peer = AWTAccessor.getMenuComponentAccessor().getPeer(fDockMenu);
nativeSetDockMenu(peer.getNativeMenu());
}
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.
*
* 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 com.apple.laf.ScreenMenuBar;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI;
@ -49,7 +50,10 @@ class _AppMenuBarHandler {
}
// 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) {
instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
@ -92,7 +96,6 @@ class _AppMenuBarHandler {
return (frame.getExtendedState() & Frame.ICONIFIED) != 0;
}
@SuppressWarnings("deprecation")
static void installDefaultMenuBar(final JMenuBar menuBar) {
if (menuBar == null) {
// intentionally clearing the default menu
@ -114,7 +117,7 @@ class _AppMenuBarHandler {
}
screenMenuBar.addNotify();
final MenuComponentPeer peer = screenMenuBar.getPeer();
final Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar);
if (!(peer instanceof CMenuBar)) {
// such a thing should not be possible
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.
*
* 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.event.*;
import java.awt.peer.MenuComponentPeer;
import java.util.Hashtable;
import javax.swing.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.lwawt.LWToolkit;
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.
if (target != fLastMouseEventTarget) {
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) {
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;
fLastTargetRect = targetRect;
}
// Post a mouse event to the current item.
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
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
super.addNotify();
@ -248,7 +260,8 @@ final class ScreenMenu extends Menu
if (tooltipText != null) {
setToolTipText(tooltipText);
}
final MenuComponentPeer peer = getPeer();
final Object peer = AWTAccessor.getMenuComponentAccessor()
.getPeer(this);
if (peer instanceof CMenu) {
final CMenu menu = (CMenu) peer;
final long nativeMenu = menu.getNativeMenu();
@ -355,9 +368,8 @@ final class ScreenMenu extends Menu
public void setIndeterminate(boolean indeterminate) { }
@Override
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@ -365,9 +377,8 @@ final class ScreenMenu extends Menu
}
@Override
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,19 +25,21 @@
package com.apple.laf;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.*;
import java.security.*;
import java.util.*;
import javax.swing.*;
import static sun.awt.AWTAccessor.*;
@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
JMenuBar fSwingBar;
@ -246,22 +248,23 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM
fSubmenus.remove(menu);
}
@SuppressWarnings("deprecation")
public Menu add(final Menu m, final int index) {
synchronized (getTreeLock()) {
if (m.getParent() != null) {
m.getParent().remove(m);
}
final Vector<Menu> menus = AWTAccessor.getMenuBarAccessor().getMenus(this);
final Vector<Menu> menus = getMenuBarAccessor().getMenus(this);
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;
peer.setNextInsertionIndex(index);
if (m.getPeer() == null) {
final CMenuBar mPeer = acc.getPeer(m);
if (mPeer == null) {
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.
*
* 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.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuItem;
@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;
JMenuItem fMenuItem;
@ -97,9 +100,8 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
fMenuItem.removeComponentListener(this);
}
@SuppressWarnings("deprecation")
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
final MenuComponentPeer peer = menuItem.getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
if (!(peer instanceof CMenuItem)) {
//Is it possible?
return;
@ -166,18 +168,16 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
}
}
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
cmi.setToolTipText(text);
}
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
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.
*
* 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.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
@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;
MenuContainer fParent;
@ -57,12 +60,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
}
ScreenMenuPropertyListener fPropertyListener;
@SuppressWarnings("deprecation")
public void addNotify() {
super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer();
CCheckboxMenuItem ccb = AWTAccessor.getMenuComponentAccessor().getPeer(this);
ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this);
@ -155,17 +158,15 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
setVisible(false);
}
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
((CMenuItem)peer).setToolTipText(text);
}
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@ -208,9 +209,8 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
}
}
@SuppressWarnings("deprecation")
public void setIndeterminate(final boolean indeterminate) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (peer instanceof CCheckboxMenuItem) {
((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.
*
* 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;
}
@SuppressWarnings("deprecation")
private static void enterFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer();
FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
peer.enterFullScreenMode();
}
}
@SuppressWarnings("deprecation")
private static void exitFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer();
FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
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.
*
* 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.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.BackBufferCapsProvider;
import sun.java2d.SurfaceData;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
@ -74,11 +75,11 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData = null;
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 {
boolean createVSynced = false;

View File

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

View File

@ -33,6 +33,7 @@ import java.util.List;
import javax.swing.*;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.*;
import sun.java2d.loops.Blit;
import sun.java2d.loops.CompositeType;
@ -505,7 +506,7 @@ public class LWWindowPeer
@Override
public void repositionSecurityWarning() {
if (warningWindow != null) {
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
Window target = getTarget();
int x = compAccessor.getX(target);
int y = compAccessor.getY(target);
@ -563,8 +564,7 @@ public class LWWindowPeer
public void blockWindows(List<Window> windows) {
//TODO: LWX will probably need some collectJavaToplevels to speed this up
for (Window w : windows) {
WindowPeer wp =
(WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) {
wp.setModalBlocked((Dialog)getTarget(), true);
}
@ -1247,7 +1247,8 @@ public class LWWindowPeer
private boolean isOneOfOwnersOf(LWWindowPeer peer) {
Window owner = (peer != null ? peer.getTarget().getOwner() : null);
while (owner != null) {
if ((LWWindowPeer)owner.getPeer() == this) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (acc.getPeer(owner) == this) {
return true;
}
owner = owner.getOwner();
@ -1321,8 +1322,8 @@ public class LWWindowPeer
while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
owner = owner.getOwner();
}
return owner == null ? null :
(LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
return owner == null ? null : AWTAccessor.getComponentAccessor()
.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.
*
* 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.concurrent.Callable;
import sun.awt.AWTAccessor;
import sun.awt.dnd.*;
import sun.lwawt.LWComponentPeer;
import sun.lwawt.LWWindowPeer;
@ -88,7 +89,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
super.startDrag(dsc, cursor, dragImage, dragImageOffset);
}
@SuppressWarnings("deprecation")
protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
DragGestureEvent trigger = getTrigger();
InputEvent triggerEvent = trigger.getTriggerEvent();
@ -135,7 +135,9 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
try {
//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);
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.
*
* 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.Toolkit;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer;
@ -46,9 +47,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
show();
}
@SuppressWarnings("deprecation")
public void addNotify() {
if (getPeer() == null) {
if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
setPeer(peer);
@ -61,10 +61,9 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void unregisterAccelerator(AWTKeyStroke stroke) {}
@SuppressWarnings("deprecation")
protected long getLayerPtr() {
LWWindowPeer peer = (LWWindowPeer)getPeer();
return peer.getLayerPtr();
return AWTAccessor.getComponentAccessor().<LWWindowPeer>getPeer(this)
.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.
*
* 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 javax.swing.text.JTextComponent;
import sun.awt.AWTAccessor;
import sun.awt.im.InputMethodAdapter;
import sun.lwawt.*;
import static sun.awt.AWTAccessor.ComponentAccessor;
public class CInputMethod extends InputMethodAdapter {
private InputMethodContext fIMContext;
private Component fAwtFocussedComponent;
@ -385,12 +388,11 @@ public class CInputMethod extends InputMethodAdapter {
// java.awt.Toolkit#getNativeContainer() is not available
// from this package
@SuppressWarnings("deprecation")
private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
if (comp==null)
return null;
ComponentPeer peer = comp.getPeer();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(comp);
if (peer==null)
return null;
@ -398,7 +400,7 @@ public class CInputMethod extends InputMethodAdapter {
comp = comp.getParent();
if (comp==null)
return null;
peer = comp.getPeer();
peer = acc.getPeer(comp);
if (peer==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.
*
* 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.peer.MenuBarPeer;
import sun.awt.AWTAccessor;
public class CMenuBar extends CMenuComponent implements MenuBarPeer {
private int nextInsertionIndex = -1;
@ -43,9 +45,8 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer {
}
@Override
@SuppressWarnings("deprecation")
public void addHelpMenu(Menu m) {
CMenu cMenu = (CMenu)m.getPeer();
CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m);
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.
*
* 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.beans.*;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Objects;
import javax.swing.*;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLSurfaceData;
import sun.lwawt.*;
@ -193,8 +192,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@SuppressWarnings("deprecation")
public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
Component root = SwingUtilities.getRoot(p);
if (root == null || (LWWindowPeer)root.getPeer() == null) return null;
return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
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
@SuppressWarnings("deprecation")
public void setVisible(boolean visible) {
final long nsWindowPtr = getNSWindowPtr();
// Process parent-child relationship when hiding
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!visible) {
// Unparent my children
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
WindowPeer p = acc.getPeer(w);
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
@ -627,7 +627,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Add my own children to myself
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
final Object p = acc.getPeer(w);
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
@ -679,13 +679,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
@Override // PlatformWindow
@SuppressWarnings("deprecation")
public void toFront() {
final long nsWindowPtr = getNSWindowPtr();
LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if( w != null && w.getPeer() != null
&& ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if( w != null && acc.getPeer(w) != null
&& ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
&& !lwcToolkit.isApplicationActive()) {
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.
*
* 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.PropertyChangeListener;
import static sun.awt.AWTAccessor.*;
public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
private TrayIcon target;
private PopupMenu popup;
@ -68,15 +70,15 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
updateImage();
}
@SuppressWarnings("deprecation")
private CPopupMenu checkAndCreatePopupPeer() {
CPopupMenu menuPeer = null;
if (popup != null) {
try {
menuPeer = (CPopupMenu)popup.getPeer();
final MenuComponentAccessor acc = getMenuComponentAccessor();
menuPeer = acc.getPeer(popup);
if (menuPeer == null) {
popup.addNotify();
menuPeer = (CPopupMenu)popup.getPeer();
menuPeer = acc.getPeer(popup);
}
} catch (Exception e) {
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.
*
* 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.lang.reflect.InvocationTargetException;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer;
@ -48,10 +49,9 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
this.nsViewPtr = nsViewPtr;
}
@SuppressWarnings("deprecation")
@Override
public void addNotify() {
if (getPeer() == null) {
if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this));
}
@ -78,11 +78,12 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Synthetic event delivery for focus management
*/
@Override
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(boolean activated) {
if (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
* 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) {
try {
final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
LWCToolkit.invokeAndWait(new Runnable() {
@Override
public void run() {
((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height);
peer.setBoundsPrivate(0, 0, width, height);
validate();
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.
*
* 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
@SuppressWarnings("deprecation")
void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized(getTreeLock()) {
CanvasPeer peer = (CanvasPeer)getPeer();
CanvasPeer peer = (CanvasPeer) this.peer;
if (peer != null) {
gc = peer.getAppropriateGraphicsConfiguration(gc);
}

View File

@ -198,7 +198,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #addNotify
* @see #removeNotify
*/
transient ComponentPeer peer;
transient volatile ComponentPeer peer;
/**
* 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) {
return comp.getCursor_NoClientCode();
}
public ComponentPeer getPeer(Component comp) {
return comp.peer;
@SuppressWarnings("unchecked")
public <T extends ComponentPeer> T getPeer(Component comp) {
return (T) comp.peer;
}
public void setPeer(Component comp, ComponentPeer peer) {
comp.peer = peer;
@ -1068,17 +1069,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
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.
* The <code>Component</code> will receive drops only if it
@ -1179,7 +1169,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
graphicsConfig = gc;
ComponentPeer peer = getPeer();
ComponentPeer peer = this.peer;
if (peer != null) {
return peer.updateGraphicsData(gc);
}
@ -1281,7 +1271,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isDisplayable() {
return getPeer() != null;
return peer != null;
}
/**
@ -2582,7 +2572,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isOpaque() {
if (getPeer() == null) {
if (peer == null) {
return false;
}
else {
@ -2608,7 +2598,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isLightweight() {
return getPeer() instanceof LightweightPeer;
return peer instanceof LightweightPeer;
}
@ -3126,7 +3116,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
* obtained
* @return the font metrics for <code>font</code>
* @see #getFont
* @see #getPeer
* @see java.awt.peer.ComponentPeer#getFontMetrics(Font)
* @see Toolkit#getFontMetrics(Font)
* @since 1.0
@ -3186,7 +3175,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (nativeContainer == null) return;
ComponentPeer cPeer = nativeContainer.getPeer();
ComponentPeer cPeer = nativeContainer.peer;
if (cPeer != null) {
cPeer.updateCursorImmediately();
@ -5019,7 +5008,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (source != null) {
Container target = source.getNativeContainer();
if (target != null) {
tpeer = target.getPeer();
tpeer = target.peer;
}
}
}
@ -9851,7 +9840,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
if (!isLightweight()) {
ComponentPeer peer = getPeer();
ComponentPeer peer = this.peer;
if (peer != null) {
// The Region class has some optimizations. That's why
// 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--) {
Component comp = cont.getComponent(i);
if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
return comp.getPeer();
return comp.peer;
}
}
// traversing the hierarchy up to the closest HW container;

View File

@ -820,7 +820,7 @@ public class Container extends Component {
}
} else {
// 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 (comp instanceof Container) {
// Traverse component's tree till depth-first until encountering heavyweight component
reparentTraverse((ContainerPeer)getPeer(), (Container)comp);
reparentTraverse((ContainerPeer)peer, (Container)comp);
}
} else {
comp.getPeer().reparent((ContainerPeer)getPeer());
comp.peer.reparent((ContainerPeer) peer);
}
}
@ -4195,7 +4195,7 @@ public class Container extends Component {
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setVisible(true);
}
@ -4217,7 +4217,7 @@ public class Container extends Component {
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setVisible(false);
}
@ -4239,7 +4239,7 @@ public class Container extends Component {
((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin);
}
} else {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(),
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.
*
* 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;
* <code>false</code> otherwise
*/
@SuppressWarnings("deprecation")
protected boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isEnabled()))
@ -123,7 +122,7 @@ public class DefaultFocusTraversalPolicy
return focusable;
}
ComponentPeer peer = aComponent.getPeer();
ComponentPeer peer = aComponent.peer;
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.
*
* 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>
* @see Component#dispatchEvent
*/
@SuppressWarnings("deprecation")
public boolean dispatchKeyEvent(KeyEvent e) {
Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();
@ -824,14 +823,14 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// Allow the peer to process KeyEvent
Component source = e.getComponent();
ComponentPeer peer = source.getPeer();
ComponentPeer peer = source.peer;
if (peer == null || peer instanceof LightweightPeer) {
// if focus owner is lightweight then its native container
// processes event
Container target = source.getNativeContainer();
if (target != null) {
peer = target.getPeer();
peer = target.peer;
}
}
if (peer != null) {
@ -1049,7 +1048,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
Component source = (Component)ke.getSource();
Container target = source.getNativeContainer();
if (target != null) {
ComponentPeer peer = target.getPeer();
ComponentPeer peer = target.peer;
if (peer != null) {
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.
*
* 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.AWTPermissions;
import sun.awt.SunToolkit;
import sun.awt.PeerEvent;
import sun.awt.util.IdentityArrayList;
import sun.awt.util.IdentityLinkedList;
import java.security.AccessControlException;
import java.util.function.BooleanSupplier;
/**
* 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 #removeNotify
*/
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
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.
*
* 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
* of the file dialog without changing its functionality.
*/
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
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.
*
* 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.text.AttributedCharacterIterator.Attribute;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
@ -239,6 +238,11 @@ public class Font implements java.io.Serializable
public boolean isCreatedFont(Font font) {
return font.createdFont;
}
@Override
public FontPeer getFontPeer(final Font font) {
return font.getFontPeer();
}
}
static {
@ -434,24 +438,15 @@ public class Font implements java.io.Serializable
private static final long serialVersionUID = -4206021311591459213L;
/**
* Gets the peer of this <code>Font</code>.
* @return the peer of the <code>Font</code>.
* @since 1.1
* @deprecated Font rendering is now platform independent.
* Gets the peer of this {@code Font}.
*
* @return the peer of the {@code Font}.
*/
@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")
final FontPeer getPeer_NoClientCode() {
private FontPeer getFontPeer() {
if(peer == null) {
Toolkit tk = Toolkit.getDefaultToolkit();
this.peer = tk.getFontPeer(name, style);
peer = tk.getFontPeer(name, style);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -3054,11 +3054,10 @@ public abstract class KeyboardFocusManager
return (wto != wfrom);
}
@SuppressWarnings("deprecation")
static Component getHeavyweight(Component comp) {
if (comp == null || comp.getPeer() == null) {
if (comp == null || comp.peer == null) {
return null;
} else if (comp.getPeer() instanceof LightweightPeer) {
} else if (comp.peer instanceof LightweightPeer) {
return comp.getNativeContainer();
} else {
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;
/**
@ -142,6 +142,11 @@ public abstract class MenuComponent implements java.io.Serializable {
menuComp.appContext = appContext;
}
@Override
@SuppressWarnings("unchecked")
public <T extends MenuComponentPeer> T getPeer(MenuComponent menuComp) {
return (T) menuComp.peer;
}
@Override
public MenuContainer getParent(MenuComponent menuComp) {
return menuComp.parent;
}
@ -225,16 +230,6 @@ public abstract class MenuComponent implements java.io.Serializable {
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.
* @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.
*
* 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
* @exception RuntimeException if the parent is not showing on screen
*/
@SuppressWarnings("deprecation")
public void show(Component origin, int x, int y) {
// Use localParent for thread safety.
MenuContainer localParent = parent;
@ -177,7 +176,7 @@ public class PopupMenu extends Menu {
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");
}
if (peer == null) {

View File

@ -29,7 +29,6 @@ import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.im.InputContext;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.peer.ComponentPeer;
import java.awt.peer.WindowPeer;
import java.beans.PropertyChangeListener;
@ -56,7 +55,6 @@ import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
import sun.awt.SunToolkit;
import sun.awt.util.IdentityArrayList;
import sun.java2d.Disposer;
import sun.java2d.pipe.Region;
import sun.security.action.GetPropertyAction;
import sun.util.logging.PlatformLogger;
@ -755,11 +753,10 @@ public class Window extends Container implements Accessible {
* @see Container#removeNotify
* @since 1.0
*/
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
Container parent = this.parent;
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
@ -802,7 +799,7 @@ public class Window extends Container implements Accessible {
@SuppressWarnings("deprecation")
public void pack() {
Container parent = this.parent;
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
@ -1072,10 +1069,9 @@ public class Window extends Container implements Accessible {
}
}
@SuppressWarnings("deprecation")
static void updateChildFocusableWindowState(Window w) {
if (w.getPeer() != null && w.isShowing()) {
((WindowPeer)w.getPeer()).updateFocusableWindowState();
if (w.peer != null && w.isShowing()) {
((WindowPeer)w.peer).updateFocusableWindowState();
}
for (int i = 0; i < w.ownedWindowList.size(); i++) {
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
* child overrides dispose() in a wrong way without calling super.dispose().
*/
@SuppressWarnings("deprecation")
void disposeImpl() {
dispose();
if (getPeer() != null) {
if (peer != null) {
doDispose();
}
}
@ -3651,7 +3646,7 @@ public class Window extends Container implements Accessible {
}
}
this.opacity = opacity;
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpacity(opacity);
}
@ -3728,7 +3723,6 @@ public class Window extends Container implements Accessible {
*
* @since 1.7
*/
@SuppressWarnings("deprecation")
public void setShape(Shape shape) {
synchronized (getTreeLock()) {
if (shape != null) {
@ -3746,7 +3740,7 @@ public class Window extends Container implements Accessible {
}
}
this.shape = (shape == null) ? null : new Path2D.Float(shape);
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
}
@ -3846,7 +3840,6 @@ public class Window extends Container implements Accessible {
* @see GraphicsConfiguration#isTranslucencyCapable()
*/
@Override
@SuppressWarnings("deprecation")
public void setBackground(Color bgColor) {
Color oldBg = getBackground();
super.setBackground(bgColor);
@ -3874,7 +3867,7 @@ public class Window extends Container implements Accessible {
} else if ((oldAlpha < 255) && (alpha == 255)) {
setLayersOpaque(this, true);
}
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpaque(alpha == 255);
}
@ -3899,10 +3892,9 @@ public class Window extends Container implements Accessible {
return bg != null ? bg.getAlpha() == 255 : true;
}
@SuppressWarnings("deprecation")
private void updateWindow() {
synchronized (getTreeLock()) {
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.updateWindow();
}
@ -4090,7 +4082,6 @@ public class Window extends Container implements Accessible {
window.securityWarningHeight = height;
}
@SuppressWarnings("deprecation")
public void setSecurityWarningPosition(Window window,
Point2D point, float alignmentX, float alignmentY)
{
@ -4100,7 +4091,7 @@ public class Window extends Container implements Accessible {
window.securityWarningAlignmentY = alignmentY;
synchronized (window.getTreeLock()) {
WindowPeer peer = (WindowPeer)window.getPeer();
WindowPeer peer = (WindowPeer) window.peer;
if (peer != null) {
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.
*
* 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.dnd.peer.DropTargetPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
/**
* The <code>DropTarget</code> is associated
@ -499,15 +502,15 @@ public class DropTarget implements DropTargetListener, Serializable {
*
*/
@SuppressWarnings("deprecation")
public void addNotify(ComponentPeer peer) {
if (peer == componentPeer) return;
componentPeer = peer;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
for (Component c = component;
c != null && peer instanceof LightweightPeer; c = c.getParent()) {
peer = c.getPeer();
peer = acc.getPeer(c);
}
if (peer instanceof DropTargetPeer) {

View File

@ -57,6 +57,7 @@ import javax.swing.plaf.*;
import static javax.swing.ClientPropertyKey.*;
import javax.accessibility.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.swing.SwingUtilities2;
import sun.swing.UIClientPropertyKey;
@ -4218,9 +4219,10 @@ public abstract class JComponent extends Container implements Serializable,
* @param c the {@code Component} to be checked
* @return true if this component is lightweight
*/
@SuppressWarnings("deprecation")
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;
}
@SuppressWarnings("deprecation")
void _paintImmediately(int x, int y, int w, int h) {
Graphics g;
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(c == null || c.getPeer() == null ||
if(c == null || !c.isDisplayable() ||
paintImmediatelyClip.width <= 0 ||
paintImmediatelyClip.height <= 0) {
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.
*
* 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 sun.awt.AWTAccessor;
/**
* The "viewport" or "porthole" through which you see the underlying
* 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
* @see JComponent#isValidateRoot
* @see java.awt.Component#isValid
* @see java.awt.Component#getPeer
*/
public void scrollRectToVisible(Rectangle contentRect) {
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
* a blit and a paint is received.
*/
@SuppressWarnings("deprecation")
private boolean needsRepaintAfterBlit() {
// Find the first heavy weight ancestor. isObscured and
// canDetermineObscurity are only appropriate for heavy weights.
@ -1459,7 +1459,8 @@ public class JViewport extends JComponent implements Accessible
}
if (heavyParent != null) {
ComponentPeer peer = heavyParent.getPeer();
ComponentPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(heavyParent);
if (peer != null && peer.canDetermineObscurity() &&
!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.
*
* This code is free software; you can redistribute it and/or modify it
@ -401,7 +401,6 @@ public class RepaintManager
*
* @see JComponent#repaint
*/
@SuppressWarnings("deprecation")
private void addDirtyRegion0(Container c, int x, int y, int w, int h) {
/* 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
// of order and deadlocking.
for (Container p = c; p != null; p = p.getParent()) {
if (!p.isVisible() || (p.getPeer() == null)) {
if (!p.isVisible() || !p.isDisplayable()) {
return;
}
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@
package javax.swing.plaf.basic;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.swing.DefaultLookup;
import sun.swing.UIAction;
import javax.swing.*;
@ -1191,7 +1193,6 @@ public class BasicSplitPaneUI extends SplitPaneUI
* Should be messaged before the dragging session starts, resets
* lastDragLocation and dividerSize.
*/
@SuppressWarnings("deprecation")
protected void startDragging() {
Component leftC = splitPane.getLeftComponent();
Component rightC = splitPane.getRightComponent();
@ -1199,10 +1200,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
beginDragDividerLocation = getDividerLocation(splitPane);
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)) {
draggingHW = true;
} else if(rightC != null && (cPeer = rightC.getPeer()) != null
} else if(rightC != null && (cPeer = acc.getPeer(rightC)) != null
&& !(cPeer instanceof LightweightPeer)) {
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.
*
* 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 java.awt.*;
import java.awt.KeyboardFocusManager;
import java.awt.DefaultKeyboardFocusManager;
import java.awt.event.InputEvent;
import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent;
@ -38,6 +36,7 @@ import java.awt.geom.Point2D;
import java.awt.image.BufferStrategy;
import java.awt.peer.ComponentPeer;
import java.awt.peer.MenuComponentPeer;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessControlContext;
@ -171,7 +170,7 @@ public final class AWTAccessor {
/**
* 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.
@ -480,6 +479,11 @@ public final class AWTAccessor {
*/
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.
*/

View File

@ -27,14 +27,12 @@ package sun.awt;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.peer.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.util.Set;
import java.awt.AWTKeyStroke;
import java.applet.Applet;
import sun.applet.AppletPanel;
/**
* A generic container used for embedding Java components, usually applets.
@ -320,10 +318,9 @@ public abstract class EmbeddedFrame extends Frame
return true;
}
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
if (getPeer() == null) {
if (!isDisplayable()) {
setPeer(new NullEmbeddedFramePeer());
}
super.addNotify();
@ -331,10 +328,10 @@ public abstract class EmbeddedFrame extends Frame
}
// These three functions consitute RFE 4100710. Do not remove.
@SuppressWarnings("deprecation")
public void setCursorAllowed(boolean isCursorAllowed) {
this.isCursorAllowed = isCursorAllowed;
getPeer().updateCursorImmediately();
final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
peer.updateCursorImmediately();
}
public boolean isCursorAllowed() {
return isCursorAllowed;
@ -345,7 +342,6 @@ public abstract class EmbeddedFrame extends Frame
: Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
@SuppressWarnings("deprecation")
protected void setPeer(final ComponentPeer p){
AWTAccessor.getComponentAccessor().setPeer(EmbeddedFrame.this, p);
};
@ -458,9 +454,8 @@ public abstract class EmbeddedFrame extends Frame
* @see #getBoundsPrivate
* @since 1.5
*/
@SuppressWarnings("deprecation")
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) {
peer.setBoundsPrivate(x, y, width, height);
}
@ -490,9 +485,8 @@ public abstract class EmbeddedFrame extends Frame
* @see #setBoundsPrivate
* @since 1.6
*/
@SuppressWarnings("deprecation")
protected Rectangle getBoundsPrivate() {
final FramePeer peer = (FramePeer)getPeer();
final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
if (peer != null) {
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,6 @@
package sun.awt;
import java.awt.Component;
import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.Canvas;
import java.awt.Scrollbar;
@ -36,9 +35,7 @@ import java.awt.event.FocusEvent;
import java.awt.peer.KeyboardFocusManagerPeer;
import java.awt.peer.ComponentPeer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger;
public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer {
@ -75,7 +72,6 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
* 1) accepts focus on click (in general)
* 2) may be a focus owner (in particular)
*/
@SuppressWarnings("deprecation")
public static boolean shouldFocusOnClick(Component component) {
boolean acceptFocusOnClick = false;
@ -84,6 +80,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
// CANVAS & SCROLLBAR accept focus on click
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (component instanceof Canvas ||
component instanceof Scrollbar)
{
@ -96,11 +93,10 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
// Other components
} else {
ComponentPeer peer = (component != null ? component.getPeer() : null);
ComponentPeer peer = (component != null ? acc.getPeer(component) : null);
acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
}
return acceptFocusOnClick &&
AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
return acceptFocusOnClick && acc.canBeFocusOwner(component);
}
/*
@ -120,7 +116,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
}
Component currentOwner = currentFocusOwner;
if (currentOwner != null && currentOwner.getPeer() == null) {
if (currentOwner != null && !currentOwner.isDisplayable()) {
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.
*
* 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")
@Override public void addNotify() {
synchronized (getTreeLock()) {
if (getPeer() == null) {
if (!isDisplayable()) {
SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit();
try {
setPeer(stk.createLightweightFrame(this));
@ -115,9 +115,9 @@ public abstract class LightweightFrame extends Frame {
* @param activate if <code>true</code>, activates the frame;
* otherwise, deactivates the frame
*/
@SuppressWarnings("deprecation")
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.
*
* 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);
}
@SuppressWarnings("deprecation")
public final void runOneComponent(Component comp, Rectangle bounds,
Graphics g, Shape clip,
int weightFlags) {
if (comp == null || comp.getPeer() == null || !comp.isVisible()) {
if (comp == null || !comp.isDisplayable() || !comp.isVisible()) {
return;
}
boolean lightweight = comp.isLightweight();

View File

@ -26,6 +26,7 @@
package sun.font;
import java.awt.Font;
import java.awt.peer.FontPeer;
public abstract class FontAccess {
@ -45,4 +46,5 @@ public abstract class FontAccess {
public abstract void setFont2D(Font f, Font2DHandle h);
public abstract void setCreatedFont(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.peer.FontPeer;
import java.awt.print.Pageable;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
@ -93,6 +94,7 @@ import sun.awt.FontConfiguration;
import sun.awt.FontDescriptor;
import sun.awt.PlatformFont;
import sun.awt.SunToolkit;
import sun.font.FontAccess;
import sun.font.FontManagerFactory;
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
* doing this processing one extra time.
*/
@SuppressWarnings("deprecation")
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
CharsetString[] acs =
((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
.getFontPeer(font);
CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
@ -1229,7 +1231,6 @@ public class PSPrinterJob extends RasterPrinterJob {
return (psFonts == null) ? 0 : psFonts.length;
}
@SuppressWarnings("deprecation")
protected boolean textOut(Graphics g, String str, float x, float y,
Font mLastFont, FontRenderContext frc,
float width) {
@ -1254,9 +1255,9 @@ public class PSPrinterJob extends RasterPrinterJob {
if (str.length() == 0) {
return true;
}
CharsetString[] acs =
((PlatformFont)
(mLastFont.getPeer())).makeMultiCharsetString(str, false);
PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
.getFontPeer(mLastFont);
CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
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.
*
* 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.SwingUtilities;
import sun.awt.AWTAccessor;
import sun.awt.DisplayChangedListener;
import sun.awt.LightweightFrame;
import sun.security.action.GetPropertyAction;
@ -241,7 +242,6 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
}
@Override
@SuppressWarnings("deprecation")
public void notifyDisplayChanged(final int scaleFactor) {
if (scaleFactor != this.scaleFactor) {
if (!copyBufferEnabled) content.paintLock();
@ -254,18 +254,19 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
}
this.scaleFactor = scaleFactor;
}
if (getPeer() instanceof DisplayChangedListener) {
((DisplayChangedListener)getPeer()).displayChanged();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
if (peer instanceof DisplayChangedListener) {
((DisplayChangedListener) peer).displayChanged();
}
repaint();
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
super.addNotify();
if (getPeer() instanceof DisplayChangedListener) {
((DisplayChangedListener)getPeer()).displayChanged();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
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.
*
* 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
* @param item item to add
*/
@SuppressWarnings("deprecation")
public void addItem(MenuItem item) {
XMenuItemPeer mp = (XMenuItemPeer)item.getPeer();
XMenuItemPeer mp = AWTAccessor.getMenuComponentAccessor().getPeer(item);
if (mp != null) {
mp.setContainer(this);
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.
*
* 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.PaintEvent;
import java.awt.event.WindowEvent;
import java.awt.event.InvocationEvent;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
@ -63,6 +62,8 @@ import java.security.*;
import java.util.Collection;
import java.util.Objects;
import java.util.Set;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger;
import sun.awt.*;
import sun.awt.event.IgnorePaintEvent;
@ -182,7 +183,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
if (container instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(container.getPeer());
XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(container);
if (wpeer != null) {
return (wpeer.winAttr.visibilityState !=
XWindowAttributesData.AWT_UNOBSCURED);
@ -319,7 +321,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null");
}
XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer();
XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer == 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
*/
@SuppressWarnings("deprecation")
public void setEnabled(final boolean value) {
if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
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
// See 6176875 for more information
final Container cp = SunToolkit.getNativeContainer(target);
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (cp != null) {
status &= ((XComponentPeer) cp.getPeer()).isEnabled();
status &= acc.<XComponentPeer>getPeer(cp).isEnabled();
}
synchronized (getStateLock()) {
if (enabled == status) {
@ -412,7 +415,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
if (target instanceof Container) {
final Component[] list = ((Container) target).getComponents();
for (final Component child : list) {
final ComponentPeer p = child.getPeer();
final ComponentPeer p = acc.getPeer(child);
if (p != null) {
p.setEnabled(status && child.isEnabled());
}
@ -489,7 +492,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
XWindowPeer getParentTopLevel() {
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
// Search for parent 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) {
for (int i = 0; i < cont.getComponentCount(); i++) {
Component comp = cont.getComponent(i);
ComponentPeer peer = comp.getPeer();
Object peer = AWTAccessor.getComponentAccessor().getPeer(comp);
if (peer instanceof XComponentPeer) {
Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
if (!set.contains(window)) {
@ -1348,7 +1350,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
/****** DropTargetPeer implementation ********************/
@SuppressWarnings("deprecation")
public void addDropTarget(DropTarget dt) {
Component comp = target;
while(!(comp == null || comp instanceof Window)) {
@ -1356,14 +1357,13 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
if (comp instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
XWindowPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(comp);
if (wpeer != null) {
wpeer.addDropTarget();
}
}
}
@SuppressWarnings("deprecation")
public void removeDropTarget(DropTarget dt) {
Component comp = target;
while(!(comp == null || comp instanceof Window)) {
@ -1371,7 +1371,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
if (comp instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(comp);
if (wpeer != null) {
wpeer.removeDropTarget();
}

View File

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

View File

@ -117,7 +117,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
try {
javaToplevels = XWindowPeer.collectJavaToplevels();
for (Window w : toBlock) {
XWindowPeer wp = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
XWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) {
wp.setModalBlocked((Dialog)target, true, javaToplevels);
}
@ -139,7 +139,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
XWindowPeer focusedWindowPeer = null;
if (focusedWindow != null) {
focusedWindowPeer = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
focusedWindowPeer = AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
} else {
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -110,7 +110,6 @@ public final class XDragSourceContextPeer
return theInstance;
}
@SuppressWarnings("deprecation")
protected void startDrag(Transferable transferable,
long[] formats, Map<Long, DataFlavor> formatMap) {
Component component = getTrigger().getComponent();
@ -121,7 +120,7 @@ public final class XDragSourceContextPeer
c = AWTAccessor.getComponentAccessor().getParent(c));
if (c instanceof Window) {
wpeer = (XWindowPeer)c.getPeer();
wpeer = AWTAccessor.getComponentAccessor().getPeer(c);
}
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.
*
* 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 sun.awt.AWTAccessor;
import sun.util.logging.PlatformLogger;
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
// return true if the event is forwarded to the XEmbed child.
// Otherwise, does nothing and return false.
@SuppressWarnings("deprecation")
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
ComponentPeer peer = ((Component)source).getPeer();
Object peer = AWTAccessor.getComponentAccessor()
.getPeer((Component) source);
if (peer instanceof XEmbedCanvasPeer) {
XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
/* 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.
*
* 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);
}
@SuppressWarnings("deprecation")
boolean simulateMotifRequestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time)
{
@ -174,7 +173,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
lightweightChild = (Component)proxy;
}
Component currentOwner = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner();
if (currentOwner != null && currentOwner.getPeer() == null) {
if (currentOwner != null && !currentOwner.isDisplayable()) {
currentOwner = null;
}
FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner );

View File

@ -26,8 +26,11 @@
package sun.awt.X11;
import java.awt.AWTKeyStroke;
import java.awt.Component;
import java.awt.Toolkit;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.util.logging.PlatformLogger;
@ -63,10 +66,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
}
}
@SuppressWarnings("deprecation")
public void addNotify()
{
if (getPeer() == null) {
if (!isDisplayable()) {
XToolkit toolkit = (XToolkit)Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this));
}
@ -80,9 +82,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
/*
* The method shouldn't be called in case of active XEmbed.
*/
@SuppressWarnings("deprecation")
public boolean traverseIn(boolean direction) {
XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer();
XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (peer != null) {
if (peer.supportsXEmbed() && peer.isXEmbedActive()) {
log.fine("The method shouldn't be called when XEmbed is active!");
@ -93,9 +95,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
return false;
}
@SuppressWarnings("deprecation")
protected boolean traverseOut(boolean direction) {
XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer();
XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (direction == FORWARD) {
xefp.traverseOutForward();
}
@ -108,9 +110,9 @@ public class XEmbeddedFrame extends EmbeddedFrame {
/*
* The method shouldn't be called in case of active XEmbed.
*/
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(boolean doActivate) {
XEmbeddedFramePeer peer = (XEmbeddedFramePeer)getPeer();
XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (peer != null) {
if (peer.supportsXEmbed() && peer.isXEmbedActive()) {
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) {
XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer();
XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (xefp != null) {
xefp.registerAccelerator(stroke);
}
}
@SuppressWarnings("deprecation")
public void unregisterAccelerator(AWTKeyStroke stroke) {
XEmbeddedFramePeer xefp = (XEmbeddedFramePeer) getPeer();
XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
.getPeer(this);
if (xefp != null) {
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.
*
* 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.util.HashMap;
import java.awt.event.KeyEvent;
import java.lang.reflect.*;
import sun.awt.AWTAccessor;
public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
@ -46,13 +45,14 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche
XToolkit.removeEventDispatcher(embedder.getWindow(), this);
}
@SuppressWarnings("deprecation")
void add(long child) {
if (checkXEmbed(child)) {
Component proxy = createChildProxy(child);
((Container)embedder.getTarget()).add("Center", proxy);
if (proxy.getPeer() != null) {
children.put(Long.valueOf(child), proxy.getPeer());
XEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
.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.
*
* 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.util.Locale;
import java.util.Arrays;
import com.sun.java.swing.plaf.motif.*;
import javax.swing.plaf.ComponentUI;
import java.security.AccessController;
import java.security.PrivilegedAction;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger;
import sun.awt.AWTAccessor;
class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListener, ItemListener, KeyEventDispatcher, XChoicePeerListener {
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer");
class XFileDialogPeer extends XDialogPeer
implements FileDialogPeer, ActionListener, ItemListener,
KeyEventDispatcher, XChoicePeerListener {
private static final PlatformLogger log =
PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer");
FileDialog target;
@ -286,7 +290,8 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
fileDialog.setSize(400, 400);
// Update choice's popup width
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
XChoicePeer choicePeer = AWTAccessor.getComponentAccessor()
.getPeer(pathChoice);
choicePeer.setDrawSelectedItem(false);
choicePeer.setAlignUnder(pathField);
@ -642,7 +647,6 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
}
}
@SuppressWarnings("deprecation")
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
int id = keyEvent.getID();
int keyCode = keyEvent.getKeyCode();
@ -653,13 +657,15 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
while (comp != null) {
// Fix for 6240084 Disposing a file dialog when the drop-down is active does not dispose the dropdown menu, on Xtoolkit
// See also 6259493
ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (comp == pathChoice) {
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
XChoicePeer choicePeer = acc.getPeer(pathChoice);
if (choicePeer.isUnfurled()){
return false;
}
}
if (comp.getPeer() == this) {
Object peer = acc.getPeer(comp);
if (peer == this) {
handleCancel();
return true;
}
@ -796,16 +802,18 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
}
super.setVisible(b);
XChoicePeer choicePeer = AWTAccessor.getComponentAccessor()
.getPeer(pathChoice);
if (b == true){
// See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.addXChoicePeerListener(this);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addKeyEventDispatcher(this);
}else{
// See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.removeXChoicePeerListener();
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removeKeyEventDispatcher(this);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -124,7 +124,8 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
}
} else {
menubar = mb;
menubarPeer = (XMenuBarPeer) mb.getPeer();
menubarPeer = AWTAccessor.getMenuComponentAccessor()
.getPeer(mb);
if (menubarPeer != null) {
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.
*
* 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.im.spi.InputMethodContext;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.X11InputMethod;
import sun.util.logging.PlatformLogger;
@ -137,9 +139,10 @@ public class XInputMethod extends X11InputMethod {
XToolkit.awtUnlock();
}
@SuppressWarnings("deprecation")
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) {
if (currentFocusedWindow != null) {
from = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
from = AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
}
currentFocusedWindow = win;
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.
*
* 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();
}
@SuppressWarnings("deprecation")
public void addHelpMenu(Menu m) {
XMenuPeer mp = (XMenuPeer)m.getPeer();
XMenuPeer mp = AWTAccessor.getMenuComponentAccessor().getPeer(m);
synchronized(getMenuTreeLock()) {
helpMenu = mp;
}
@ -180,10 +179,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
/**
* called from XFramePeer.setMenuBar
*/
@SuppressWarnings("deprecation")
public void init(Frame frame) {
this.target = frame;
this.framePeer = (XFramePeer)frame.getPeer();
this.framePeer = AWTAccessor.getComponentAccessor().getPeer(frame);
XCreateWindowParams params = getDelayedParams();
params.remove(DELAYED);
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.
*
* 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.Window;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.peer.MouseInfoPeer;
import sun.awt.AWTAccessor;
public class XMouseInfoPeer implements MouseInfoPeer {
/**
@ -83,8 +84,8 @@ public class XMouseInfoPeer implements MouseInfoPeer {
// java.awt.Component.findUnderMouseInWindow checks that
// the peer is non-null by checking that the component
// is showing.
long contentWindow = ((XWindow)w.getPeer()).getContentWindow();
XWindow peer = AWTAccessor.getComponentAccessor().getPeer(w);
long contentWindow = peer.getContentWindow();
long parent = XlibUtil.getParentWindow(contentWindow);
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.
*
* 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.peer.*;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.SunGraphicsCallback;
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) {
Component comp;
int i;
Container cont = (Container) target;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
synchronized(target.getTreeLock()) {
int n = cont.getComponentCount();
for(i=0; i < n; i++) {
comp = cont.getComponent(i);
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = acc.getPeer(comp);
if (peer != null) {
Color color = comp.getBackground();
if (color == null || color.equals(c)) {
@ -102,15 +104,15 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
setForegroundForHierarchy((Container) target, c);
}
@SuppressWarnings("deprecation")
private void setForegroundForHierarchy(Container cont, Color c) {
synchronized(target.getTreeLock()) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
int n = cont.getComponentCount();
for(int i=0; i < n; i++) {
Component comp = cont.getComponent(i);
Color color = comp.getForeground();
if (color == null || color.equals(c)) {
ComponentPeer cpeer = comp.getPeer();
ComponentPeer cpeer = acc.getPeer(comp);
if (cpeer != null) {
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.
*
* 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.Graphics;
import sun.awt.AWTAccessor;
import sun.awt.RepaintArea;
/**
@ -55,10 +56,10 @@ final class XRepaintArea extends RepaintArea {
/**
* Calls <code>Component.paint(Graphics)</code> with given Graphics.
*/
@SuppressWarnings("deprecation")
protected void paintComponent(Component comp, Graphics g) {
if (comp != null) {
final XComponentPeer peer = (XComponentPeer) comp.getPeer();
final XComponentPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(comp);
if (peer != null) {
peer.paintPeer(g);
}

View File

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

View File

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

View File

@ -605,7 +605,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
Component owner =
XKeyboardFocusManagerPeer.getInstance().getCurrentFocusOwner();
if (owner != null) {
XWindow ownerWindow = (XWindow) AWTAccessor.getComponentAccessor().getPeer(owner);
XWindow ownerWindow = AWTAccessor.getComponentAccessor().getPeer(owner);
if (ownerWindow != null) {
w = ownerWindow.getContentWindow();
}
@ -2449,17 +2449,17 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
awtUnlock();
}
}
@SuppressWarnings("deprecation")
public void grab(Window w) {
if (w.getPeer() != null) {
((XWindowPeer)w.getPeer()).setGrab(true);
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
((XWindowPeer) peer).setGrab(true);
}
}
@SuppressWarnings("deprecation")
public void ungrab(Window w) {
if (w.getPeer() != null) {
((XWindowPeer)w.getPeer()).setGrab(false);
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
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.
*
* 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 sun.awt.*;
import java.awt.image.*;
import java.text.BreakIterator;
import java.util.concurrent.ArrayBlockingQueue;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.lang.reflect.InvocationTargetException;
@ -347,7 +345,6 @@ public class XTrayIconPeer implements TrayIconPeer,
}
// It's synchronized with disposal by EDT.
@SuppressWarnings("deprecation")
public void showPopupMenu(int x, int y) {
if (isDisposed())
return;
@ -366,7 +363,9 @@ public class XTrayIconPeer implements TrayIconPeer,
}
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);
}
}
@ -416,9 +415,9 @@ public class XTrayIconPeer implements TrayIconPeer,
canvas.addMouseMotionListener(eventProxy);
}
@SuppressWarnings("deprecation")
long getWindow() {
return ((XEmbeddedFramePeer)eframe.getPeer()).getWindow();
return AWTAccessor.getComponentAccessor()
.<XEmbeddedFramePeer>getPeer(eframe).getWindow();
}
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.
*
* 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 sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger;
import sun.awt.*;
@ -282,15 +283,15 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
return reparented;
}
@SuppressWarnings("deprecation")
static long getParentWindowID(Component target) {
ComponentPeer peer = target.getParent().getPeer();
Component temp = target.getParent();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(temp);
while (!(peer instanceof XWindow))
{
temp = temp.getParent();
peer = temp.getPeer();
peer = acc.getPeer(temp);
}
if (peer != null && peer instanceof XWindow)
@ -299,17 +300,17 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
}
@SuppressWarnings("deprecation")
static XWindow getParentXWindowObject(Component target) {
if (target == null) return null;
Component temp = target.getParent();
if (temp == null) return null;
ComponentPeer peer = temp.getPeer();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(temp);
if (peer == null) return null;
while ((peer != null) && !(peer instanceof XWindow))
{
temp = temp.getParent();
peer = temp.getPeer();
peer = acc.getPeer(temp);
}
if (peer != null && peer instanceof XWindow)
return (XWindow) peer;
@ -552,7 +553,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
int h = xe.get_height();
Component target = getEventSource();
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
if (!compAccessor.getIgnoreRepaint(target)
&& compAccessor.getWidth(target) != 0

View File

@ -46,6 +46,7 @@ import java.util.Vector;
import java.util.concurrent.atomic.AtomicBoolean;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.util.logging.PlatformLogger;
import sun.awt.AWTAccessor;
@ -225,7 +226,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
Window t_window = (Window)target;
Window owner = t_window.getOwner();
if (owner != null) {
ownerPeer = (XWindowPeer)owner.getPeer();
ownerPeer = AWTAccessor.getComponentAccessor().getPeer(owner);
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Owner is " + owner);
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) {
dumpIcons(winAttr.icons);
setIconHints(icons);
Window target = (Window)this.target;
Window[] children = target.getOwnedWindows();
int cnt = children.length;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
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 (((XWindowPeer)childPeer).winAttr.iconsInherited) {
((XWindowPeer)childPeer).winAttr.icons = icons;
@ -1161,7 +1162,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (warningWindow != null) {
// We can't use the coordinates stored in the XBaseWindow since
// they are zeros for decorated frames.
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
int x = compAccessor.getX(target);
int y = compAccessor.getY(target);
int width = compAccessor.getWidth(target);
@ -1486,7 +1487,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XToolkit.awtLock();
try {
if (isReparented() && delayedModalBlocking) {
addToTransientFors((XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
delayedModalBlocking = false;
}
} finally {
@ -1570,7 +1571,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
try {
// State lock should always be after awtLock
synchronized(getStateLock()) {
XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d);
XDialogPeer blockerPeer = AWTAccessor.getComponentAccessor().getPeer(d);
if (blocked) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
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
XWindowPeer chainToSplit = prevTransientFor;
while (chainToSplit != null) {
XWindowPeer blocker = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker);
XWindowPeer blocker = AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker);
if (thisChainBlockers.contains(blocker)) {
// add to this dialog's chain
setToplevelTransientFor(thisChain, chainToSplit, true, false);
@ -1913,7 +1914,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
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)) {
focusLog.fine("Parent window accepted focus request - generating focus for this window");
return true;
@ -2259,7 +2260,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
while (w != null && toplevel != this && !(toplevel instanceof XDialogPeer)) {
w = (Window) AWTAccessor.getComponentAccessor().getParent(w);
if (w != null) {
toplevel = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
toplevel = AWTAccessor.getComponentAccessor().getPeer(w);
}
}
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -326,18 +326,16 @@ public class X11GraphicsDevice
return (isFullScreenSupported() && (getFullScreenWindow() != null));
}
@SuppressWarnings("deprecation")
private static void enterFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
enterFullScreenExclusive(peer.getContentWindow());
peer.setFullScreenExclusiveModeState(true);
}
}
@SuppressWarnings("deprecation")
private static void exitFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
X11ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
peer.setFullScreenExclusiveModeState(false);
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.
*
* 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.Transparency;
import java.awt.image.ColorModel;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.X11ComponentPeer;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
@ -73,12 +76,11 @@ public class GLXVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();
X11ComponentPeer peer =
(comp != null) ? (X11ComponentPeer)comp.getPeer() : null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
X11ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try {
boolean createVSynced = false;

View File

@ -84,12 +84,10 @@ Java_java_awt_Font_initIDs
(JNIEnv *env, jclass cls)
{
#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.style = (*env)->GetFieldID(env, cls, "style", "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;"));
CHECK_NULL(fontIDs.getFamily = (*env)->GetMethodID(env, cls, "getFamily_NoClientCode",
"()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.
*
* This code is free software; you can redistribute it and/or modify it
@ -329,7 +329,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
}
@Override
@SuppressWarnings("deprecation")
public synchronized void setFullScreenWindow(Window w) {
Window old = getFullScreenWindow();
if (w == old) {
@ -353,7 +352,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
// entering the fullscreen mode.
defaultDisplayMode = null;
}
WWindowPeer peer = (WWindowPeer)old.getPeer();
WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(old);
if (peer != null) {
peer.setFullScreenExclusiveModeState(false);
// we used to destroy the buffers on exiting fs mode, this
@ -372,7 +371,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
defaultDisplayMode = getDisplayMode();
addFSWindowListener(w);
// Enter full screen exclusive mode.
WWindowPeer peer = (WWindowPeer)w.getPeer();
WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
synchronized(peer) {
enterFullScreenExclusive(screen, peer);
@ -405,7 +404,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
}
@Override
@SuppressWarnings("deprecation")
public synchronized void setDisplayMode(DisplayMode dm) {
if (!isDisplayChangeSupported()) {
super.setDisplayMode(dm);
@ -419,7 +417,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
}
Window w = getFullScreenWindow();
if (w != null) {
WWindowPeer peer = (WWindowPeer)w.getPeer();
WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
configDisplayMode(screen, peer, dm.getWidth(), dm.getHeight(),
dm.getBitDepth(), dm.getRefreshRate());
// 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.
*
* 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.WindowListener;
import java.awt.event.WindowAdapter;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
final class WChoicePeer extends WComponentPeer implements ChoicePeer {
@ -94,7 +96,6 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
native void create(WComponentPeer parent);
@Override
@SuppressWarnings("deprecation")
void initialize() {
Choice opt = (Choice)target;
int itemCount = opt.getItemCount();
@ -111,7 +112,8 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
Window parentWindow = SunToolkit.getContainingWindow((Component)target);
if (parentWindow != null) {
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer != null) {
windowListener = new WindowAdapter() {
@Override
@ -130,13 +132,13 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
}
@Override
@SuppressWarnings("deprecation")
protected void disposeImpl() {
// TODO: we should somehow reset the listener when the choice
// is moved to another toplevel without destroying its peer.
Window parentWindow = SunToolkit.getContainingWindow((Component)target);
if (parentWindow != null) {
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer != null) {
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.
*
* 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);
@Override
@SuppressWarnings("deprecation")
public Graphics getGraphics() {
if (isDisposed()) {
return null;
@ -578,8 +577,9 @@ public abstract class WComponentPeer extends WObjectPeer
Component target = (Component)getTarget();
Window window = SunToolkit.getContainingWindow(target);
if (window != null) {
Graphics g =
((WWindowPeer)window.getPeer()).getTranslucentGraphics();
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(window);
Graphics g = wpeer.getTranslucentGraphics();
// getTranslucentGraphics() returns non-null value for non-opaque windows only
if (g != null) {
// Non-opaque windows do not support heavyweight children.
@ -685,7 +685,6 @@ public abstract class WComponentPeer extends WObjectPeer
// TODO: consider moving it to KeyboardFocusManagerPeerImpl
@Override
@SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause)
@ -713,7 +712,8 @@ public abstract class WComponentPeer extends WObjectPeer
if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null");
}
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer == 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.
// @return true if the toplevel container is not an EmbeddedFrame or
// if this EmbeddedFrame is acceleration capable, false otherwise
@SuppressWarnings("deprecation")
private static final boolean isContainingTopLevelAccelCapable(Component c) {
while (c != null && !(c instanceof WEmbeddedFrame)) {
c = c.getParent();
@ -1112,7 +1111,9 @@ public abstract class WComponentPeer extends WObjectPeer
if (c == null) {
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
*/
@Override
@SuppressWarnings("deprecation")
public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
shapeLog.finer("*** INFO: Setting shape: PEER: " + this

View File

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

View File

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

View File

@ -237,7 +237,7 @@ final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
@Override
public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) {
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.
*
* 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.Locale;
import java.util.Map;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.im.InputMethodAdapter;
final class WInputMethod extends InputMethodAdapter
@ -606,18 +609,17 @@ final class WInputMethod extends InputMethodAdapter
// java.awt.Toolkit#getNativeContainer() is not available
// from this package
@SuppressWarnings("deprecation")
private WComponentPeer getNearestNativePeer(Component comp)
{
if (comp==null) return null;
ComponentPeer peer = comp.getPeer();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(comp);
if (peer==null) return null;
while (peer instanceof java.awt.peer.LightweightPeer) {
comp = comp.getParent();
if (comp==null) return null;
peer = comp.getPeer();
peer = acc.getPeer(comp);
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.
*
* 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.Component;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.KeyboardFocusManagerPeerImpl;
import sun.awt.CausedFocusEvent;
@ -46,9 +49,9 @@ final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
}
@Override
@SuppressWarnings("deprecation")
public void setCurrentFocusOwner(Component comp) {
setNativeFocusOwner(comp != null ? comp.getPeer() : null);
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
setNativeFocusOwner(comp != null ? acc.getPeer(comp) : null);
}
@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.
*
* This code is free software; you can redistribute it and/or modify it
@ -57,15 +57,13 @@ final class WPageDialog extends WPrintDialog {
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
Container parent = getParent();
if (parent != null && parent.getPeer() == null) {
if (parent != null && !parent.isDisplayable()) {
parent.addNotify();
}
if (getPeer() == null) {
if (!isDisplayable()) {
ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
createWPageDialog(this);
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -58,15 +58,14 @@ class WPrintDialog extends Dialog {
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
Container parent = getParent();
if (parent != null && parent.getPeer() == null) {
if (parent != null && !parent.isDisplayable()) {
parent.addNotify();
}
if (getPeer() == null) {
if (!isDisplayable()) {
ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
createWPrintDialog(this);
setPeer(peer);

View File

@ -112,7 +112,7 @@ class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
@Override
public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) {
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.
*
* 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.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.KeyboardFocusManager;
import java.awt.Toolkit;
import java.awt.BasicStroke;
import java.awt.Button;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.FileDialog;
@ -62,6 +60,8 @@ import java.io.File;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.print.PeekGraphics;
import sun.print.PeekMetrics;
@ -2117,7 +2117,6 @@ public final class WPrinterJob extends RasterPrinterJob
short xres_quality,
short yres);
@SuppressWarnings("deprecation")
public PrintRequestAttributeSet
showDocumentProperties(Window owner,
PrintService service,
@ -2127,7 +2126,8 @@ public final class WPrinterJob extends RasterPrinterJob
setNativePrintServiceIfNeeded(service.getName());
} 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();
getDevModeValues(aset, info);
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.
*
* 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 sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.PeerEvent;
import sun.util.logging.PlatformLogger;
@ -199,7 +200,6 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
}
@Override
@SuppressWarnings("deprecation")
public void run() {
if (getScrollChild() == null) {
return;
@ -267,8 +267,9 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
// Paint the exposed area right away. To do this - find
// the heavyweight ancestor of the scroll child.
Component hwAncestor = getScrollChild();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
while (hwAncestor != null
&& !(hwAncestor.getPeer() instanceof WComponentPeer))
&& !(acc.getPeer(hwAncestor) instanceof WComponentPeer))
{
hwAncestor = hwAncestor.getParent();
}
@ -278,7 +279,7 @@ final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
"couldn't find heavyweight ancestor of scroll pane child");
}
}
WComponentPeer hwPeer = (WComponentPeer)hwAncestor.getPeer();
WComponentPeer hwPeer = acc.getPeer(hwAncestor);
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.
*
* 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.security.AccessController;
import java.security.PrivilegedAction;
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.AWTAutoShutdown;
import sun.awt.AWTPermissions;
@ -438,9 +440,8 @@ public final class WToolkit extends SunToolkit implements Runnable {
}
@Override
@SuppressWarnings("deprecation")
public void disableBackgroundErase(Canvas canvas) {
WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
WCanvasPeer peer = AWTAccessor.getComponentAccessor().getPeer(canvas);
if (peer == null) {
throw new IllegalStateException("Canvas must have a valid peer");
}
@ -1100,18 +1101,18 @@ public final class WToolkit extends SunToolkit implements Runnable {
}
@Override
@SuppressWarnings("deprecation")
public void grab(Window w) {
if (w.getPeer() != null) {
((WWindowPeer)w.getPeer()).grab();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
((WWindowPeer) peer).grab();
}
}
@Override
@SuppressWarnings("deprecation")
public void ungrab(Window w) {
if (w.getPeer() != null) {
((WWindowPeer)w.getPeer()).ungrab();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
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.
*
* 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.peer.TrayIconPeer;
import java.awt.image.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.awt.image.IntegerComponentRaster;
@ -80,10 +82,7 @@ final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
if (isDisposed())
return;
SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
@Override
@SuppressWarnings("deprecation")
public void run() {
SunToolkit.executeOnEventHandlerThread(target, () -> {
PopupMenu newPopup = ((TrayIcon)target).getPopupMenu();
if (popup != newPopup) {
if (popup != null) {
@ -95,8 +94,9 @@ final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
popup = newPopup;
}
if (popup != null) {
((WPopupMenuPeer)popup.getPeer()).show(popupParent, new Point(x, y));
}
WPopupMenuPeer peer = AWTAccessor.getMenuComponentAccessor()
.getPeer(popup);
peer.show(popupParent, new Point(x, y));
}
});
}

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.
*
* 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
@SuppressWarnings("deprecation")
public void setModalBlocked(Dialog dialog, boolean blocked) {
synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
{
// use WWindowPeer instead of WDialogPeer because of FileDialogs and PrintDialogs
WWindowPeer blockerPeer = (WWindowPeer)dialog.getPeer();
WWindowPeer blockerPeer = AWTAccessor.getComponentAccessor()
.getPeer(dialog);
if (blocked)
{
modalBlocker = blockerPeer;
@ -609,14 +609,13 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
super.print(g);
}
@SuppressWarnings("deprecation")
private void replaceSurfaceDataRecursively(Component c) {
if (c instanceof Container) {
for (Component child : ((Container)c).getComponents()) {
replaceSurfaceDataRecursively(child);
}
}
ComponentPeer cp = c.getPeer();
final Object cp = AWTAccessor.getComponentAccessor().getPeer(c);
if (cp instanceof WComponentPeer) {
((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
* 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 {
@Override
public void propertyChange(PropertyChangeEvent e) {
@ -828,7 +827,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
AppContext appContext = SunToolkit.targetToAppContext(w);
synchronized (appContext) {
WWindowPeer wp = (WWindowPeer)w.getPeer();
WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
// add/move wp to the end of the list
List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
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.
*
* 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.peer.WindowPeer;
import java.util.ArrayList;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.Win32GraphicsDevice;
import sun.awt.windows.WWindowPeer;
import sun.java2d.pipe.hw.ContextCapabilities;
@ -176,11 +179,10 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
long hwnd);
@Override
@SuppressWarnings("deprecation")
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();
rq.lock();
try {
@ -247,16 +249,15 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
}
@Override
@SuppressWarnings("deprecation")
protected void addFSWindowListener(Window w) {
// 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).
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!(w instanceof Frame) && !(w instanceof Dialog) &&
(realFSWindow = getToplevelOwner(w)) != null)
{
ownerOrigBounds = realFSWindow.getBounds();
WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer();
WWindowPeer fp = acc.getPeer(realFSWindow);
ownerWasVisible = realFSWindow.isVisible();
Rectangle r = w.getBounds();
// we use operations on peer instead of component because calling
@ -268,14 +269,13 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
}
fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop();
((WWindowPeer)realFSWindow.getPeer()).setAlwaysOnTop(true);
((WWindowPeer) acc.getPeer(realFSWindow)).setAlwaysOnTop(true);
fsWindowListener = new D3DFSWindowAdapter();
realFSWindow.addWindowListener(fsWindowListener);
}
@Override
@SuppressWarnings("deprecation")
protected void removeFSWindowListener(Window w) {
realFSWindow.removeWindowListener(fsWindowListener);
fsWindowListener = null;
@ -290,7 +290,8 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
* its original size (just like the Window is being resized
* to its original size in GraphicsDevice).
*/
WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer();
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(realFSWindow);
if (wpeer != null) {
if (ownerOrigBounds != null) {
// if the window went into fs mode before it was realized it
@ -340,7 +341,6 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
int bitDepth,
int refreshRate);
@Override
@SuppressWarnings("deprecation")
protected void configDisplayMode(final int screen, final WindowPeer w,
final int width, final int height,
final int bitDepth, final int refreshRate)
@ -351,8 +351,8 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
refreshRate);
return;
}
final WWindowPeer wpeer = (WWindowPeer)realFSWindow.getPeer();
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(realFSWindow);
// REMIND: we do this before we switch the display mode, so
// 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.
*
* 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 sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.util.ThreadGroupUtils;
import sun.awt.Win32GraphicsConfig;
import sun.awt.windows.WComponentPeer;
@ -531,11 +532,11 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager
* @param comp component to check for hw children
* @return true if Component has heavyweight children
*/
@SuppressWarnings("deprecation")
private static boolean hasHWChildren(Component comp) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (comp instanceof Container) {
for (Component c : ((Container)comp).getComponents()) {
if (c.getPeer() instanceof WComponentPeer || hasHWChildren(c)) {
if (acc.getPeer(c) instanceof WComponentPeer || hasHWChildren(c)) {
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.
*
* 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.Transparency;
import java.awt.image.ColorModel;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.Win32GraphicsConfig;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.SurfaceManager;
@ -79,12 +82,11 @@ public class D3DVolatileSurfaceManager
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig).
*/
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();
WComponentPeer peer =
(comp != null) ? (WComponentPeer)comp.getPeer() : null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
WComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try {
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.
*
* 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.Transparency;
import java.awt.image.ColorModel;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.awt.windows.WComponentPeer;
@ -73,12 +76,11 @@ public class WGLVolatileSurfaceManager
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig).
*/
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();
WComponentPeer peer =
(comp != null) ? (WComponentPeer)comp.getPeer() : null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
WComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try {
boolean createVSynced = false;

View File

@ -985,7 +985,7 @@ extern "C" {
JNIEXPORT void JNICALL
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;"));
CHECK_NULL(AwtFont::pDataID = env->GetFieldID(cls, "pData", "J"));
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,6 @@ public class HeadlessComponent {
comp.getName();
comp.setName("goober");
comp.getParent();
comp.getPeer();
comp.getGraphicsConfiguration();
comp.getTreeLock();
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -87,7 +87,6 @@ public class HeadlessContainer {
lw.setName("goober");
lw.getName();
lw.getParent();
lw.getPeer();
lw.getGraphicsConfiguration();
lw.getTreeLock();
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,6 @@ public class HeadlessPanel {
p.setName("goober");
p.getName();
p.getParent();
p.getPeer();
p.getGraphicsConfiguration();
p.getTreeLock();
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -224,11 +224,6 @@ public class HeadlessFont {
f2.hasUniformLineMetrics();
f3.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.
*
* 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.util.ArrayList;
import javax.swing.*;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import java.io.*;
import test.java.awt.regtesthelpers.Util;
@ -243,8 +245,9 @@ public abstract class OverlappingTestBase {
if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) {
getWindowMethodName = "getWindow";
}
ComponentPeer peer = embedder.getPeer();
// System.err.println("Peer: " + peer);
ComponentPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(embedder);
// System.err.println("Peer: " + peer);
Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName);
frameWindow = (Long) getWindowMethod.invoke(peer);
// 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,6 @@
import java.awt.*;
import java.awt.peer.ButtonPeer;
/**
* @test
@ -66,23 +65,16 @@ public final class ButtonRepaint extends Button {
setLabel("");
setLabel(null);
setLabel(getLabel());
((ButtonPeer) getPeer()).setLabel("");
((ButtonPeer) getPeer()).setLabel(null);
((ButtonPeer) getPeer()).setLabel(getLabel());
setFont(null);
setFont(getFont());
getPeer().setFont(getFont());
setBackground(null);
setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null);
setForeground(getForeground());
getPeer().setForeground(getForeground());
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,6 @@
*/
import java.awt.*;
import java.awt.peer.CheckboxPeer;
/**
* @test
@ -63,31 +62,21 @@ public final class CheckboxRepaint extends Checkbox {
void test() {
setState(getState());
((CheckboxPeer) getPeer()).setState(getState());
setCheckboxGroup(getCheckboxGroup());
((CheckboxPeer) getPeer()).setCheckboxGroup(getCheckboxGroup());
setLabel("");
setLabel(null);
setLabel(getLabel());
((CheckboxPeer) getPeer()).setLabel("");
((CheckboxPeer) getPeer()).setLabel(null);
((CheckboxPeer) getPeer()).setLabel(getLabel());
setFont(null);
setFont(getFont());
getPeer().setFont(getFont());
setBackground(null);
setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null);
setForeground(getForeground());
getPeer().setForeground(getForeground());
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.
*
* 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.Graphics;
import java.awt.Label;
import java.awt.peer.LabelPeer;
/**
* @test
@ -66,28 +65,20 @@ public final class LabelRepaint extends Label {
void test() {
setAlignment(getAlignment());
((LabelPeer) getPeer()).setAlignment(getAlignment());
setText("");
setText(null);
setText(getText());
((LabelPeer) getPeer()).setText("");
((LabelPeer) getPeer()).setText(null);
((LabelPeer) getPeer()).setText(getText());
setFont(null);
setFont(getFont());
getPeer().setFont(getFont());
setBackground(null);
setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null);
setForeground(getForeground());
getPeer().setForeground(getForeground());
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.
*
* 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.Graphics;
import java.awt.List;
import java.awt.peer.ListPeer;
/**
* @test
@ -71,21 +70,16 @@ public final class ListRepaint extends List {
void test() {
select(0);
((ListPeer) getPeer()).select(getSelectedIndex());
setFont(null);
setFont(getFont());
getPeer().setFont(getFont());
setBackground(null);
setBackground(getBackground());
getPeer().setBackground(getBackground());
setForeground(null);
setForeground(getForeground());
getPeer().setForeground(getForeground());
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.
*
* 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.text.DefaultCaret;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
public class bug7129742 {
@ -64,7 +67,8 @@ public class bug7129742 {
frame.setVisible(true);
try {
Class XTextAreaPeerClzz = textArea.getPeer().getClass();
ComponentAccessor acc = AWTAccessor.getComponentAccessor();
Class XTextAreaPeerClzz = acc.getPeer(textArea).getClass();
System.out.println(XTextAreaPeerClzz.getName());
if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) {
fastreturn = true;
@ -73,7 +77,7 @@ public class bug7129742 {
Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext");
jtextField.setAccessible(true);
JTextArea jtext = (JTextArea)jtextField.get(textArea.getPeer());
JTextArea jtext = (JTextArea)jtextField.get(acc.getPeer(textArea));
caret = (DefaultCaret) jtext.getCaret();
textArea.requestFocusInWindow();

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