[Java-gnome-developer] FileSelection Dialog
Brought to you by:
afcowie
From: Andrew <ac...@on...> - 2003-12-06 00:19:10
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hoping someone can help me with what should be quite straight forward! I have a the following code: final FileSelection dialog = new FileSelection("Select File"); dialog.setModal(true); dialog.addListener(new DialogListener() { public boolean dialogEvent(DialogEvent event) { if (event.isOfType(DialogEvent.Type.RESPONSE)) { String filename = dialog.getFilename(); } ((Dialog) event.getSource()).destroy(); return true; } }); dialog.show(); So what happens is the file selection dialog opens. I select my file (say /home/work/build.xml) and click oK, the filename variable correctly contains the selected file. Now the problem is, if I select this file, but click cancel. I still end up with text in my filename variable, when I want it to contain nothing, because I didn't really choose a file. Anyone clear this up for me? Thanks, - -- [A n d r e w] - ------|------ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQE/0SCb2AKtqeH2FeQRArcwAJ9yD/Jr73aHHbb7D7FYKtRckH7FYgCaAm0P rdDC16FIrRVEt/6+H/V9aX0= =e/et -----END PGP SIGNATURE----- |