How to make output directory selection panel?

前端 未结 4 748
我寻月下人不归
我寻月下人不归 2021-01-22 15:36

Hi I am trying to make one pane that shows something like windows explorer in my computer. when user complete it\'s operations, and after that when he want to save edited image

4条回答
  •  伪装坚强ぢ
    2021-01-22 16:17

    You could have a look at JFileChooser. You can use this object to open a SaveDialog and get a save path on the local harddisk. Then eventually use an ObjectOutputStream to write a file.

    Sample code:

        JFileChooser c = new JFileChooser();
        c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        // Demonstrate "Save" dialog:
        int rVal = c.showSaveDialog(fb);
        if (rVal == JFileChooser.APPROVE_OPTION) {
            System.out.println(c.getSelectedFile().toString());
        }
    

提交回复
热议问题