diff --git a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java index e149265bc..c3c593663 100644 --- a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -291,9 +291,7 @@ public class AdvancedSettingsDialog extends AppDialog { fc.setFileFilter(allSupportedFilter); fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - int returnVal = fc.showOpenDialog(f); + int returnVal = fc.showOpenDialog(Main.getDefaultMessagesComponent()); if (returnVal == JFileChooser.APPROVE_OPTION) { return Helper.fixDialogFile(fc.getSelectedFile()).getAbsolutePath(); } else { diff --git a/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java b/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java index e6ca1e590..4fcecb11c 100644 --- a/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java @@ -390,9 +390,7 @@ public class FontEmbedDialog extends AppDialog { }; fc.setFileFilter(ttfFilter); fc.setAcceptAllFileFilterUsed(true); - JFrame f = new JFrame(); - View.setWindowIcon(f); - int returnVal = fc.showOpenDialog(f); + int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); File selfile = Helper.fixDialogFile(fc.getSelectedFile()); diff --git a/src/com/jpexs/decompiler/flash/gui/FontPanel.java b/src/com/jpexs/decompiler/flash/gui/FontPanel.java index 80c94196f..8a25161e3 100644 --- a/src/com/jpexs/decompiler/flash/gui/FontPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FontPanel.java @@ -751,9 +751,7 @@ public class FontPanel extends JPanel { fc.setFileFilter(ttfFilter); fc.setAcceptAllFileFilterUsed(false); - JFrame fr = new JFrame(); - View.setWindowIcon(fr); - int returnVal = fc.showOpenDialog(fr); + int returnVal = fc.showOpenDialog(Main.getDefaultMessagesComponent()); if (returnVal == JFileChooser.APPROVE_OPTION) { Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); File selfile = Helper.fixDialogFile(fc.getSelectedFile()); diff --git a/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java b/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java index 23482b3e4..ba5645e68 100644 --- a/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java @@ -262,9 +262,7 @@ public class LoadFromCacheFrame extends AppFrame { }); } fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showSaveDialog(LoadFromCacheFrame.this) == JFileChooser.APPROVE_OPTION) { File file = Helper.fixDialogFile(fc.getSelectedFile()); try { if (selected.size() == 1) { diff --git a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java index 15ae15e46..222904de3 100644 --- a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java @@ -398,9 +398,7 @@ public class LoadFromMemoryFrame extends AppFrame { }); } fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showSaveDialog(LoadFromMemoryFrame.this) == JFileChooser.APPROVE_OPTION) { File file = Helper.fixDialogFile(fc.getSelectedFile()); try { if (selected.length == 1) { diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index d69563c8b..7d4439c52 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -914,9 +914,7 @@ public class Main { }; fc.addChoosableFileFilter(gfxFilter); fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - int returnVal = fc.showOpenDialog(f); + int returnVal = fc.showOpenDialog(getDefaultMessagesComponent()); if (returnVal == JFileChooser.APPROVE_OPTION) { Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); File selFile = Helper.fixDialogFile(fc.getSelectedFile()); @@ -1534,9 +1532,7 @@ public class Main { } final String extension = ext; fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showSaveDialog(getDefaultMessagesComponent()) == JFileChooser.APPROVE_OPTION) { File file = Helper.fixDialogFile(fc.getSelectedFile()); FileFilter selFilter = fc.getFileFilter(); try { @@ -1706,9 +1702,7 @@ public class Main { fc.addChoosableFileFilter(binaryFilter); fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - int returnVal = fc.showOpenDialog(f); + int returnVal = fc.showOpenDialog(getDefaultMessagesComponent()); if (returnVal == JFileChooser.APPROVE_OPTION) { Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); File[] selFiles = fc.getSelectedFiles(); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 7c52d2790..1664cee7f 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2349,9 +2349,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } fc.setAcceptAllFileFilterUsed(false); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath()); File sf = Helper.fixDialogFile(fc.getSelectedFile()); @@ -3267,9 +3265,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se first = false; } - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File result = fc.getSelectedFile(); Configuration.lastOpenDir.set(Helper.fixDialogFile(result).getParentFile().getAbsolutePath()); return result; diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java index ee9f3a9c5..541e67b7b 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java @@ -395,9 +395,7 @@ public class DumpTree extends JTree { JFileChooser fc = new JFileChooser(); String selDir = Configuration.lastOpenDir.get(); fc.setCurrentDirectory(new File(selDir)); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File sf = Helper.fixDialogFile(fc.getSelectedFile()); try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(sf))) { byte[] data = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().originalUncompressedData; diff --git a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java index e40206ec5..daec9d562 100644 --- a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -414,9 +414,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen }; fc.setFileFilter(swfFilter); fc.setAcceptAllFileFilterUsed(true); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File file = Helper.fixDialogFile(fc.getSelectedFile()); try { Files.copy(new File(r.targetFile).toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); @@ -485,15 +483,13 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen }; fc.setFileFilter(swfFilter); fc.setAcceptAllFileFilterUsed(true); - JFrame f = new JFrame(); - View.setWindowIcon(f); - if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) { + if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File file = Helper.fixDialogFile(fc.getSelectedFile()); try { Files.copy(file.toPath(), new File(r.targetFile).toPath(), StandardCopyOption.REPLACE_EXISTING); tableModel.fireTableCellUpdated(sel[0], 1/*size*/); } catch (IOException ex) { - ViewMessages.showMessageDialog(f, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + ViewMessages.showMessageDialog(this, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); } } }