allow only a single instance of the download dialog.

master
Lodici 2013-12-15 13:10:53 +00:00
parent 26d6bfdcc2
commit 89ef62c7b9
2 changed files with 9 additions and 1 deletions

View File

@ -61,6 +61,7 @@ public class DownloadImagesDialog extends JFrame implements Runnable,ActionListe
this.setLayout(springLayout);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(frame);
final Container contentPane = this.getContentPane();

View File

@ -1,5 +1,6 @@
package magic.ui.screen;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
@ -14,6 +15,8 @@ import net.miginfocom.swing.MigLayout;
@SuppressWarnings("serial")
public class SettingsMenuScreen extends AbstractScreen {
private static DownloadImagesDialog downloadDialog;
public SettingsMenuScreen(final MagicFrame frame0) {
super(getScreenContent(frame0), frame0);
}
@ -35,7 +38,11 @@ public class SettingsMenuScreen extends AbstractScreen {
menu.addMenuItem("Download images", new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
new DownloadImagesDialog(frame0);
if (downloadDialog == null || !downloadDialog.isDisplayable()) {
downloadDialog = new DownloadImagesDialog(frame0);
}
downloadDialog.setState(Frame.NORMAL);
downloadDialog.setVisible(true);
}
});
menu.addMenuItem("More themes online...", new AbstractAction() {