Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

JRadiobutton rendered in JTable

Thread view: 
Raghu S - 31 Jan 2005 06:07 GMT
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)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.