JFileChooser vs JDialog vs FileDialog

倖福魔咒の 提交于 2019-12-05 19:50:36

What is the rest of your application written in? If you used AWT you should use FileDialog. If you used Swing you should use JFileChooser. Both classes meet all of your requirements. (A JDialog is simply an empty window, you can only use it to open files if you add a Component to it which allows you to, and JFileChooser already does this for you.)

Saving and loading has to be written with your own methods, both JFileChooser and FileDialog can only be used to select file(s).

Both FileDialog and JFileChooser support file filters during selection.

FileDialog's default UI is the native OS'. JFileChooser's (in fact, your entire applicatin's) UI can be set to the native OS' with UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!