protected void onGuiEvent(GuiEvent ev) {
// ----------------------------------------

	  command = ev.getType();

	  if (command == QUIT) {
	     try {
		    home.kill();
		    for (int i = 0; i < container.length; i++) container[i].kill();
	     }
	     catch (Exception e) { e.printStackTrace(); }
	     myGui.setVisible(false);
	     myGui.dispose();
		 doDelete();
		 System.exit(0);
      }
	  if (command == NEW_AGENT) {

	     jade.wrapper.AgentController a = null;
         try {
            Object[] args = new Object[2];
            args[0] = getAID();
            String name = "Agent"+agentCnt++;
            a = home.createNewAgent(name, MobileAuctioneerAgent.class.getName(), args);
	        a.start();
	        agents.add(name);
	        myGui.updateList(agents);
	     }
         catch (Exception ex) {
		    System.out.println("Problem creating new agent");
	     }
         return;
	  }
      String agentName = (String)ev.getParameter(0);
      AID aid = new AID(agentName, AID.ISLOCALNAME);

	  if (command == MOVE_AGENT) {

         String destName = (String)ev.getParameter(1);
         Location dest = (Location)locations.get(destName);
         MobileAgentDescription mad = new MobileAgentDescription();
         mad.setName(aid);
         mad.setDestination(dest);
         MoveAction ma = new MoveAction();
         ma.setMobileAgentDescription(mad);
         sendRequest(new Action(aid, ma));
	  }
      else if (command == CLONE_AGENT) {

         String destName = (String)ev.getParameter(1);
         Location dest = (Location)locations.get(destName);
         MobileAgentDescription mad = new MobileAgentDescription();
         mad.setName(aid);
         mad.setDestination(dest);
         String newName = "Clone-"+agentName;
         CloneAction ca = new CloneAction();
         ca.setNewName(newName);
         ca.setMobileAgentDescription(mad);
         sendRequest(new Action(aid, ca));
         agents.add(newName);
         myGui.updateList(agents);
	  }
      else if (command == KILL_AGENT) {

         KillAgent ka = new KillAgent();
         ka.setAgent(aid);
         sendRequest(new Action(aid, ka));
	     agents.remove(agentName);
		 myGui.updateList(agents);
	  }
   }