java - Radio buttons and setSelected or something else? -


i have jframe form labels, text fields, combo box , button group has 2 radio buttons. in form have jtable filled data students (student id, name...), , when select row table, form opens , field need filled same values (eg. if peter peterson selected table, name should shown in text filed name on form, did txtfieldname.settext(student.getname), question how do radio button? need have yes/no column in table, when select table row value is, say, ''yes'' in order have yes radio button selected on form?

this depends. value being applied radio button part of underlying table data (ie student object)? if is, then, no, don't have have yes/no column, although might of use if trying make decisions on it. instead, extract student object.

i display yes/no value column if relevant decsion making process.

if value want use set radio button not part of student oect need make decisions.

personally, create wrapper object represented state of row, include student object , other relevant details might want. makes data self contained , makes accessing information easier.

if wasnt desirable, then, yes, need display value column , maintain separate value within table model.

this come down how you've implemented table model

updated feedback op

okay, so, student object hand. can boolean property student (that begin represented on screen radio buttons) , make choice...

trueradiobutton.setselected(booleanvalue); trueradiobutton.setselected(!booleanvalue); 

you make more simpler using jcheckbox instead...

checkbox.setselected(booleanvalue); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -