https://github.com/wsargent/scalafx-ammonite
A very short demo of how to run scalafx GUI applications using Ammonite scripting.
https://github.com/wsargent/scalafx-ammonite
Last synced: 8 months ago
JSON representation
A very short demo of how to run scalafx GUI applications using Ammonite scripting.
- Host: GitHub
- URL: https://github.com/wsargent/scalafx-ammonite
- Owner: wsargent
- Created: 2021-07-12T14:54:19.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-12T21:24:54.000Z (over 4 years ago)
- Last Synced: 2025-01-09T18:03:02.004Z (9 months ago)
- Language: Scala
- Homepage:
- Size: 600 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ScalaFX with Ammonite
[Ammonite](https://ammonite.io) is a script tool for Scala.
[ScalaFX](http://www.scalafx.org/) is a framework providing a DSL for [JavaFX](https://openjfx.io/), providing a GUI interface.
With their powers combined, you can script GUI tools using Scala, without having to run sbt or any kind of build process.
## Requirements
Install JDK 16 -- I've been using sdkman with 16.0.1.9.1-amzn, YMMV
```
sdk install java 16.0.1.9.1-amzn
```Install [amm](https://ammonite.io/#ScalaScripts):
```
sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/com-lihaoyi/Ammonite/releases/download/2.4.0/2.13-2.4.0) > /usr/local/bin/amm && chmod +x /usr/local/bin/amm' && amm
```## Usage
Clone or download this project, and then run the script:
```
amm ./helloworld.sc
```You should see a "Hello World" GUI box show up.
For a more complex example, you can see the AdoptionForm, which uses FXML:
```
amm ./adoption.sc
```You can also run a browser from ScalaFX:
```
amm ./webbrowser.sc
```This unfortunately crashes on Windows WSL, but may work on your platform.