JFileChooser to open multiple txt files

前端 未结 3 1784
醉梦人生
醉梦人生 2020-12-17 09:51

How can I use JFileChooser to open two text files and after I selected these files, I want to compare them, show on the screen etc. Is this possible?

3条回答
  •  情书的邮戳
    2020-12-17 10:34

    In my case I solved it declaring frame as an initialized local variable set to null:

    JFileChooser chooser = new JFileChooser();
    chooser.setMultiSelectionEnabled(true);
    
    Component frame = null;
    
    chooser.showOpenDialog(frame);
    File[] files = chooser.getSelectedFiles();
    

提交回复
热议问题