August 6, 201510 yr 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
August 6, 201510 yr 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
August 6, 201510 yr 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
August 6, 201510 yr Author 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
Create an account or sign in to comment