how do i put browse option in gui??
hi,im doing an assignment on rsa cryptography.my project needs to be able to select a txt file from a location on a computer for encryption or decryption. To do this i want to design a gui that enables the user to select a txt file from a location, but i dont know how to add the browse option to my gui,does anybody know?I just want a simple gui with a browse option and 2 other buttons(encrypt and decrypt)!does anybody have any ideas?please reply.
Carl.
[465 byte] By [
ledwidc2] at [2007-11-11 8:04:24]

# 1 Re: how do i put browse option in gui??
For selecting files, you should use a JFileChooser:
JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
jfc.setMultiSelectionEnabled(false);
int status = jfc.showOpenDialog(this); // 'this' must refer to a jframe
if(status == JFileChooser.APPROVE_OPTION){
File f = jfc.getSelectedFile();
}
Kind regards,
Noel
noelob at 2007-11-11 22:36:30 >

# 2 Re: how do i put browse option in gui??
hey,thanx noel....that was a great help!!!if i need any more help ill give you a shout if thats ok....