swing - Boolean in Java condition -


i have issue, have method action performed. if checkbox ticked additional fields become available. if not ticked greyed out. want add method. have first condition , need add second condition it. pasted code snippet below, need put if else, errors. advise appreciated.

public void actionperformed(actionevent e) {     boolean sel = _usessl.isselected();     _port.setusessl(sel);     _keystore.setenabled(sel);     _passphrase.setenabled(sel);     l_keystore.setenabled(sel);     l_passphrase.setenabled(sel); } 

above working method, need add in if _truststore.isselected(); execute else.

how can add second boolean condition method?

you can use have used 'sel' in "actionperfomed" method this:

  public void actionperformed(actionevent e) {     boolean sel = _usessl.isselected();     _port.setusessl(sel);     _keystore.setenabled(sel);     _passphrase.setenabled(sel);     l_keystore.setenabled(sel);     l_passphrase.setenabled(sel);     boolean trus = _truststore.isselected();     //use trus other things } 

Comments