Swing integrated with Javafx is possible?

Asked

Viewed 148 times

0

I wanted to know if it is possible to call a Javafx screen through a Swing screen button. The code of the Javafx screen I want to call is the following:

public class EditorHTML extends Application {

    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void start(Stage stage) {
        // Crie o HTMLEditor
        HTMLEditor htmlEditor = new HTMLEditor();
        // Definir a altura do HTMLEditor
        htmlEditor.setPrefHeight(300);
        // Definir a largura do HTMLEditor
        htmlEditor.setPrefWidth(600);

        // Crie a cena
        Scene scene = new Scene(htmlEditor);
        // Adicione a cena ao palco
        stage.setScene(scene);
        // Definir o título do palco
        stage.setTitle("HTMLEditor Exemplo");


        stage.show();
    }

}
  • I don’t think so. Although Javafx allows the insertion and use of swing components within an application made in this API, in the case of swing, it is no longer updated, therefore, this compatibility was not made.

  • Well, I managed to call a 'screen' in Javafx through FXML, but I can’t do the same with this Htmleditor Screen, because it doesn’t have FXML, even being of the Javafx type, I wonder if there is any way to generate FXML code from this class . Java so I can call through it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.