title: Creating clear/reset button for my Checkboxes (java awt)
body: <pre><code>import java.io.*;
  import java.awt.*;
  import java.awt.event.*;
  public class quiz2 extends Frame implements ItemListener, ActionListener{
  Label label1 = new Label("Please Choose one");
  Checkbox sugar = new Checkbox ("Sugar");
  Checkbox candy = new Checkbox ("Candy");
  Button sum = new Button ("Clear");
  public quiz2 (){
      setSize (200,200);
      setLocation (100,100);
      setTitle ("Example");
      setLayout (null);
      setResizable (false);
      setVisible (true);
  
      label1.setBounds (20,20,120,20);
      add(label1);
  
      CheckboxGroup sweets = new CheckboxGroup();
  
      sugar.setBounds(20,40,120,20);
      sugar.addItemListener(this);
      add(sugar);
      candy.setBounds(20,60,120,20);
      candy.addItemListener(this);
      add(candy);
      sum.setBounds(20,80,50,30);
      sum.addActionListener(this);
      add(sum);}
  public void itemStateChanged (ItemEvent item){
      if (item.getSource()==sugar){
          if (item.getStateChange()==ItemEvent.SELECTED){
          setTitle ("You clicked sugar");}
          else if (item.getStateChange()==ItemEvent.DESELECTED){
          setTitle("You uncliked sugar");}}
      else if (item.getSource()==candy){
          if (item.getStateChange()==ItemEvent.SELECTED){
          setTitle ("You clicked candy");}
          else if (item.getStateChange()==ItemEvent.DESELECTED){
          setTitle("You uncliked candy");}}}
  public void actionPerformed (ActionEvent butt){
      setTitle("Example");
      candy.setSelected(false);
      sugar.setSelected(false);}}
  </code></pre>
  
  <p>The only solution I found is <code>checkbox.setSelected()</code> which wont work in my code, i'm using BlueJ (since our school use it).</p>
  
  <p>the main function of the <code>sum</code> button(forgot to change the name) is to <code>DESELECT</code> both <code>sugar</code> and <code>candy</code> whether they're clicked or not. </p>