简体   繁体   中英

How can I call JavaFXApplication from Java Swing/GUI? Is this even possible?

I used jframe in most of my GUIs but my groupmate made his from javafx. Is it possible to connect this two? We've tried calling javafxapplication like how jframe to jframe does, but it doesn't work. It gives me this error.

*Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: JavaFXApplication11.setVisible *

It says something about setVisible, but i don't understand it. :( Please help me out. I badly needed this for my project.

This is my Java Swing/GUI code

    private void GoToControllingActionPerformed(java.awt.event.ActionEvent evt) {                                                
    this.dispose();
    JavaFXApplication11 m = new JavaFXApplication11();
    m.setVisible(true);
  }           

It gives an error on the systemout when I click the JButton for going to the javafxapplication. This code added on the very last part of javafxapplication when I encountered an error Swing with setVisible.

        void setVisible(boolean b) {
    throw new UnsupportedOperationException("Not supported yet."); 
    }}

I asked my professor, and he gave me the exact answer i needed. I used

Application.launch(JavaFXApplication11.class);
this.dispose();

And it worked well. :) Now I need to go back from javafx to swing. And I used

Monitoring m = new Monitoring();
m.setVisible();
this.dispose();

Now my new problem is, this.dispose() doesn't work on javafx. Haha

I asked my professor, and he gave me the exact answer i needed. I used

Application.launch(JavaFXApplication11.class);
this.dispose();

And it worked well. :) Now I need to go back from javafx to swing. And I used

Stage stage = (Stage) btn.getScene().getWindow();
stage.close();
Monitoring m = new Monitoring();
m.setVisible(true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM