how do I make jfilechooser only accept .txt

前端 未结 3 1439
慢半拍i
慢半拍i 2020-12-14 06:43

I trying to save my contact in my table but filechosser always setit to all file. is there way I can set it to accept .txt only and make it default or the only option.

3条回答
  •  难免孤独
    2020-12-14 07:21

    You could do that by using FileFilter.

    Create a Filefilter with the necessary conditions. Set this file filter to the JFileChooser, and launch it.

提交回复
热议问题