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:
public void actionPerformed(ActionEvent event)
{
// deals with the GUI action events.
...
// filechooser load and save button clicks from menu
...
// Handle open button action.
if (event.getSource() == loadMenuItem)
{
int returnVal = gaitFc.showOpenDialog(GUI3D.this);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = gaitFc.getSelectedFile();
//This is where the application would open the file.
// blah blah blah blah..
} else
{
// blah blah blah blah..
}
}
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?