|
From: Pelle B. <pe...@us...> - 2004-04-13 18:28:05
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27810/src/java/org/neuclear/commons/crypto/passphraseagents/swing Modified Files: SwingAgent.java Log Message: added open dialog to swing agent and interactive agent Index: SwingAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing/SwingAgent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SwingAgent.java 13 Apr 2004 17:32:05 -0000 1.5 --- SwingAgent.java 13 Apr 2004 18:14:02 -0000 1.6 *************** *** 17,20 **** --- 17,23 ---- $Id$ $Log$ + Revision 1.6 2004/04/13 18:14:02 pelle + added open dialog to swing agent and interactive agent + Revision 1.5 2004/04/13 17:32:05 pelle Now has save dialog *************** *** 54,57 **** --- 57,63 ---- simple = new SimpleDialog(); queue = new RunnableQueue(); + fc = new JFileChooser(); + fc.setFileFilter(new JKSFilter()); + } *************** *** 59,62 **** --- 65,69 ---- private final KeyStoreDialog ksd; private final RunnableQueue queue; + private final JFileChooser fc; public static void main(final String[] args) { *************** *** 119,130 **** public File getSaveToFileName(String title, String def) throws UserCancellationException { File file = new File(def); ! JFileChooser fc = new JFileChooser(file.getParentFile()); ! fc.setFileFilter(new JKSFilter()); fc.setSelectedFile(file); fc.setDialogTitle(title); - // Show open dialog; this method does not return until the dialog is closed - fc.showSaveDialog(ksd.getDialog()); - return fc.getSelectedFile(); } --- 126,145 ---- public File getSaveToFileName(String title, String def) throws UserCancellationException { + prepFileChooser(def, title); + fc.showSaveDialog(ksd.getDialog()); + return fc.getSelectedFile(); + } + + public File getOpenFileName(String title, String def) throws UserCancellationException { + prepFileChooser(def, title); + fc.showOpenDialog(ksd.getDialog()); + return fc.getSelectedFile(); + } + + private void prepFileChooser(String def, String title) { File file = new File(def); ! fc.setCurrentDirectory(file.getParentFile()); fc.setSelectedFile(file); fc.setDialogTitle(title); } |