mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 15:58:41 -04:00
fixed an window reopening bug after closing the main window while simulation is running.
This commit is contained in:
parent
98114e0eb7
commit
50ef3dcd0f
@ -273,7 +273,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
library.removeListener(circuitComponent);
|
library.removeListener(circuitComponent);
|
||||||
if (treeModel != null)
|
if (treeModel != null)
|
||||||
library.removeListener(treeModel);
|
library.removeListener(treeModel);
|
||||||
windowPosManager.closeAll();
|
windowPosManager.shutdown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import java.util.Map;
|
|||||||
public class WindowPosManager {
|
public class WindowPosManager {
|
||||||
private final Map<String, Window> windows;
|
private final Map<String, Window> windows;
|
||||||
private final JFrame main;
|
private final JFrame main;
|
||||||
|
private boolean shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
@ -52,10 +53,21 @@ public class WindowPosManager {
|
|||||||
window.setSize(oldWindow.getSize());
|
window.setSize(oldWindow.getSize());
|
||||||
oldWindow.dispose();
|
oldWindow.dispose();
|
||||||
}
|
}
|
||||||
windows.put(id, window);
|
if (shutdown)
|
||||||
|
window.dispose();
|
||||||
|
else
|
||||||
|
windows.put(id, window);
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes all registered windows and avoids a reopening them.
|
||||||
|
*/
|
||||||
|
public void shutdown() {
|
||||||
|
shutdown = true;
|
||||||
|
closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes all registered windows
|
* Closes all registered windows
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user