有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

使用JavaFX8构建java MOJO

我希望找到一些使用JavaFX8构建Mojo应用程序的示例。我有一些使用秋千和awt的小魔咒应用。但是我试图用Javafx取代swing和awt的用法。 我对如何将Mojo与Javafx集成感到困惑。任何关于提供一些示例的帮助都应该足以让我进一步研究我的应用程序

下面是我使用swing和awt的MOJO程序

import javax.swing.JFrame;
import java.awt.event.*;
import java.awt.*;

import com.esri.mo2.ui.bean.Map;
import com.esri.mo2.ui.tb.ZoomPanToolBar;
import com.esri.mo2.ui.bean.Layer;
import com.esri.mo2.ui.bean.Toc;

public class QuickStart2 extends JFrame {
  Map map = new Map();
  Layer layer = new Layer();
  Layer layer2 = new Layer();
  Toc toc = new Toc();
  String s1 = "C:\\ESRI\\MOJ20\\Samples\\Data\\USA\\States.shp";
  String s2 = "C:\\ESRI\\MOJ20\\Samples\\Data\\USA\\capitals.shp";
  ZoomPanToolBar zptb = new ZoomPanToolBar();
  public QuickStart2() {
    //add a title to the window
    super("Quick Start");
    //set the size
    this.setSize(400, 300);
    //add the map to the frame
    zptb.setMap(map);
    toc.setMap(map);
    getContentPane().add(map, BorderLayout.CENTER);
    getContentPane().add(zptb,BorderLayout.NORTH);
    //add a shape file to the map
    addShapefileToMap(layer,s1);
    addShapefileToMap(layer2,s2);
    //add a Toc

    getContentPane().add(toc, BorderLayout.WEST);
  }
    private void addShapefileToMap(Layer layer,String s) {
    String datapath = s; //"C:\\ESRI\\MOJ20\\Samples\\Data\\USA\\States.shp";
    layer.setDataset("0;"+datapath);
    map.add(layer);
  }

  public static void main(String[] args) {
    QuickStart2 qstart = new QuickStart2();
    qstart.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.out.println("Thanks, Quick Start exits");
            System.exit(0);
        }
    });
    qstart.setVisible(true);
  }
}

下面是程序的输出。 enter image description here

我使用moj_编译程序运行上述程序。java和moj_运行程序。 我将moj_编译和moj_运行批处理文件指向jdk8


共 (0) 个答案