像JTreeTable这样的表,包含可编辑的组件,如ComboBox,TextArea,CheckBox as Rows [英] A Table like JTreeTable with editable components like ComboBox, TextArea, CheckBox as Rows
问题描述
有吗java中的任何自定义插件(如带有可编辑java组件的JTreeTable),如上图所示。
Is there any custom plugin(like JTreeTable with editable java components) in java, like in the above image.
我知道这可以通过扩展JTreeTable或JXTreeTable类或使用TreeCellEditor来完成等等......但是,我需要一个非常精确的结构,如上图所示,请指导我并提前致谢。
I know this can be done by Extending JTreeTable or JXTreeTable Class or using TreeCellEditor etcetera... But, I need a quite exact structure like shown in the above image, Please guide me and Thanks in advance.
推荐答案
大纲
,此处和 ,使用相同的渲染器和编辑器模式为 JTable
。例如,要获取一列复选框, RowModel
getColumnClass()
的实现应返回 Boolean.class
并且您的 isCellEditable()
的实现应返回 true
code> Logical2 列。我没有尝试过,但 DefaultCellEditor
,用 JCheckBox
实例化,应该适用于组合列。
Outline
, seen here and here, uses the same renderer and editor schema as JTable
. For example, to get a column of checkboxes, your RowModel
implementation of getColumnClass()
should return Boolean.class
and your implementation of isCellEditable()
should return true
for the Logical2
column. I haven't tried it, but DefaultCellEditor
, instantiated with a JCheckBox
, should work for the combo column.
这篇关于像JTreeTable这样的表,包含可编辑的组件,如ComboBox,TextArea,CheckBox as Rows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!