English 中文(简体)
Java JFile 与Filiter合著的 Cho光显示光电灯没有显示公正的目录。
原标题:Java JFileChooser with Filter to supposedly display ONLY directories fail to show just directories

(前言!) 请让我知道,你是否需要更多的信息。 底部抽样法。

www.un.org/spanish/ecosoc 问题 I m 试图解决:

I m试图通过使用javax.swing.filechooser,使JFileChooser拒绝只展示目录(而不是档案)。 文件 在接受(File file)方法中具有这种效力的抗辩:return file.isDirectory(。 然而,至少就我的玉米而言,这似乎并不阻止档案与目录一起展示(这确实防止在没有使用固定的FileSelectionMode()方法的情况下选择档案)。

<<><><><><>>>>><><><>>>>>

我失踪了吗? 如果不是的话,以前是否有任何人遇到过这种情况?

www.un.org/spanish/ecosoc 我的理解/假设:

  1. The magic should happen when you pass in a javax.swing.filechooser.FileFilter object into the JFileChooser s setFileFilter() method.
  2. Seems like my JFileChooser with setFileFilter() is behaving like its using of setSelectionMode( JFileChooser.DIRECTORIES_ONLY );

<><><>>>>

import java.io.File;
import javax.swing.filechooser.FileFilter;

// inside a method that s adding this to a JPanel

_fileChooser = new JFileChooser( "." );
_fileChooser.setControlButtonsAreShown( false );
_fileChooser.setFileFilter( new FolderFilter() );
// _fileChooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );
_panelMidLeft.add( _fileChooser );

// an inner class, defined somewhere else in the class

private class FolderFilter extends javax.swing.filechooser.FileFilter {
  @Override
  public boolean accept( File file ) {
    return file.isDirectory();
  }

  @Override
  public String getDescription() {
    return "We only take directories";
  }
}

感谢!

* A/63/150。

最佳回答
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签