DavidKroukamp
Practically a Master Poster
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
I don't want to discourage you, but if you are a beginner you will probably find custom renderers and custom editors pretty challenging. Do you really have to use check boxes? Perhaps you can just use an ordinary multiple-selection JList for now?
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
ya i used jlist for single selection. also tried it for multiple selection but got some error while i was using the method "getSelectedValues()" of jlist in the "OK" JButton. so i thought to use CheckBoxList. i guessed that will be easy :p.. if you help me, how to get multiple selected values in from JList to use them in my program. i will do so.
see here for use of JLists: http://docs.oracle.com/javase/tutorial/uiswing/components/list.html
DavidKroukamp
Practically a Master Poster
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
Easiest way with multiple selections is JList's getSelectedIndices method
public int[] getSelectedIndices()
Returns an array of all of the selected indices, in increasing order, or an empty array if nothing is selected
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
it too hard to implementing JList & Render with some of dirty hack, use JTable with one Column,
1) JTable with JCheckBox is represented with Boolean value only
2) no required any code for Renderer/Editor, because JTable knows Boolean value
3) JTable must be editable for Editor
4) everything here
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224