B
Barkster
I'm begining with java and was trying Borlan jbuilder. When I am
trying to
get the results of a file dialog box when I click the browse
button(button6) I get the dialog box and when I select the file or hit
cancel the dialog reopens again. When I select the second time I get
the results I'm looking for. Any ideas as to why this is happening?
Thanks
public void jButton6_actionPerformed(ActionEvent e) {
JFileChooser choose = new JFileChooser();
choose.addChoosableFileFilter(new ImageFilter());
choose.setAcceptAllFileFilterUsed(false);
choose.setVisible(true);
int returnVal = choose.showDialog(this, "Attach Image");
if (choose.getSelectedFile() != null) {
if (returnVal == JFileChooser.APPROVE_OPTION) {
jTextField6.setText(choose.getSelectedFile().getAbsolutePath());
}
}
trying to
get the results of a file dialog box when I click the browse
button(button6) I get the dialog box and when I select the file or hit
cancel the dialog reopens again. When I select the second time I get
the results I'm looking for. Any ideas as to why this is happening?
Thanks
public void jButton6_actionPerformed(ActionEvent e) {
JFileChooser choose = new JFileChooser();
choose.addChoosableFileFilter(new ImageFilter());
choose.setAcceptAllFileFilterUsed(false);
choose.setVisible(true);
int returnVal = choose.showDialog(this, "Attach Image");
if (choose.getSelectedFile() != null) {
if (returnVal == JFileChooser.APPROVE_OPTION) {
jTextField6.setText(choose.getSelectedFile().getAbsolutePath());
}
}