diff --git a/src/main/java/featurecat/lizzie/Lizzie.java b/src/main/java/featurecat/lizzie/Lizzie.java index 516c42e7..5eddad80 100644 --- a/src/main/java/featurecat/lizzie/Lizzie.java +++ b/src/main/java/featurecat/lizzie/Lizzie.java @@ -94,7 +94,7 @@ public static void shutdown() { if (config.config.getJSONObject("ui").getBoolean("confirm-exit")) { int ret = JOptionPane.showConfirmDialog( - null, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION); + frame, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION); if (ret == JOptionPane.OK_OPTION) { frame.saveFile(); } diff --git a/src/main/java/featurecat/lizzie/analysis/YaZenGtp.java b/src/main/java/featurecat/lizzie/analysis/YaZenGtp.java index c7f14a05..b03e0aab 100644 --- a/src/main/java/featurecat/lizzie/analysis/YaZenGtp.java +++ b/src/main/java/featurecat/lizzie/analysis/YaZenGtp.java @@ -53,7 +53,7 @@ public void startEngine(String engineCommand, int index) { process = processBuilder.start(); } catch (IOException e) { // TODO Auto-generated catch block - Utils.showMessageDialog(null, resourceBundle.getString("YaZenGtp.nofile")); + Utils.showMessageDialog(Lizzie.frame, resourceBundle.getString("YaZenGtp.nofile")); return; } initializeStreams(); @@ -99,7 +99,7 @@ private void parseLine(String line) { } if (line.startsWith("Throw")) { - Utils.showMessageDialog(null, resourceBundle.getString("YaZenGtp.nofile")); + Utils.showMessageDialog(Lizzie.frame, resourceBundle.getString("YaZenGtp.nofile")); shutdown(); } if (line.startsWith(" ")) { diff --git a/src/main/java/featurecat/lizzie/gui/BoardPane.java b/src/main/java/featurecat/lizzie/gui/BoardPane.java index 282145aa..cdbfdb04 100644 --- a/src/main/java/featurecat/lizzie/gui/BoardPane.java +++ b/src/main/java/featurecat/lizzie/gui/BoardPane.java @@ -531,14 +531,14 @@ public void replayBranch(boolean generateGif) { chooser.setAcceptAllFileFilterUsed(false); chooser.setFileFilter(filter); chooser.setMultiSelectionEnabled(false); - int result = chooser.showSaveDialog(null); + int result = chooser.showSaveDialog(Lizzie.frame); if (result == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); filesystem.put("last-image-folder", file.getParent()); if (file.exists()) { int ret = JOptionPane.showConfirmDialog( - null, + Lizzie.frame, resourceBundle.getString("LizzieFrame.prompt.fileExists"), "Warning", JOptionPane.OK_CANCEL_OPTION); @@ -620,7 +620,7 @@ public void saveImage() { chooser.addChoosableFileFilter(filter3); chooser.addChoosableFileFilter(filter4); chooser.setMultiSelectionEnabled(false); - int result = chooser.showSaveDialog(null); + int result = chooser.showSaveDialog(Lizzie.frame); if (result == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); filesystem.put("last-image-folder", file.getParent()); @@ -636,7 +636,7 @@ public void saveImage() { if (file.exists()) { int ret = JOptionPane.showConfirmDialog( - null, + Lizzie.frame, resourceBundle.getString("LizzieFrame.prompt.fileExists"), "Warning", JOptionPane.OK_CANCEL_OPTION); diff --git a/src/main/java/featurecat/lizzie/gui/LizzieDialog.java b/src/main/java/featurecat/lizzie/gui/LizzieDialog.java index 51abd2e5..502e5417 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieDialog.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieDialog.java @@ -1,5 +1,6 @@ package featurecat.lizzie.gui; +import featurecat.lizzie.Lizzie; import java.awt.Dialog; import java.awt.Frame; import java.awt.Window; @@ -12,7 +13,7 @@ public class LizzieDialog extends JDialog { private String osName; public LizzieDialog() { - super(); + super(Lizzie.frame); // Set owner for dual monitors. (#885) setOsName(); } diff --git a/src/main/java/featurecat/lizzie/gui/MainFrame.java b/src/main/java/featurecat/lizzie/gui/MainFrame.java index 45058e35..256acceb 100644 --- a/src/main/java/featurecat/lizzie/gui/MainFrame.java +++ b/src/main/java/featurecat/lizzie/gui/MainFrame.java @@ -228,7 +228,7 @@ public void editComment() { textArea.setSize(textArea.getPreferredSize().width, textArea.getPreferredSize().height); int ret = JOptionPane.showConfirmDialog( - null, new JScrollPane(textArea), "Comment", JOptionPane.OK_CANCEL_OPTION); + this, new JScrollPane(textArea), "Comment", JOptionPane.OK_CANCEL_OPTION); if (ret == JOptionPane.OK_OPTION) { Lizzie.board.getHistory().getData().comment = textArea.getText(); refresh(); @@ -396,7 +396,7 @@ public void saveFile() { JFileChooser chooser = new JFileChooser(filesystem.getString("last-folder")); chooser.setFileFilter(filter); chooser.setMultiSelectionEnabled(false); - int result = chooser.showSaveDialog(null); + int result = chooser.showSaveDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!(file.getPath().endsWith(".sgf") || file.getPath().endsWith(".SGF"))) { @@ -405,7 +405,7 @@ public void saveFile() { if (file.exists()) { int ret = JOptionPane.showConfirmDialog( - null, + this, resourceBundle.getString("LizzieFrame.prompt.sgfExists"), "Warning", JOptionPane.OK_CANCEL_OPTION); @@ -420,7 +420,7 @@ public void saveFile() { } } catch (IOException err) { JOptionPane.showConfirmDialog( - null, + this, resourceBundle.getString("LizzieFrame.prompt.failedTosaveFile"), "Error", JOptionPane.ERROR); @@ -461,7 +461,7 @@ public void loadFile(File file) { } } catch (IOException err) { JOptionPane.showConfirmDialog( - null, + this, resourceBundle.getString("LizzieFrame.prompt.failedToOpenFile"), "Error", JOptionPane.ERROR); diff --git a/src/main/java/featurecat/lizzie/rules/Board.java b/src/main/java/featurecat/lizzie/rules/Board.java index 603c950d..f08fbc7e 100644 --- a/src/main/java/featurecat/lizzie/rules/Board.java +++ b/src/main/java/featurecat/lizzie/rules/Board.java @@ -1075,7 +1075,7 @@ public void deleteMove() { // Will delete more than one move, ask for confirmation int ret = JOptionPane.showConfirmDialog( - null, + Lizzie.frame, "This will delete all moves and branches after this move", "Delete", JOptionPane.OK_CANCEL_OPTION); @@ -1395,12 +1395,12 @@ public void toggleAnalysis() { analysisMode = false; } else { if (!getNextMove().isPresent()) { - JOptionPane.showMessageDialog(null, "No next move."); + JOptionPane.showMessageDialog(Lizzie.frame, "No next move."); return; } String answer = JOptionPane.showInputDialog( - "# playouts for analysis (e.g. 100 (fast) or 50000 (slow)): "); + Lizzie.frame, "# playouts for analysis (e.g. 100 (fast) or 50000 (slow)): "); try { playoutsAnalysis = Integer.parseInt(answer); } catch (NumberFormatException err) {