Code Monkey home page Code Monkey logo

osbot-javafx's Introduction

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

osbot-javafx's People

Contributors

shadowrs avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.