title: How do i know if a Jcheckbox is checked?in GUI
body: <p>can you tell me in details how do i know if a jcheckbox is checked or not? method isSelected  didn't work with me it gives me an exception while running</p>
  
  <pre><code>{
   Sandwich = new JButton("Tall");
           contentPane.add(Tall);
           Sandwitch.setBounds(350, 110, 90,40);   //in main
           Sandwitch.addActionListener(this);
  
  }
  .....
  
  public void actionPerformed(ActionEvent event) {
  JButton clickedButton = (JButton) event.getSource();
  
          String  buttonText = clickedButton.getText();
  ..........
  if(clickedButton.getText()=="Sandwitch"){
          if(Ketchup.getState()&amp;&amp;!Garlic.getState()){//
  
         itm=new Item(""+m+clickedButton.getText(),3.0);
          xyz.addItem(itm);
         textArea.append(" "+clickedButton.getText()+",");
          textArea.append(" "+itm.getPrice()+"\n");}
  
            else if(!Ketchup.isSelected()&amp;&amp;Garlic.isSelected()){//
  
  ....................
  }
  </code></pre>
  
  <p>it gives a very long exception while running</p>
  
  <p>can you please help me with this problem?</p>