// be too large
Insets i = this.getParent().getInsets();
Dimension p = this.getParent().getSize();
p = new Dimension(Math.min(p.width-i.left-i.right, 700),
Math.min(p.height-i.top-i.bottom, 800));
new WindowGeometry(
getClass().getName() + ".geometry",
WindowGeometry.centerInWindow(
getParent(),
p
)
).applySafe(this);
} else if (isShowing()) { // Avoid IllegalComponentStateException like in #8775
new WindowGeometry(this).remember(getClass().getName() + ".geometry");
}
super.setVisible(visible);
}