JDemo - Java Demonstration Framework

JDemo logo JDemo is the Java demonstration framework. Its concept is similar to the one of JUnit.

As supplement to test driven software development, JDemo provides a new approach of demo driven development: When developing software, you write short code snippets (demo cases) that use your new API. The demo then demonstrates both: how to use the API and what happens when you execute the code. So you can for example interactively test the usability of GUI components.

JDemo has a lot of convenience classes and methods that make implementing those demos very easy. The demos can then be launched from a Swing application called Demo Runner.

Demos can also be used for automatically taking screenshots for documentation purposes.

Latest News

August 13th, 2008

At the Agile 2008 conference Ilja Preuß held a session on JDemo. The slides can be downloaded here.

February 27th, 2008: New Version 1.6.0 released

  • JDemo is now based on JDK 1.6.0
  • There is a new @Demo annotation, that can be used just like the @Test annotation in JUnit 4. Note that @Demo replaces the old @JDemo (now deprecated).
  • Showing files (from de.jdemo.framework.DemoCase subclasses) now uses the new JDK 1.6 java.awt.Desktop class for opening files in an appropriate application
  • Added DemoAsTestRunner as new Junit4TestRunner for demos, so demos can now be run as unit tests w/o writing suites.
  • Improved reliability of automatically taking screenshots.
  • Removed dependency from disy-commons layout classes. This might have lead to incompatibility problems as soon as disy-commons is released a open source library.
  • Removed direct dependency to the Java2Html library (used for displaying source code when running the swing demo runner outside Eclipse). It will still be used if the java2html.jar is on the classpath. Version 6.0 or greater required (not yet released, but an up-to-date milestone build is contained in the JDemo download package).

September 22nd, 2007

There is an online discussion at Javalobby about JDemo and demos in general: "Best practices and tools" for making demos - What are yours?.
    More news...

Screenshots / Example

The example demonstrates the look and feel of a Swing component class MyDice, showing the top side of a die:
The Demo Runner with two demo cases: The output of the Random Dice demo:
screenshot of the demo runner screenshot of the demo output

Here is what the source code for the dice demo looks like:

public class MyDiceDemo extends SwingDemoCase {
  /** Demo method showing a die using the first constructor specifying
  * an initial value. */
  public void demoShow6Dice() {
    JComponent diceComponent = new MyDice(6);

  /** Demo method showing a die using the second constructor (random value). */
  public void demoShowRandomDice() {
    show(new MyDice());

The complete example is contained in the download package and described in detail in the documentation.

Valid XHTML 1.0!
© Markus Gebhard (markus@jdemo.de), 2003 - 2008
last modified: Aug 13, 2008
   SourceForge.net Logo