I created JTable with JRadioButton in 4 columns of table.I have Implemented Renderer and Editor. My Requirment is something like this
Only one radioButton can be selected in each row. Which works if i put it in Group.
if i selected RadioButton at (0,1) then if i select RadioButton at
(1,1) then the previous row(0,1) is not selected. Can any one suggest me what to do?
Andrew Thompson - 31 Jan 2005 09:18 GMT
> ..Can any one suggest me what to do?
Post an SSCCE that displays the behaviour you describe.
<http://www.physci.org/codes/sscce.jsp>

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Kari Ikonen - 06 Feb 2005 11:41 GMT
> I created JTable with JRadioButton in 4 columns of table.I have
> Implemented Renderer and Editor. My Requirment is something like this
[quoted text clipped - 3 lines]
> at (1,1) then the previous row(0,1) is not selected. Can any one suggest
> me what to do?
Appearently you have tablemodel, having multiple rows, each row has radio
-selection (rendered in multiple cells)
You could have...
1) Table model
2) In table model "int[] mSelectedValues""indicating selected values for
each row
3) model.getValueAt(col, row) returns Boolean.TRUE for cells matching
selected values indicated by mSelectedValues, otherwise Boolean.FALSE
4) model.setValueAt(col, row, value) updates mSelectedValues (value is
Boolean)
5) Cell renderer, which renders Boolean as JRadioButton
6) Cell editor, which edits Boolean value as JRadioButton
(i.e. point is that Swing Components don't belong into model level)