« Hybrid tutorial - Hello world! | Main | Hybrid tutorial - The anti-social image viewer »

Hybrid tutorial - Writing a desktop application in Javascript

About
Teppefall Hybrid makes it possible to write Java desktop applications in just Javascript and XML. You simply add an attribute to the application.xml file.

Dependencies
You must create an ext/ folder and add bsf.jar, js.jar and commons-logging.jar into this folder.

hello.xml
<application script="sample.js">
<!-- Configuration code here-->
</application>

hello.jfc (notice the ID attribute)
<component class="javax.swing.JLabel" id="hello" text="Hello World !"/>

sample.js
context.info("Hallo verden !" + context.getApplication().getApplicationName())
context.info(context.getApplication().getAssembly().getComponentById("hello"))

run.cmd
java -cp teppefall-runtime.jar com.teppefall.hybrid.app.JJHMain hello.xml

CWindowssystem32cmd.exe.png

Hello World !.png

Check out Jan Erik Paulsen on Twitter.