1

First of all: no, I am not trying to embed JavaFX panel inside a JPanel.

I have an application in JavaFX but I need to use a JFrame. As far as I understand, they can coexist, but I am getting an error (Assertion Failure). I am getting: bug screenshot

Arrows shows:

  1. JFrame opens
  2. Java version == 1.7.0_71
  3. Error

The code to reproduce is:

public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            JFrame f = new JFrame("Test");
            f.setVisible(true);
        }});

    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    System.out.println("TEST");
    App.launch(args);
}

If I remove the Thread.sleep(), I get no error, but my JavaFX App does not start. If I keep the Thread.sleep(), I get the error. If I remove the invokeLater(), I get a HeadlessException

I cannot move to Java 8.

I would appreciate any help

Chocksmith
  • 1,188
  • 2
  • 12
  • 40
  • Unfortunately the post does not work for me. Option 1 does not work anymore; option 2 is not my application; option 3 is kind of crazy; option 4 not my application. – Chocksmith Nov 06 '14 at 23:52
  • System.setProperty("javafx.macosx.embedded", "true"); Did the trick! – Chocksmith Nov 06 '14 at 23:56

0 Answers0