fixed an window reopening bug after closing the main window while simulation is running.

This commit is contained in:
hneemann 2020-07-20 16:00:06 +02:00
parent 98114e0eb7
commit 50ef3dcd0f
2 changed files with 14 additions and 2 deletions

View File

@ -273,7 +273,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
library.removeListener(circuitComponent);
if (treeModel != null)
library.removeListener(treeModel);
windowPosManager.closeAll();
windowPosManager.shutdown();
}
});

View File

@ -17,6 +17,7 @@ import java.util.Map;
public class WindowPosManager {
private final Map<String, Window> windows;
private final JFrame main;
private boolean shutdown;
/**
* Creates a new instance
@ -52,10 +53,21 @@ public class WindowPosManager {
window.setSize(oldWindow.getSize());
oldWindow.dispose();
}
windows.put(id, window);
if (shutdown)
window.dispose();
else
windows.put(id, window);
return window;
}
/**
* Closes all registered windows and avoids a reopening them.
*/
public void shutdown() {
shutdown = true;
closeAll();
}
/**
* Closes all registered windows
*/