Hi all,
Been a while since I posted on here, and now I am at a point where I find myself stuck yet again.
For my assignment at uni, we have been asked to create an address book application. It is going well, and it's nearly completed, however one part of the project, which is purely my preference, eludes me. I'm not asking for help on any part of the assignment which will gain me marks, just to be clear. I can upload the spec if anyone would like evidence of that. (/disclosure)
Part of the application is importing and exporting from a custom file type and the vcard format. This works fine. The custom file type holds multiple contacts, with only 4 lines per contact. Because it holds multiple contacts, a new window opens which asks the user to select the contacts they wish to be exported to the file. This contains a JList, where the user can select the contacts and export the file, no problem.
What I have been trying to do, is create a custom cell renderer which will allow the use of a check box in the JList. I nearly got this working by looking here (http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html#renderer) and here (http://www.jroller.com/santhosh/entry/jlist%5Fwith%5Fcheckboxes), however no luck. The first link explains how to create the custom cell renderer, but not check boxs, and the second explains how to do check boxs. I can get check boxs to display, however then that is ALL that displays.
In the latter example, the box's themselves must be clicked in order for the members of the list to be selected. What I would like to be able to do, is to allow the user to click on either the list items or the check box's to select the item.
In the version of just check boxs that I got working, the selection worked, however ctrl still had to be held down for multiple items to be selected. Is there any way to make it so ctrl is not needed for multiple selection of items? I know you can read modifiers on a click, but no idea if you can apply them to a click of a specified object.
Your thoughts, comments, suggestions, links and exact answers are all very welcome! :)