Blocks :
|
|
Blocks :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
Graphics environment is still forced to be headless under Mac. Sample (just to illustrate problem): import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.SwingUtilities; import com.sun.javafx.application.PlatformImpl; import javafx.scene.Scene; import javafx.embed.swing.JFXPanel; import javafx.scene.control.Button; import javafx.scene.layout.VBox; public class Main { private JFXPanel javafxPanel; private Scene scene; public Main() { JFrame frame = new JFrame("Swing interop"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); javafxPanel = new JFXPanel(); javafxPanel.setPreferredSize(new Dimension(550, 400)); frame.getContentPane().add(javafxPanel, BorderLayout.CENTER); createScene(); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private void createScene() { PlatformImpl.startup(new Runnable() { public void run() { VBox root = new VBox(); scene = new Scene(root); root.getChildren().add(new Button("FXButton")); javafxPanel.setScene(scene); } }); } public static void main(String[] args) { Button btn = new Button(""); SwingUtilities.invokeLater(new Runnable() { public void run() { new Main(); } }); } }
|