Caroline Appert Michel Beaudouin-Lafon
Bat 650, Université Paris-Sud
91405 Orsay cedex
Tel: +33 1 69 15 34 60
Fax: +33 1 69 15 65 86
Bat 650, Université Paris-Sud
91405 Orsay Cedex, France
Tel: +33 1 69 15 69 10
Fax: +33 1 69 15 65 86


SwingStates is a library that adds state machines to the Java Swing user interface toolkit. Unlike traditional approaches, which use callbacks or listeners to define interaction, state machines provide a powerful control structure and localize all of the interaction code in one place. SwingStates takes advantage of Java's inner classes, providing programmers with a natural syntax and making it easier to follow and debug the resulting code. SwingStates tightly integrates state machines, the Java language and the Swing toolkit. It reduces the potential for an explosion of states by allowing multiple state machines to work together. SwingStates can be used to add new interaction techniques to existing Swing widgets, to program new widgets by using the flexible and powerful SwingStates' Canvas and to control high-level dialogues.




Source code

Images and code sample

These applets require at least Java 2 SDK, Standard Edition v 1.5.0 to run. Furthermore, since state machine initializations use Java reflection API, these applets require higher rights in security access than the default ones (these applets do not read or write on your file system, security access is only required for code introspection). That is why you are asked to accept or decline a certificate for the signed jar that contains these applets. If you don't trust the certificate, applets won't run.
In any case, you can download SwingStates source code on sourceforge website and run the examples on your local configuration. All applets source code is in package fr.lri.swingstates.applets.

Select checkboxes by crossing them:

A semi-transparent pie menu to change background color of swing widgets:

A numeric value controlled by a joystick-like interaction: