How to make JFileChooser Display only a Folder that has some specific name Java

Is there any way that when the JFileChooser loads, it only display folder having name "Hello" only. Here is my code: It displays all folders and also file having extension .py and .java. I want to add that folder name restriction to it. FileNameExtensionFilter filter = new FileNameExtensionFilter( "Select Source Code To Analyze", "java","py"); jfc.setFileFilter(filter); //jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); JButton btnNewButton = new JButton("Select Erroneous File"); //SELECT File Button. btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (jfc.showOpenDialog(contentPane) != JFileChooser.APPROVE_OPTION) return; File f = jfc.getSelectedFile(); Current Program Output: ![enter image description here][1] I want the output to be somewhat like this:Only Display Folder Having name "Hello" and rest of files only. ![enter image description here][2] [1]: http://i.stack.imgur.com/1DqDF.png [2]: http://i.stack.imgur.com/Poxzh.png
See How do I restrict JFileChooser to a directory?

以上就是How to make JFileChooser Display only a Folder that has some specific name Java的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏