I've written a little class which opens the AWT print dialog from a JavaFX application.
I've tested this with JDK 1.8, so I don't know if it helps in your case.
Let me know if not, I would then investigate it with JDK 1.7.
[UPDATE] I also works it on JDK1.7 (With integrated JavaFx 2.2) on Mac OS X 10.9.3
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javax.swing.*;
/**
* Created by el on 27.05.14.
*/
public class PrintFx {
private static void initAndShowGUI() {
// This method is invoked on the EDT thread
JFrame frame = new JFrame("Swing and JavaFX");
final JFXPanel fxPanel = new JFXPanel();
frame.add(fxPanel);
frame.setSize(300, 200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Platform.runLater(new Runnable() {
@Override
public void run() {
initFX(fxPanel);
}
});
}
private static void initFX(JFXPanel fxPanel) {
// This method is invoked on the JavaFX thread
Scene scene = createScene();
fxPanel.setScene(scene);
}
private static Scene createScene() {
Group root = new Group();
Scene scene = new Scene(root, javafx.scene.paint.Color.ALICEBLUE);
Text text = new Text();
text.setX(40);
text.setY(100);
text.setFont(new Font(25));
text.setText("Welcome JavaFX!");
//A button with the specified text caption.
javafx.scene.control.Button button2 = new javafx.scene.control.Button("Open AWT print dialog");
button2.setOnAction(new EventHandler() {
@Override public void handle(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
System.out.println("now open dialog!");
java.awt.print.PrinterJob.getPrinterJob().printDialog();
}
});
}
});
root.getChildren().add(text);
root.getChildren().add(button2);
return (scene);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
initAndShowGUI();
}
});
}
}