Set default saving extension with JFileChooser

后端 未结 5 1087
借酒劲吻你
借酒劲吻你 2021-02-07 10:12

I\'m trying to save a file using JFileChooser. However, I seem to be having some trouble with it. Here\'s my code:

    if (e.getSource() == saveMenu         


        
5条回答
  •  我在风中等你
    2021-02-07 10:17

    You should try this. I did this and it worked.

    FileOutputStream fileOut =  new FileOutputStream(file1+".xml");
    hwb.write(fileOut);
    fileOut.close();
    System.out.println("\n Your file has been generated!");
    JOptionPane.showMessageDialog(this,"File Created.");
    

提交回复
热议问题