I have an app in wich I embed Swing components inside a JavaFx application.
What I ask is if it’s better to do
void mrepaint(){Platform.runLater( ()-> SwingUtilities.invokeLater( () -> getSwingComponent().repaint() ));}
Or the way around
void mrepaint(){SwingUtilities.invokeLater( ()-> Platform.runLater.invokeLater( () -> getSwingComponent().repaint() ));}
My goal is to update the graphics of the embedded swing app (with the update triggered by a mouse click on the swing component or by a javafx Thread I use as event dispatched)
like
// handling the click on the swing component
getSwingNode().setOnMouseReleased( ()->mrepaint() );
//Or time-based
Thread t = new Thread(()->{
// ugly code bu gives the idea
while(true){Thread.sleep(5000); mrepaint();}
});
t.start();
I’m on Java corretto 17 with Gluon JFX17