nyan Posted August 6, 2015 Share Posted August 6, 2015 i honestly cannot figure out how to check a checkbox using information i saved. the saved information is obviously true or false and true means checked and false means unchecked. if (line05 == "true") { // chckbxBoostAttack.doClick(); } else if (line05 == "false") { // chckbxBoostAttack.setEnabled(false); } right now this is all i have to give as an example and obviously the stuff commented doesn't work. any help is appreciated Quote Link to comment Share on other sites More sharing options...
Precise Posted August 6, 2015 Share Posted August 6, 2015 i honestly cannot figure out how to check a checkbox using information i saved. the saved information is obviously true or false and true means checked and false means unchecked. if (line05 == "true") { // chckbxBoostAttack.doClick(); } else if (line05 == "false") { // chckbxBoostAttack.setEnabled(false); } right now this is all i have to give as an example and obviously the stuff commented doesn't work. any help is appreciated add an actionlistener interface to the checkbox, then check if is selected and stuff 1 Quote Link to comment Share on other sites More sharing options...
Ericthecmh Posted August 6, 2015 Share Posted August 6, 2015 First of all, if you're doing string comparison you should be using .equals() Second, setEnabled controls whether the checkbox is active. You're looking for setSelected() And I would recommend doing something like boolean selected = Boolean.parseSelected(line05); checkbox.setSelected(selected); Cleaner code 2 Quote Link to comment Share on other sites More sharing options...
nyan Posted August 6, 2015 Author Share Posted August 6, 2015 First of all, if you're doing string comparison you should be using .equals() Second, setEnabled controls whether the checkbox is active. You're looking for setSelected() And I would recommend doing something like boolean selected = Boolean.parseSelected(line05); checkbox.setSelected(selected); Cleaner code wowwwww i completely overlooked setSelected() fml.. thanks though! and yeah i need to clean up my code a bit xD 1 Quote Link to comment Share on other sites More sharing options...