I am trying to get a JCheckBox to display on a line that is in the multiple select JList and still perform its functionality.
Right now if I add the JCheckBox as an element it just prints its toString format.
Help/ideas?
I am trying to get a JCheckBox to display on a line that is in the multiple select JList and still perform 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.