I need to use a JFileChooser in my simple Quiz game to load and save 'Question /Answer' sets , when the FileChooser window opens i want it to be in the current working directory, i want this to work in Linux,Windows and OSX, i am doubtful if the "user.dir" mehtod works in all platforms , Can someone help out , Code Below...
For loading
public class openMenuItemListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
nextButton.setEnabled(true);
JFileChooser fileChooser=new JFileChooser();
fileChooser.showOpenDialog(frame);
loadFile(fileChooser.getSelectedFile());
}
}
For Saving:
class saveMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JFileChooser fileSave=new JFileChooser();
fileSave.showSaveDialog(frame);
saveFile(fileSave.getSelectedFile());
}
}//class ends