I want to created a Tree
with multi-columns. I found this tutorial here (German) and this answer (English). I want to add checkboxes in one column, but I have no idea how to do it. When I return a checkbox to JTreeTable
, something show in execute is checkbox detail not checkbox object. How can I get something like this, pictured below?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
As shown in Taking the New Swing Tree Table for a Spin, cited here, your implementation of
RowModel
must return the correct type fromgetColumnClass()
and the correct value fromgetValueFor()
. Values of typeBoolean.class
will be rendered with aJCheckBox
. The following implementations produce the image cited:You need to return
true
in your implementation ofisCellEditable()
for the desired column(s) and update thenode
in your implementation ofsetValueFor()
accordingly. When the cell editor concludes, your implementation ofsetValueFor()
will be called, so verify that it updates the same value that will later be returned bygetValueFor()
. Optionally, you'll want to implement theTreeModel
methods that manage theTreeModelListener
list by using the scheme prescribed in anEventListenerList
API; theDefaultTreeModel
source code is a good example.