开发者

JCheckBox to display and perform functionality in JList

开发者 https://www.devze.com 2023-01-05 11:50 出处:网络
I am trying to get a JCheckBox to display on a line that is in the multiple select JList and still 开发者_如何学Cperform its functionality.

I am trying to get a JCheckBox to display on a line that is in the multiple select JList and still 开发者_如何学Cperform its functionality.

Right now if I add the JCheckBox as an element it just prints its toString format.

Help/ideas?


If you haven't already done so, you'll need to write a custom ListCellRenderer, as discussed in Writing a Custom Cell Renderer.

Addendum: Because you'll also need an editor to handle the checkbox state, you may find it easier to use a one column JTable, as discussed in How to Use Tables. Note that a data column having the type Boolean will be automatically rendered with a check box.

0

精彩评论

暂无评论...
验证码 换一张
取 消