本文介绍了jFileChooser作为表格中的单元格编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个jFileChooser作为表的单个单元格的编辑器(不是该表的整个列,因为将使用各种其他编辑器,如comboBox等)。有任何建议或示例代码吗? (我已经在这里查看了这些示例

I would like to set up a jFileChooser as an editor of a single cell of a table (not entire columns of that table as various other editors such as comboBox etc will be used). Any suggestion or sample code please? (I have already looked into these samples here How to use tables by Oracle

推荐答案

是正确的。请参阅此使用未修饰的 JButton 来唤起实际的编辑器。而不是 PopupDialog ,你将使用 JFileChooser

The tutorial approach is correct. See this example that use an undecorated JButton to evoke the actual editor. Instead of PopupDialog, you'll use JFileChooser.

附录:要将编辑器单独应用于任何单元格,请覆盖 prepareEditor( )表示所需的行和列,如所述。

Addendum: To apply the editor to any cell(s) individually, override prepareEditor() for the desired row and column, as discussed here.

这篇关于jFileChooser作为表格中的单元格编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 23:24