Skip to content

An example osbot script which supports a JavaFX user interface for script setup

Notifications You must be signed in to change notification settings

Shadowrs/osbot-javafx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

osbot-javafx

An example osbot script which supports a JavaFX user interface for script setup

javafx osbot user interface

Required dependencies

This repo has two modules:

  • fxutil : utility classes for downloading the .fxml javafx ui-sheet
  • fxtest : the osbot script which extends Script

Implementing

Configure the user interface:

  • with a download URL for the source (suggested host on dropbox)
  • name of the local file of the .fxml to be stored in osbot/data/
  • the class for the FXML controller
  • A org.shadowrs.osbot.fxutil.Feedback implementation for output messages
    public final UI         ui = new UI("https://www.dropbox.com/s/z7pash8a31l9hyf/shadowrs.reagro.testmain.fxml?dl=1",
            "/shadowrs.reagro.testmain.fxml",
            MainFxTestController.class, o -> FxLoadTest.INSTANCE.println(o));
            

The controller must implement org.shadowrs.osbot.fxutil.OsbotController

Open the UI and wait for it to be closed in the osbot script onLoop:

    @Override
    public int onLoop() {
        if (!ui.open() && !ui.confirmed) {
            println("starting UI");
            ui.runFX(INSTANCE);
            return 1_000;
        }
        if (!ui.confirmed) {
            println("awaiting UI closure");
            return 1_000;
        }
        // main script code
        return 1_000;
    }

javafx osbot user interface

FAQ

Q: Will javafx work with osbot's SDN? A: no, they've disallowed javafx so this is only for privately distributed scripts

Q: Why's it so complicated? A: the javafx scene is actually embedded in a Swing JFrame

Q: How can I easily create and build a .fxml form? A: SceneBuilder 8 (for Java8)

Q: InteliJ embedded SceneBuilder has issues with dragging components A: Everything must be Java 8, the project, module, build, scene builder and InteliJ Runtime. You can choose the IDEA runtime with this plugin

About

An example osbot script which supports a JavaFX user interface for script setup

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages