using runtime with Java FX

5015
6
Jump to solution
04-11-2013 05:36 AM
JasonNisewonder
New Contributor
Can the runtime be used with Java FX?  If so, how do I wrap the map control within Java FX?
1 Solution

Accepted Solutions
EliseAcheson1
Occasional Contributor
Hi,

With what's available from JavaFX today you can embed a JavaFX component into a Swing application using a JFXPanel.
The JFXPanel is a Swing component that can hold JavaFX content, as described here:
http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm

As far as I can tell the reverse is not possible right now, i.e. embedding a Swing component into a JavaFX application, but it may become available in the future.

So, since the JMap is a Swing component, it can co-exist with one or more JFXPanels / JavaFX UI elements in this way.

~elise

View solution in original post

0 Kudos
6 Replies
EliseAcheson1
Occasional Contributor
Hi,

With what's available from JavaFX today you can embed a JavaFX component into a Swing application using a JFXPanel.
The JFXPanel is a Swing component that can hold JavaFX content, as described here:
http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm

As far as I can tell the reverse is not possible right now, i.e. embedding a Swing component into a JavaFX application, but it may become available in the future.

So, since the JMap is a Swing component, it can co-exist with one or more JFXPanels / JavaFX UI elements in this way.

~elise
0 Kudos
EliseAcheson1
Occasional Contributor
I should add to this that we're interested in gauging the level of interest in JavaFX and that it would be good to hear from those using this technology or wanting to use it and the sorts of applications being worked on or planned!

~elise
0 Kudos
MiriRevivo
Occasional Contributor
Hi Elise,

I'm working for Esri's Israeli distributor, and we have a client that is interested in working with the ArcGIS Runtime upon JavaFX.
I'd be happy to elaborate more via email. Mine is mirir@systematics.co.il

Thanks,
Miri.
0 Kudos
EricBader
Occasional Contributor III

With the upcoming release of 10.2.4 of the Java SDK for Runtime, we are introducing a JavaFX Map component (Beta). This release should be available in early October! Stay tuned!

0 Kudos
RobertHewlett
Occasional Contributor

Is there an elegant way to add the FXMap node to Scene Builder so that one can drag and drop the FXMap onto the UI e.g. existing BorderPane.

With the Swing Map and Window-builder Pro I was able to get this to work.

Right now Scene Builder complains a lot about the run time JAR having too many non-node classes

Rob

0 Kudos
KwasiAsante1
New Contributor III

JavaFX introduces the SwingNode class; this class generally enables developers to add swing content in JavaFX applications. You can find the class in the JavaFX API at javafx.embed.swing. This makes it very easy to embed Esri Java Runtime SDK content such as JMap (a swing class)  in JavaFX application. Please find the below code snippet.

package com.esri.support.javafxeg;

import javafx.application.Application;

import javafx.embed.swing.SwingNode;

import javafx.scene.Scene;

import javafx.scene.layout.StackPane;

import javafx.stage.Stage;

import com.esri.map.JMap;

import com.esri.map.MapOptions;

import com.esri.map.MapOptions.MapType;

public class JavaRuntimeJavaFXExample extends Application {

 

    @Override

    public void start(Stage primaryStage) {

    

         final SwingNode swingNode = new SwingNode();

     

         MapOptions mapOptions = new MapOptions(MapType.TOPO);

         JMap map = new JMap(mapOptions);

         swingNode.setContent(map);

         StackPane pane = new StackPane();

         pane.getChildren().add(swingNode);

     

        primaryStage.setTitle("Esri Java Runtime and JavaFX: a match made in Heaven!");

        primaryStage.setScene(new Scene(pane, 600, 350));

        primaryStage.show();

    }

 

    public static void main(String[] args) {

        launch(args);

    }

 

}