[vtkusers] VTK and JavaFX?

Mark Edgar Hammons II mark.hammons at inaf.cnrs-gif.fr
Tue Aug 5 12:28:26 EDT 2014


Has anyone tested vtk and javafx compatibility yet? I'm using 5.10, and nothing but the 
regular java swing components are rendered when I embed this class[1] into a javafx scene 
using SwingNode: 

> import javafx.application.Application;
> import javafx.embed.swing.SwingNode;
> import javafx.scene.Scene;
> import javafx.scene.layout.StackPane;
> import javafx.stage.Stage;
> 
> import javax.swing.*;
> 
> public class SwingFx extends Application {
> 
>     @Override
>     public void start(Stage stage) {
>     
>         final SwingNode swingNode = new SwingNode();
>         createAndSetSwingContent(swingNode);
>         
>         StackPane pane = new StackPane();
>         pane.getChildren().add(swingNode);
>         
>         stage.setScene(new Scene(pane, 100, 50));
>         stage.show();     
>     }
>     
>     private void createAndSetSwingContent(final SwingNode swingNode) {     
>         SwingUtilities.invokeLater(new Runnable() {        
>             @Override
>             public void run() {            
>                 swingNode.setContent(new SimpleVTK());             
>             } 
>         });     
>     }
>     
>     public static void main(String[] args) {  
>         launch(args);
>     }
> }

I'm testing on my side with openJFX so I can't be sure that this doesn't work with javafx 
proper just yet. I'll try with the regular oracle jvm later today/tomorrow. Has there been any 
efforts to make vtkPanel and vtkCanvas work with javafx yet though?

--------
[1] https://github.com/jeffbaumes/jeffbaumes-vtk/blob/master/Wrapping/Java/SimpleVTK.java
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140805/49a9851b/attachment.html>


More information about the vtkusers mailing list