JavaFX

Swing-Anwendung mit FX-Panel

import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
 
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
 
public class FxPanelDemo extends JFrame {
 
   public FxPanelDemo() {
      super("FxPanelDemo");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setSize(400, 300);
      setLocationRelativeTo(null);
 
      init();
   }
 
   private void init() {
      final JFXPanel fxPanel = new JFXPanel();
      getContentPane().add(fxPanel);
      Platform.runLater(new Runnable() {
         @Override
         public void run() {
            Group root = new Group();
            Scene scene = new Scene(root);
            fxPanel.setScene(scene);
         }
      });
   }
 
   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         @Override
         public void run() {
            FxPanelDemo frame = new FxPanelDemo();
            frame.setVisible(true);
         }
      });
   }
}

Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007