Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File Dialog opening twice?

58 views
Skip to first unread message

Barkster

unread,
Jun 3, 2006, 11:53:00 AM6/3/06
to
I've beggining with java and was trying 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());
}
}
}

0 new messages