- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
有没有办法在 JFileChooser 中仅列出根驱动器?我的意思是我需要防止在 JFilechooser 中列出光盘驱动器/可移动驱动器。我正在使用 java6。
提前致谢
或者知道所选文件来自 CD/DVD 驱动器就可以了...可以以独立于平台的方式吗?
谢谢
最佳答案
By default, a file chooser displays all of the files and directories that it detects, except for hidden files. A program can apply one or more file filters to a file chooser so that the chooser shows only some files. The file chooser calls the filter's accept method for each file to determine whether it should be displayed. A file filter accepts or rejects a file based on criteria such as file type, size, ownership, and so on. Filters affect the list of files displayed by the file chooser. The user can enter the name of any file even if it is not displayed.
关于java - 如何在 JFileChooser 中仅列出硬盘驱动器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19969387/
我正在对 JFileChooser UI 进行一些定制。我正在寻找 JFilechooser 的渐变背景。我所能做的只是一个自定义的 JFilechooser,但我不确定如何将 gardientbac
我想将 JComboBox 添加到 JFileChooser 中。 我尝试扩展 JFileChooser 并手动添加组合框。我实际上设法做到了这一点,但是从 JFileChooser 对话框中删除了文
我试图在文件选择器对话框中打开一个文件,但是,当我打开一个文件或只是关闭对话框时。对话框再次出现,我必须关闭它两次。这是我的代码,不知道有什么问题 private void jMenuItem1Act
如何强制我的 JFileChooser 具有垂直滚动的单列而不是水平滚动的多列? 最佳答案 如果我理解您的要求,您也许可以使用 JList#setLayoutOrientation(JList.VER
所以我得到了这段非常基本的代码,它使用文件名过滤器初始化 JFileChooser。目前您应该只能看到 .txt 文件,稍后我想使用自定义文件名。 JFileChooser dialog = new
我想在我的程序中使用 JFileChooser 来选择目录并处理它。但是,无论我为文件选择器使用什么 FileFilter,选择目录时 Open 按钮都是锁定的。下面是我的 FileFilter 的代
我创建了一个文件,然后需要将其另存为 .docx 扩展名,但我的代码将其另存为 .txt,如何更改扩展名? JFileChooser saveFile = new JFileChooser()
我使用 JFileChooser 让用户保存文件。但我不希望用户选择一个名称来保存文件。不得启用名称文本字段。 我阅读了文档,但没有找到这样的方法或属性。 最佳答案 评论中的Squiddie给你推荐了
我想更改“查看菜单”菜单下的“列表”按钮文本,但我找不到方法。这是文件选择器窗口的图片。 JFileChooser dialog window 我尝试了这些,但没有成功: UIManager.put(
我有以下 Java 8 Swing 代码: JButton button = new JButton("Browse"); button.addActionListener(new ActionLis
继我之前的两篇文章之后here另一个one here ,以下代码打开常规文件浏览器而不是扩展的文件浏览器: public class GuiHandler extends javax.swing.JF
我开发了一个程序,用于计算文件中的行数,如下所示 Scanner in=new Scanner(System.in); System.out.println("Enter the Drive
我的程序允许您保存已制作的图像。我只需要将其另存为 png 即可。 我目前有: ... File file = fc.getSelectedFile(); try{ ImageIO.write(res
我想自定义我的 JFileChooser,这样我不想在底部说“文件夹名称”,而是将其设置为“图片名称”,并且在文本字段中我不希望它根据我所在的位置进行更改我点击,我希望它一直保持空白。无论如何我可以做
在我的 java 应用程序中,有一个浏览按钮。单击浏览按钮时,弹出文件选择器以选择文件。当我通过单击右上角的十字标记而不选择文件来关闭文件选择器时,它会给出一个异常,提示“线程“AWT-EventQu
阅读 documentation 后我没有看到使用 showDialog() 时使对话框模式化的好方法。 . 是否有一种好方法可以使 JFileChooser 实例成为文档模式而不是应用程序模式? 最
我正在使用 JFileChooser,我想让它在单击 fileItem1 时显示文件选择对话框。这是我的 SwingMenu 类。 问题:我在 showFileChooser 方法中遗漏/做错了什么?
我一直在尝试使用 JFileChooser,但遇到程序无法停止运行的问题,这是我的代码: import java.io.File; import javax.swing.JFileChooser; i
如何在屏幕中央显示 JFile-Chooser。使用 ToolKit 的常规方法不起作用。 最佳答案 查看 Javadoc 中的方法 JFileChooser#showDialog(Component
我对 Swing 和 AWT 还很陌生。虽然我有Java开发经验。我正在尝试使用 JFileChooser 读取文件并获取主方法中的内容。所有 Swing 和 AWT 的大师请帮助我确定我缺少什么。
我是一名优秀的程序员,十分优秀!