src/share/classes/java/awt/Window.java
Print this page
*** 314,323 ****
--- 314,328 ----
* @see #setShape(Shape)
* @since 1.7
*/
private Shape shape = null;
+ /**
+ * Indicates if the window has been packed via pack().
+ */
+ private boolean isPacked = false;
+
private static final String base = "win";
private static int nameCounter = 0;
/*
* JDK 1.1 serialVersionUID
*** 762,772 ****
Dimension newSize = getPreferredSize();
if (peer != null) {
setClientSize(newSize.width, newSize.height);
}
! if(beforeFirstShow) {
isPacked = true;
}
validate();
}
--- 767,777 ----
Dimension newSize = getPreferredSize();
if (peer != null) {
setClientSize(newSize.width, newSize.height);
}
! if (beforeFirstShow) {
isPacked = true;
}
validate();
}
*** 864,875 ****
--- 869,885 ----
}
if (height < minSize.height) {
height = minSize.height;
}
}
+ synchronized (getTreeLock()) {
+ if (this.width != width || this.height != height) {
+ isPacked = false;
+ }
super.reshape(x, y, width, height);
}
+ }
void setClientSize(int w, int h) {
synchronized (getTreeLock()) {
setBoundsOp(ComponentPeer.SET_CLIENT_SIZE);
setBounds(x, y, w, h);
*** 1012,1022 ****
--- 1022,1035 ----
* @see #dispose
* @deprecated As of JDK version 1.5, replaced by
* {@link #setVisible(boolean)}.
*/
@Deprecated
+ @Override
public void hide() {
+ isPacked = false;
+
synchronized(ownedWindowList) {
for (int i = 0; i < ownedWindowList.size(); i++) {
Window child = ownedWindowList.elementAt(i).get();
if ((child != null) && child.visible) {
child.hide();
*** 3795,3804 ****
--- 3808,3821 ----
public Point2D calculateSecurityWarningPosition(Window window,
double x, double y, double w, double h)
{
return window.calculateSecurityWarningPosition(x, y, w, h);
}
+
+ public boolean isPacked(Window window) {
+ return window.isPacked;
+ }
}); // WindowAccessor
} // static
// a window doesn't need to be updated in the Z-order.
@Override