Hide sketchbook window before creating a new one

Copy pasted from rebuildExamplesFrame()
This commit is contained in:
Jakub Valtar
2017-01-21 00:52:49 +01:00
parent c5d9b713b8
commit 78ace8cdde

View File

@@ -691,11 +691,18 @@ public abstract class Mode {
/** Sketchbook has changed, update it on next viewing. */
public void rebuildSketchbookFrame() {
boolean wasVisible =
(sketchbookFrame == null) ? false : sketchbookFrame.isVisible();
sketchbookFrame = null; // Force a rebuild
if (wasVisible) {
showSketchbookFrame();
if (sketchbookFrame != null) {
boolean visible = sketchbookFrame.isVisible();
Rectangle bounds = null;
if (visible) {
bounds = sketchbookFrame.getBounds();
sketchbookFrame.setVisible(false);
}
sketchbookFrame = null;
if (visible) {
showSketchbookFrame();
sketchbookFrame.setBounds(bounds);
}
}
}