79609617

Date: 2025-05-06 23:24:19
Score: 0.5
Natty:
Report link

A proposed solution (GitHub project) working on JDK 11 and later with corresponding version 11 of the openjfx libraries.

The gist is that you get a hold of the reference by creating and initializing the gui app yourself, not let Application.launch create the instance:

class Main {
    void work() {
        // Reference
        Gui gui = new Gui(this/*for callbacks*/, "data", 'U', "initialize", 17, "with");
        // Start
        Platform.startup(() -> gui.start(new Stage()));    
    }

    // Allow the Gui-app to return results by means of callback
    void reportResult(double d, String desc) {
    }
}

class Gui extends javafx.application.Application {
//... 
// has a button that calls `Main.reportResult()` when pressed virtually returning values as any function call.
}

The project covers the use case of repeatedly/sequentially calling the gui utility application from within the main workflow app.

Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: parml