Tag: javafx webengine

Google地图和JavaFX:点击JavaFXbutton后在地图上显示标记

我一直在试图在地图上显示一个标记,当我点击我的JavaFX应用程序的button。 所以会发生什么是当我点击那个button,我写在一个JSON文件的位置,这个文件将被加载到包含地图的HTML文件。 问题是,当我在浏览器中打开html页面时,它完美的工作,但在JavaFX的web视图中没有任何反应,我不知道为什么! 这是html文件: <!DOCTYPE html> <html> <head> <title>Simple Map</title> <meta name="viewport" content="initial-scale=1.0"> <meta charset="utf-8"> <style> /* Always set the map height explicitly to define the size of the div * element that contains the map. */ /*#map { height: 100%; }*/ #map{width:100%;height:100%;margin:auto;} /* Optional: Makes the sample page fill the window. */ html, body […]

如何在java中多次调用launch()

如何在java中多次调用launch()我被赋予一个exception,如“主错误:java.lang.IllegalStateException:应用程序启动不能多次调用” 我已经在我的Java应用程序中创buildrest清单,当请求来到它调用javafx和完成webview操作之后打开webview使用Platform.exit()方法closuresjavafx窗口。 当第二个请求来得到这个错误如何reslove这个错误。 JavaFx应用程序代码: public class AppWebview extends Application { public static Stage stage; @Override public void start(Stage _stage) throws Exception { stage = _stage; StackPane root = new StackPane(); WebView view = new WebView(); WebEngine engine = view.getEngine(); engine.load(PaymentServerRestAPI.BROWSER_URL); root.getChildren().add(view); engine.setJavaScriptEnabled(true); Scene scene = new Scene(root, 800, 600); stage.setScene(scene); engine.setOnResized(new EventHandler<WebEvent<Rectangle2D>>() { public void […]