public void mouseSingleClicked(Point p){
    //update current index
    curr=mygraph.findIndex(p);
    //insert location mode
    if(mode==INSERTLOC){
      int result=mygraph.addLoc(p);
      if(result==(mygraph.getCurr()-1)){
        curr=mygraph.getCurr()-1;
        changeNotify();
      }
    }
    //delete location mode
    if(mode==DELETELOC){
      mygraph.deleteLoc(p);
      changeNotify();
    }
    //delete path mode
    if(mode==DELETEPATH){
      mygraph.deletePath(p);
      changeNotify();
    }
    //Location Property Mode
    if(mode==PROPERTY){
      if(curr!=-1){ 
        JOptionPane mypane=new JOptionPane();
        String display="Name:"+getCurrName()+"\n(x,y)=("
          +getCurrPoint().getX()+","+getCurrPoint().getY()+")\nID="+getCurrID()
          +"\nNew location name:";
        String s = mypane.showInputDialog(display);
        if(s==null){
          return;
        }
        while(s.length()==0){
          display="Invalid new Name!\nName:"+getCurrName()+"\n(x,y)=("
            +getCurrPoint().getX()+","+getCurrPoint().getY()+")\nID="+getCurrID()
            +"\nNew location name:";
          s = mypane.showInputDialog(display);
          if(s==null){
            return;
          }
        }
        setCurrName(s);
      }
    }
  }