Results 1 to 2 of 2
Thread: CheckBox Jlist items
- 03-26-2009, 01:59 PM #1Member
- Join Date
- Mar 2009
- Rep Power
CheckBox Jlist items
I'm very new in developing Swing apps yet i've got a kind of complicated project to develop.
It would be a big help for my project to have a JList whose items where checkBoxes or any similar component with this behaviour. This component shouldn't have a limit of items since the items displayed depend of the selection in the previous Jlist. I cant seem to find any component like this anywhere.
- 03-26-2009, 08:39 PM #2
a JList whose items where checkBoxes
You can do this by wriing/providing a ListCellRenderer for you list. Both the JList and ListCellRenderer api comments have example code. Also the tutorial page for JList mentions this in the section Writing a Custom Cell Renderer.
If you want the JCheckBoxes to be editable by the user you would need to also provide an editor. I don't see any provisions for editors in the JList api. So I would try a JTable with a single column and no header. JTable provides support for both cell renderers and cell editors. The tutorial page for JTable use has discussion about these: How to Use Tables.
- By s34nn4 in forum Java AppletsReplies: 11Last Post: 04-12-2009, 06:21 AM
- By Pooja Deshpande in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-17-2009, 12:55 PM
- By F4iChick02 in forum New To JavaReplies: 4Last Post: 12-09-2008, 06:13 AM
- By Java Tip in forum javax.swingReplies: 0Last Post: 04-23-2008, 09:18 PM
- By Alan in forum AWT / SwingReplies: 3Last Post: 05-18-2007, 11:10 AM