sneakyimp
06-07-2006, 11:01 PM
I have managed to get my java application (my first one!) to open a file browse dialog like this:
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {
// show browse dialog
browseDlg = new BrowseUI();
browseDlg.setVisible(true);
}
the file browse dialog is a class I wrote that extends JFrame.
NOW I want the cancel button on my file browse dialog to cause the file browse JFrame to go away. How do I do that? I have two points of confusion:
1) the cancel button on the file chooser is inseparable from the file chooser object...how do i determine if that's been pressed from the actionPerformed method of the file chooser object? please note that i am not using showSaveDialog()...I am instead using NetBeans GUI editor to put the fileChooser dialog on a jframe along with a pane to preview images.
2) how do i "undefine" the file chooser object once I have determined that the button pressed is in fact the file chooser object?
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {
// show browse dialog
browseDlg = new BrowseUI();
browseDlg.setVisible(true);
}
the file browse dialog is a class I wrote that extends JFrame.
NOW I want the cancel button on my file browse dialog to cause the file browse JFrame to go away. How do I do that? I have two points of confusion:
1) the cancel button on the file chooser is inseparable from the file chooser object...how do i determine if that's been pressed from the actionPerformed method of the file chooser object? please note that i am not using showSaveDialog()...I am instead using NetBeans GUI editor to put the fileChooser dialog on a jframe along with a pane to preview images.
2) how do i "undefine" the file chooser object once I have determined that the button pressed is in fact the file chooser object?