JMRI is...

Scripting

Information on writing scripts to control JMRI in more detail:

Python

JMRI scripts are in Python, a popular general-purpose computer language

General Tools

The general objects available to control your layout.

JMRI: Jynstruments

JMRI provides a nice way to integrate Jython scripts in the JMRI Java application, particularly aimed at extending and customising the GUI.

That is called a Jynstrument. It's a bundle of Jython code and other resources. The Jython code defines an object deriving from the Java Jynstrument class (itself deriving from JPanel). This object will be instantiated by the instrumented JMRI code itself and then is event driven.

Have a look at the Jython folder in your source tree, there is Jynstruments folder with a README and a ThrottleFrame/Light.jyn to be tried on the JMRI Throttle window. The image to the right shows them in use (the diamond buttons).

See ThrottleFrame.java for how to make code instrumentable; more details are in the README.

Usage is quite simple, drag'n drop the Light.jyn folder onto a JMRI Throttle Window (on window content itself, the toolbar is instrumentable too, but won't accept the Lights.jyn, another example is being worked on for that).