java - The name of my checkbox can not be resolved -


i have problem checkbox. when try read state of name of can not resolved.

jcheckbox checkbox1 = new jcheckbox("test");     checkbox1.setbounds(6, 59, 121, 23);     frmtree.getcontentpane().add(checkbox1);  public void checkbox() {  if (checkbox1.isselected()) { sytem.out.println("selected");         }} 

//add checkbox1.setselected(true); 

change checkbox function code:

//try using boolean in condition //get selection state of checkbox boolean selected = checkbox1.isselected(); if (selected) {     system.out.println("selected."); } else {     system.out.println("not selected."); }  frmtree.getcontentpane().add(checkbox1); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -