This repository contains several small SubScript example applications. LookupFrame2TBD is a training assignment.
You will need the following software in order to run the examples:
- Git client - official website, download manual
- SBT build tool - official website, download manual
To try the examples:
- Clone this repository by running
git clone https://github.com/scala-subscript/examples.git
- Go to the root of the repository:
cd examples
- Launch the SBT console by running
sbt
- Run
projects
from the SBT console. You will see the list of all the examples in the repository, each belonging to its own project.root
is not an example, but the root project, so ignore it. - To run an example, run the
<example_project_name>/run
command, where<example_project_name>
is the name of the desired example, as listed in theprojects
command's output. For example, if you want to try the "lookupframe" example, runlookupframe/run
. - Some examples have more then one object with the
main
method. In this case the console will prompt you to specify what you want to run. In case of "Lookup Frame", entering1
in the prompt will run a simple "LookupFrame", and entering2
will run the more complex "LookupFrame2". - In order to start developing with SubScript, please head to the main repository and follow its "Getting Started guide"
You can use graphical debugger to see how the projects work. To do so:
- From the examples' root, run
sbt
. - Set the current project to a desired one:
project projectName
, whereprojectName
is a name fromprojects
command output. - Some projects have more than one main class. To see the project's main classes, run
show discoveredMainClasses
. - If the project has more than one main class, you'll have to specify which one you want to debug:
set mainClass in Compile := Some("main_class_name")
, wheremain_class_name
is some name from theshow discoveredMainClasses
output (see the complete list of commands for setting the main class below). If the project has only one main class, no action is needed, it will be used automaticaly. - Run
ssDebug
.
- Lookup frame (
project lookupframe
)set mainClass in Compile := Some("subscript.example.LookupFrame")
set mainClass in Compile := Some("subscript.example.LookupFrame2")
set mainClass in Compile := Some("subscript.example.LookupFrame2TBD")
- AB (
project ab
)set mainClass in Compile := Some("subscript.example.AsBX")
set mainClass in Compile := Some("subscript.example.AsBsX")
set mainClass in Compile := Some("subscript.example.Bag")
set mainClass in Compile := Some("subscript.example.Bag_A")
set mainClass in Compile := Some("subscript.example.Bag_AB")
set mainClass in Compile := Some("subscript.example.Bag_AB_loops")
- Hello World (
project helloworld
)set mainClass in Compile := Some("subscript.example.Hello")
set mainClass in Compile := Some("subscript.example.HelloWorld")
set mainClass in Compile := Some("subscript.example.Hello_1_World")
- helloworld is a classic Hello World application
- ab is a swing application to demonstrate some basic scripts
- lookupframe demonstrates a more complex use case of scripting in the context of Swing
- life is the Game of Life simulator
- twitter searches Twitter's most recent tweets with a given keyword. Features dataflow, where the application is reactively bound to the input field, so that any input causes a new search.
- pingpong is a use case of SubScript Akka Actors. Two actors that exchange a message three times.
- taskprocessor is a more complex example of SubScript Actors. An actor system that is designed to process any given task by forking it, delegating parts to different actors and then joining the results together.
The repository contains multiple SBT project folders with the corresponding examples. build.sbt
is a multi-project build file binding the examples together. Each of the example projects is defined by its own build.sbt
that can be found in its folder. The SubScript SBT plugin is defined for all the projects in project/build.sbt
.