src/java.desktop/share/classes/java/awt/Window.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -27,11 +27,10 @@
import java.awt.event.*;
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;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -54,11 +53,10 @@
import sun.awt.AWTPermissions;
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;
/**
@@ -753,15 +751,14 @@
* not be called directly by programs.
* @see Component#isDisplayable
* @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) {
peer = getToolkit().createWindow(this);
}
@@ -800,11 +797,11 @@
* @see #setMinimumSize
*/
@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) {
addNotify();
}
@@ -1070,14 +1067,13 @@
postWindowEvent(WindowEvent.WINDOW_OPENED);
state |= OPENED;
}
}
- @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();
if (child != null) {
updateChildFocusableWindowState(child);
@@ -1158,14 +1154,13 @@
* Fix for 4872170.
* If dispose() is called on parent then its children have to be disposed as well
* 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();
}
}
void doDispose() {
@@ -3647,11 +3642,11 @@
throw new UnsupportedOperationException(
"TRANSLUCENT translucency is not supported.");
}
}
this.opacity = opacity;
- WindowPeer peer = (WindowPeer)getPeer();
+ WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpacity(opacity);
}
}
}
@@ -3724,11 +3719,10 @@
* @see GraphicsDevice.WindowTranslucency
* @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
*
* @since 1.7
*/
- @SuppressWarnings("deprecation")
public void setShape(Shape shape) {
synchronized (getTreeLock()) {
if (shape != null) {
GraphicsConfiguration gc = getGraphicsConfiguration();
GraphicsDevice gd = gc.getDevice();
@@ -3742,11 +3736,11 @@
throw new UnsupportedOperationException(
"PERPIXEL_TRANSPARENT translucency is not supported.");
}
}
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));
}
}
}
@@ -3842,11 +3836,10 @@
* @see GraphicsDevice.WindowTranslucency
* @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
* @see GraphicsConfiguration#isTranslucencyCapable()
*/
@Override
- @SuppressWarnings("deprecation")
public void setBackground(Color bgColor) {
Color oldBg = getBackground();
super.setBackground(bgColor);
if (oldBg != null && oldBg.equals(bgColor)) {
return;
@@ -3870,11 +3863,11 @@
}
setLayersOpaque(this, false);
} 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);
}
}
@@ -3895,14 +3888,13 @@
public boolean isOpaque() {
Color bg = getBackground();
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();
}
}
}
@@ -4086,21 +4078,20 @@
{
window.securityWarningWidth = width;
window.securityWarningHeight = height;
}
- @SuppressWarnings("deprecation")
public void setSecurityWarningPosition(Window window,
Point2D point, float alignmentX, float alignmentY)
{
window.securityWarningPointX = point.getX();
window.securityWarningPointY = point.getY();
window.securityWarningAlignmentX = alignmentX;
window.securityWarningAlignmentY = alignmentY;
synchronized (window.getTreeLock()) {
- WindowPeer peer = (WindowPeer)window.getPeer();
+ WindowPeer peer = (WindowPeer) window.peer;
if (peer != null) {
peer.repositionSecurityWarning();
}
}
}