import java.awt.*;
import java.applet.*;

public class Valintalaatikko extends Applet
{
 Checkbox kaikki,omin1,omin2;

 public void init()
 {      
  add (kaikki = new Checkbox("Properties"));
  add (omin1 = new Checkbox("Property 1"));
  add (omin2 = new Checkbox("Property 2"));
 }

 public void paint(Graphics g)
 {
  kaikki.move(30,30);
  omin1.move(40,60);
  omin2.move(40,90);
 }

 public boolean action(Event evt, Object arg)
 {
  if (evt.target instanceof Checkbox)
  {
   // Set all check boxes
   if (((Checkbox)evt.target).getLabel()
 	.equals("Properties"))
   {
    omin1.setState(true);
    omin2.setState(true);
   }
  
   // Property 1
   if (((Checkbox)evt.target).getLabel()
    .equals("Property 1"))
   {
    if (kaikki.getState()==true)
     omin1.setState(true);
   }

   // Property 2
   if (((Checkbox)evt.target).getLabel()
		.equals("Property 2")) 
 	{
      if (kaikki.getState()==true)
       omin2.setState(true);
	 	}
  }
  return true;
 }
}

