public MapEditor() {
    //set frame properties
    setTitle("Map Editor");
    setSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    setBackground(Color.gray);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// Close when closed.For reals.
    
    //set the content of the frame
    try{
      File file=new File("purdue-map.jpg");
      Image image = (Image)ImageIO.read(file);
      _map = new MapScene(image);
    }catch(Exception e){
      System.out.println(e.getMessage());
    }
    
    _zoomPane = new ZoomPane(_map);
    _textarea=new JTextArea("Welcome to Map Editor!", 20, 20);
    _textarea.setEditable(false);
    _text=new JScrollPane();
    _text.getViewport().add(_textarea);
    
    //add components to frame
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(_text,BorderLayout.WEST);
    getContentPane().add(_zoomPane,BorderLayout.CENTER);
    getContentPane().add(_zoomPane.getJSlider(),BorderLayout.SOUTH);
    
    //add actionlistener to the menuitems
    save.addActionListener(this);
    saveas.addActionListener(this);
    openfile.addActionListener(this);
    newfile.addActionListener(this);
    fileinfo.addActionListener(this);
    insertloc.addActionListener(this);
    deleteloc.addActionListener(this);
    insertpath.addActionListener(this);
    deletepath.addActionListener(this);
    location.addActionListener(this);
    find.addActionListener(this);
    directions.addActionListener(this);
    readme.addActionListener(this);
    
    //add menuitems to menus
    file.add(newfile);
    file.add(openfile);
    file.add(save);
    file.add(saveas);
    file.add(fileinfo);
    mode.add(insertloc);
    mode.add(deleteloc);
    mode.add(insertpath);
    mode.add(deletepath);
    mode.add(location);
    function.add(find);
    function.add(directions);
    help.add(readme);
    editor.add(file);
    editor.add(mode);
    editor.add(function);
    editor.add(help);
    
    //set menu bar of the frame
    setJMenuBar(editor);
    
    //MouseAdapter & MouseMotionAdapter for _zoomPane
    MouseAdapter listener = new MouseAdapter() {
      public void mousePressed(MouseEvent e) {
        Point point = _zoomPane.toViewCoordinates(e.getPoint());
        if(point.getX()>_map.getWidth() || point.getY()>_map.getHeight()){
          return;
        }
        _map.mousePressed(point);
      }
      public void mouseClicked(MouseEvent e){
        //System.out.println("mouseclicked");
        int times=e.getClickCount();
        Point point = _zoomPane.toViewCoordinates(e.getPoint());
        if(point.getX()>_map.getWidth() || point.getY()>_map.getHeight()){
          return;
        }
        if(times==1){
          _map.mouseSingleClicked(point);
        }
        if(times==2){
          _map.mouseDoubleClicked(point);
        }
      }     
    };
    
    MouseMotionAdapter motionListener = new MouseMotionAdapter() {
      public void mouseDragged(MouseEvent e) {
        Point point = _zoomPane.toViewCoordinates(e.getPoint());
        if(point.getX()>_map.getWidth() || point.getY()>_map.getHeight()){
          return;
        }
        _map.mouseDragged(point);
      }
    };
    
    //add MouseAdapter & MouseMotionAdapter to _zoomPane
    _zoomPane.getZoomPanel().addMouseListener(listener);
    _zoomPane.getZoomPanel().addMouseMotionListener(motionListener);
  }