src/java.desktop/share/classes/java/awt/Window.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1995, 2014, 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
--- 1,7 ----
/*
! * 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,37 ****
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;
--- 27,36 ----
*** 54,64 ****
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;
/**
--- 53,62 ----
*** 753,767 ****
* 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) {
parent.addNotify();
}
if (peer == null) {
peer = getToolkit().createWindow(this);
}
--- 751,764 ----
* not be called directly by programs.
* @see Component#isDisplayable
* @see Container#removeNotify
* @since 1.0
*/
public void addNotify() {
synchronized (getTreeLock()) {
Container parent = this.parent;
! if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
peer = getToolkit().createWindow(this);
}
*** 800,810 ****
* @see #setMinimumSize
*/
@SuppressWarnings("deprecation")
public void pack() {
Container parent = this.parent;
! if (parent != null && parent.getPeer() == null) {
parent.addNotify();
}
if (peer == null) {
addNotify();
}
--- 797,807 ----
* @see #setMinimumSize
*/
@SuppressWarnings("deprecation")
public void pack() {
Container parent = this.parent;
! if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
addNotify();
}
*** 1070,1083 ****
postWindowEvent(WindowEvent.WINDOW_OPENED);
state |= OPENED;
}
}
- @SuppressWarnings("deprecation")
static void updateChildFocusableWindowState(Window w) {
! if (w.getPeer() != null && w.isShowing()) {
! ((WindowPeer)w.getPeer()).updateFocusableWindowState();
}
for (int i = 0; i < w.ownedWindowList.size(); i++) {
Window child = w.ownedWindowList.elementAt(i).get();
if (child != null) {
updateChildFocusableWindowState(child);
--- 1067,1079 ----
postWindowEvent(WindowEvent.WINDOW_OPENED);
state |= OPENED;
}
}
static void updateChildFocusableWindowState(Window w) {
! 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,1171 ****
* 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) {
doDispose();
}
}
void doDispose() {
--- 1154,1166 ----
* 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().
*/
void disposeImpl() {
dispose();
! if (peer != null) {
doDispose();
}
}
void doDispose() {
*** 3647,3657 ****
throw new UnsupportedOperationException(
"TRANSLUCENT translucency is not supported.");
}
}
this.opacity = opacity;
! WindowPeer peer = (WindowPeer)getPeer();
if (peer != null) {
peer.setOpacity(opacity);
}
}
}
--- 3642,3652 ----
throw new UnsupportedOperationException(
"TRANSLUCENT translucency is not supported.");
}
}
this.opacity = opacity;
! WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpacity(opacity);
}
}
}
*** 3724,3734 ****
* @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();
--- 3719,3728 ----
*** 3742,3752 ****
throw new UnsupportedOperationException(
"PERPIXEL_TRANSPARENT translucency is not supported.");
}
}
this.shape = (shape == null) ? null : new Path2D.Float(shape);
! WindowPeer peer = (WindowPeer)getPeer();
if (peer != null) {
peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
}
}
}
--- 3736,3746 ----
throw new UnsupportedOperationException(
"PERPIXEL_TRANSPARENT translucency is not supported.");
}
}
this.shape = (shape == null) ? null : new Path2D.Float(shape);
! WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
}
}
}
*** 3842,3852 ****
* @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;
--- 3836,3845 ----
*** 3870,3880 ****
}
setLayersOpaque(this, false);
} else if ((oldAlpha < 255) && (alpha == 255)) {
setLayersOpaque(this, true);
}
! WindowPeer peer = (WindowPeer)getPeer();
if (peer != null) {
peer.setOpaque(alpha == 255);
}
}
--- 3863,3873 ----
}
setLayersOpaque(this, false);
} else if ((oldAlpha < 255) && (alpha == 255)) {
setLayersOpaque(this, true);
}
! WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpaque(alpha == 255);
}
}
*** 3895,3908 ****
public boolean isOpaque() {
Color bg = getBackground();
return bg != null ? bg.getAlpha() == 255 : true;
}
- @SuppressWarnings("deprecation")
private void updateWindow() {
synchronized (getTreeLock()) {
! WindowPeer peer = (WindowPeer)getPeer();
if (peer != null) {
peer.updateWindow();
}
}
}
--- 3888,3900 ----
public boolean isOpaque() {
Color bg = getBackground();
return bg != null ? bg.getAlpha() == 255 : true;
}
private void updateWindow() {
synchronized (getTreeLock()) {
! WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.updateWindow();
}
}
}
*** 4086,4106 ****
{
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();
if (peer != null) {
peer.repositionSecurityWarning();
}
}
}
--- 4078,4097 ----
{
window.securityWarningWidth = width;
window.securityWarningHeight = height;
}
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.peer;
if (peer != null) {
peer.repositionSecurityWarning();
}
}
}