Package chunmap.example

Source Code of chunmap.example.BaseAppletMap

/**
* Copyright (c) 2009-2011, chunquedong(YangJiandong)
*
* This file is part of ChunMap project
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
*
* History:
*     2010-05-05  Jed Young  Creation
*/
package chunmap.example;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet;

import chunmap.app.MapCtrl;
import chunmap.app.MapPanel;
import chunmap.app.tools.SelectTool;

public abstract class BaseAppletMap extends JApplet{
  private static final long serialVersionUID = -2489173152186500327L;

  protected MapCtrl map;
  protected SelectTool tool;
 
  @Override
  public void init(){
    super.init();
   
    this.setSize(850, 700);
    this.setLayout(new FlowLayout());
 
    //get map panel
    final MapPanel ui = initMap();
    this.add(ui);
    addButton(this,ui.getMap());
  }

  private MapPanel initMap() {
    MapPanel ui = new MapPanel(800, 510);
    ui.setPreferredSize(new Dimension(800, 510));
    map = ui.getMap();

    addLayer(map);

    map.fullView();
    map.refreshMap();
    return ui;
  }
 
  protected void addButton(Container frame,final MapCtrl map){
    UiUtil.addCommonButton(frame,map);
   
    UiUtil.addButton(frame,map,"选择",new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {
        tool=new SelectTool();
        map.setCurrentPlug(tool);
      }
    });
  }

  protected abstract void addLayer(MapCtrl map);
}
TOP

Related Classes of chunmap.example.BaseAppletMap

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.