Talking of Frame and friends, remember the problems I had with re-using Frame objects?
I tracked it down on the Java Bug site. It seems that when you unmap a window, the window manager (or X - I'm not sure which) sends it an event to confirm it's been unmapped. AWT's response to this is to think, "Ah, I've been iconified" and sets the flag appropriately.
The workaround is something like
public void show() {
setIconified(false); // workaround for Java bug 4509276
super.show();
}
/**
* This is a workaround for Java bug 4509276. On 1.3.1, frames that have
* been hidden are iconified next time they are shown. This fixes that.
*/
private void setIconified(boolean b) {
try {
Class c = Frame.class;
java.lang.reflect.Method m = c.getMethod("setState", new Class[] { int.class });
java.lang.reflect.Field i = c.getField(b?"ICONIFIED":"NORMAL");
m.invoke(this, new Object[] { new Integer(i.getInt(this)) });
} catch (Exception e) {
// Do nothing - the workaround isn't necessary on platforms that
// don't have the setState method.
}
}
If you have a JDC account, look at Java bugs
4509276 and
4099787 for more background.