我希望找到一些使用javafx 8构建Mojo应用程序的示例。我使用swings和awt有一些Mojo的小应用程序。但我试图用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);
}
}
以下是该程序的输出。
我正在使用moj_compile program.java和moj_run程序运行上述程序。 我有moj_compile和moj_run批处理文件指向jdk8。