I'm having problems trying to get the JFileChooser class to work with my program..
I want to make the event of clicking the 'load' option from the menu, make the open file dialog to be shown..
Here's my code for the actionevent:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public void actionPerformed(ActionEvent event) { ... ... if (event.getSource() == loadMenuItem) { int returnVal = gaitFc.showOpenDialog(GUI3D.this);
if (returnVal == JFileChooser.APPROVE_OPTION) { File file = gaitFc.getSelectedFile(); } else { } } |
It doesn't seem to like the "loadMenuItem" even tho thats the name of the menuItem I want it respond to..
Also concerning the "showOpenDialog", it says "GUI3D.this" in the type field is not an applicable arguement..
I don't kno how to fix these Issues and i'm running out of valuable project time, racking my brain over it..
Please help if possible?