|
JtextField
hi
i have a problem while dealing with JtextFields.
actually i have created a browse button by using the JFileChooser.
now when the user selects the file, and clicks open button in browse window,
the text in the filed is supposed to get updated to the filename of selected file.
But i cannot figure out how to do this.
ActionListener aListener;
aListener = new ActionListener(){
public void actionPerformed(ActionEvent e){
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(browse);
File selectedFile = fc.getSelectedFile();
filename = fc.getName(selectedFile);
filepath.setText(filename);
// filepath is the JTextField which shud get updated. and this does not do the trick
}
};
thanks
Last edited by kashifu : 06-25-2008 at 09:16 PM.
|