title: void is an invalid type for the variable paint
body: <p>void is an invalid type for the variable paint is the error i am getting by the way my program is when you click the checkbox the textfield shows the checkbox name in textfield thank you!
  Using if statement*..........</p>
  
  <pre><code>package irt;
  
  import java.applet.Applet;
  import java.awt.Checkbox;
  import java.awt.Graphics;
  import java.awt.Label;
  import java.awt.TextField;
  import java.awt.event.ItemEvent;
  import java.awt.event.ItemListener;
  
  public class chkBx extends Applet implements ItemListener
  {
      TextField t1;
      Checkbox c1,c2,c3;
      Label l1;
      public void init()
      {
          l1=new Label("data");
          add(l1);
          t1=new TextField(15);
          add(t1);
          c1=new Checkbox("nashik");
          add(c1);
          c2=new Checkbox("pune");
          add(c2);
          c3=new Checkbox("mumbai");
          add(c3);
          c1.addItemListener(this);
          c2.addItemListener(this);
          c3.addItemListener(this);
      }
  
      public void itemStateChanged(ItemEvent e) 
      {
          String msg="state";
  
                      public void paint(Graphics g)
  
                          {
  
                              t1.setText(msg);    
                              g.drawString(msg,50,100);
                              msg="city"+c1.getState();
                          }
  
  
      }
  }
  </code></pre>