diff --git a/src/main/java/net/vhati/modmanager/ui/ModPatchDialog.java b/src/main/java/net/vhati/modmanager/ui/ModPatchDialog.java index 57c0e99..76e0e91 100644 --- a/src/main/java/net/vhati/modmanager/ui/ModPatchDialog.java +++ b/src/main/java/net/vhati/modmanager/ui/ModPatchDialog.java @@ -169,6 +169,15 @@ public class ModPatchDialog extends JDialog implements ActionListener, ModPatchO patchingSucceeded = success; continueBtn.setEnabled( true ); + + if ( !ModPatchDialog.this.isShowing() ) { + // The window's not visible, no continueBtn to click. + ModPatchDialog.this.dispose(); + + if ( patchingSucceeded && successTask != null ) { + successTask.run(); + } + } } }); } @@ -180,4 +189,13 @@ public class ModPatchDialog extends JDialog implements ActionListener, ModPatchO public void setSuccessTask( Runnable r ) { successTask = r; } + + /** + * Shows or hides this component depending on the value of parameter b. + * + * If patching has already completed, this method will do nothing. + */ + public void setVisible( boolean b ) { + if ( !done ) super.setVisible( b ); + } }