I'm trying to open a "FileOpenDialog"
I'm trying to open a "FileOpenDialog" but am getting two err msgs:
1) openFileButton cannot be resolved or is not a field RTTCPSortSimMain.java
2) RTTCPSortSimMain cannot be resolved to a variable
public class OpenFileButtonListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == this.openFileButton) { // 1
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(RTTCPSortSimMain); //2
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
// This is where a real application would open the file.
// log.append("Opening: " + file.getName() + "." + newline);
} else {
// log.append("Open command cancelled by user." + newline);
}
}
}
}
openFileButton is the name of the JButton
RTTCPSortSimMain is the name of the class this all lives in
What should I be using in these places instead?