Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to start GroovyFX from JavaFX #69

Open
wise-coders opened this issue Jun 30, 2024 · 0 comments
Open

How to start GroovyFX from JavaFX #69

wise-coders opened this issue Jun 30, 2024 · 0 comments

Comments

@wise-coders
Copy link

I already have a JavaFX application, with an embedded text editor. The editor is using something like this to execute the script I paste inside.

final GroovyShell shell = new GroovyShell( new GroovyConfig(  ) );
final Script script = shell.parse( query, binding );

If I paste the demo below and execute it, I get this error:
Application launch must not be called more than onece.

How can I avoid this?

import groovyx.javafx.GroovyFX;

GroovyFX.start {
    stage(x: 100, y: 100, onShown: { println "Stage 1" }, visible: true, style: 'UTILITY') {
        scene(width: 100, height: 100, fill: GROOVYBLUE)
    }
    stage(primary: false, x: 100, y: 400, visible: true) {
        onShown { println "Stage 2" }
        scene(width: 100, height: 100, fill: RED)
    }
}
@wise-coders wise-coders changed the title Can I start GroovyFX from JavaFX How to start GroovyFX from JavaFX Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant