src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -567,21 +567,21 @@
// fallback default font object
final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
@Override
- @SuppressWarnings("deprecation")
public Graphics getGraphics() {
if (isDisposed()) {
return null;
}
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.
// Redirect all painting to the Window's Graphics instead.
// The caller is responsible for calling the
@@ -683,11 +683,10 @@
WGlobalCursorManager.getCursorManager().updateCursorImmediately();
}
// TODO: consider moving it to KeyboardFocusManagerPeerImpl
@Override
- @SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
CausedFocusEvent.Cause cause)
{
if (WKeyboardFocusManagerPeer.
@@ -711,11 +710,12 @@
}
Window parentWindow = SunToolkit.getContainingWindow((Component)target);
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");
}
boolean res = wpeer.requestWindowFocus(cause);
@@ -1102,27 +1102,27 @@
// REMIND: Temp workaround for issues with using HW acceleration
// 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();
}
if (c == null) {
return true;
}
- return ((WEmbeddedFramePeer)c.getPeer()).isAccelCapable();
+ final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
+ .getPeer(c);
+ return peer.isAccelCapable();
}
/**
* Applies the shape to the native component window.
* @since 1.7
*/
@Override
- @SuppressWarnings("deprecation")
public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
shapeLog.finer("*** INFO: Setting shape: PEER: " + this
+ "; TARGET: " + target
+ "; SHAPE: " + shape);