diff options
Diffstat (limited to 'BKUCommonGUI/src')
-rw-r--r-- | BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java | 2 | ||||
-rw-r--r-- | BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java | 25 |
2 files changed, 20 insertions, 7 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java index 0eb35521..45f68a5d 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java @@ -406,7 +406,7 @@ public class SecureViewerDialog extends JDialog { @Override public void actionPerformed(ActionEvent e) { log.trace("[{}] display secure viewer save dialog.", Thread.currentThread().getName()); - SecureViewerSaveDialog.showSaveDialog(viewer, content, messages, null, null, closeButton.getFont().getSize()); + SecureViewerSaveDialog.showSaveDialog(SecureViewerDialog.this, content, messages, null, null, closeButton.getFont().getSize()); } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java index d121f3ca..20160fb5 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java @@ -27,6 +27,7 @@ package at.gv.egiz.bku.gui.viewer; import java.awt.Component; import java.awt.Container; import java.awt.Font; +import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedOutputStream; @@ -37,6 +38,7 @@ import java.io.InputStream; import java.text.MessageFormat; import java.util.ResourceBundle; +import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -63,7 +65,8 @@ public class SecureViewerSaveDialog { } } } - + + public static void showSaveDialog(final Component parent, final HashDataInput hashDataInput, final ResourceBundle messages, final ActionListener okListener, final String okCommand, final int fontSize) { @@ -81,7 +84,17 @@ public class SecureViewerSaveDialog { UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); - JFileChooser fileDialog = new JFileChooser(userHome); + @SuppressWarnings("serial") + JFileChooser fileDialog = new JFileChooser(userHome) { + @Override + protected JDialog createDialog(Component parent) throws HeadlessException { + JDialog dialog = super.createDialog(parent); + dialog.setModal(true); + dialog.setAlwaysOnTop(true); + return dialog; + } + }; + fileDialog.setMultiSelectionEnabled(false); fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); fileDialog.setFileHidingEnabled(true); @@ -97,10 +110,10 @@ public class SecureViewerSaveDialog { + MimeFilter.getExtension(mimeType); fileDialog.setSelectedFile(new File(userHome, filename)); - setFileChooserFont(fileDialog.getComponents(), new JLabel() - .getFont().deriveFont((float) fontSize)); - - // parent contentPane -> placed over applet + setFileChooserFont(fileDialog.getComponents(), + new JLabel().getFont().deriveFont((float) fontSize)); + + // parent SecureViewer -> placed over it switch (fileDialog.showSaveDialog(parent)) { case JFileChooser.APPROVE_OPTION: File file = fileDialog.getSelectedFile(); |