Skip to main content
Last updated April 11, 2013 22:05, by Tim Halloran
Feedicon  

Getting started

This page describes how to download the right release, what files are included in a release, how to run the demo programs, and how to setup the Timing Framework library for use it in a project.


Choosing the right release

The different distributions are described here and you can download the latest version here. In a nutshell:

The last distribution is more niche.

  • timingframework-classic is Chet's original implementation with minor bug fixes. You want this distribution if you are reading through Filthy Rich Clients and want to try out the examples for the book that can be downloaded at the book's website.

What's in the release?

Each release is a zip file that unzips into a single directory with the same name as the file. We'll use the Swing release as an example. Within that directory are the following contents:

  • javadoc/
    • Contains the Javadoc for the distribution.
  • lib/
    • timingframework-swing-5.1.jar (the Timing Framework library)
    • timingframework-swing-demos-5.1.jar (the Timing Framework demos)
  • src/
    • The Timing Framework source code for the release and the demos.
  • LICENSE.txt (license information)
  • NOTES.txt (release notes)

Running the demos

There are several ways to run the demonstration programs included in the Swing and SWT distributions:

  • From the command line using the java command.
  • In Eclipse (or another Java IDE) from the Jar files.
  • In Eclipse (or another Java IDE) from source code.

The demo programs are described here, this section just describes how to get them to run. Each demo has a classname (such as org.jdesktop.swing.animation.demos.ClickAndGo for the Swing Click and Go demo). These classnames are listed on the Demos page.

At the command line

All of the demonstrations can be run from the release Jar files at the command line.

For Swing you would use:

java -cp "timingframework-swing-demos-5.1.jar;timingframework-swing-5.1.jar" classname

The Swing TooManyBalls demonstration can be changed from passive rendering to game-like active rendering (see the JActiveRenderer class) by defining the org.jdesktop.renderer.active property. For example, use:

java -cp "timingframework-swing-demos-5.1.jar;timingframework-swing-5.1.jar" -Dorg.jdesktop.renderer.active=true org.jdesktop.swing.animation.demos.TooManyBalls

For SWT you would use:

java -cp "timingframework-swt-demos-5.1.jar;timingframework-swt-5.1.jar;swt.jar" classname

You have to include SWT to allow the demos to launch correctly. In the example above I copied the swt.jar for my platform into the same directory, but you can reference it within another directory (the command above worked on Windows under Cygwin). It is important that the SWT Jar be the correct one for your platform. Note that on Mac OS X you must also pass -XstartOnFirstThread to the Java VM or SWTException will be thrown.

In Eclipse from Jar files

Create a Java project in Eclipse and copy the two Jar files in the lib/ directory of the release into the project. For SWT you will need to follow the SWT installation instructions to import the org.eclipse.swt project into the Eclipse workspace. This is really easy to do—just be careful to download the right version of SWT for your platform and Eclipse version. Note that on Mac OS X you must also pass -XstartOnFirstThread to the Java VM or SWTException will be thrown.

Add the two Jar files (and the SWT project if necessary) to the Java Build Path of your project (configured in the project's Properties). The two Jar files should appear under the Referenced Libraries in your project.

Expand the demos Jar file and open the demos package. For example the below screenshot shows the Swing TooManyBalls demo program being launched from its Jar file.

In Eclipse from source code

Note that if you want to checkout the latest Timing Framework source code from the java.net project, follow the instructions here. In this section we discuss how to load up the source code included with each release and run the demo programs.

Create a Java project in Eclipse and copy the contents of the src/ directory of the release into the source location of the project, typically src/ under the main project directory. If you do the Paste of the files within Eclipse the code should build, if you copy the files outside Eclipse press F5 on the project to Refresh the project files.

Expand the source code and open the demos package. For example the below screenshot shows the Swing TooManyBalls demo program being launched from its source file.

Note that on Mac OS X you must also pass -XstartOnFirstThread to the Java VM or SWTException will be thrown.

Using the Timing Framework library in your code

To include the Timing Framework library in code that you develop, you would add the library to your project's classpath. For Swing and SWT, respectively you would add:

  • timingframework-swing-5.1.jar
  • timingframework-swt-5.1.jar

Both of these files are located in the lib/ directory of the distribution. This is typically pretty easy to do with any Java IDE or in an Ant build script.

For SWT you will need to follow the SWT installation instructions to import the org.eclipse.swt project into the Eclipse workspace. This is really easy to do—just be careful to download the right version of SWT for your platform and Eclipse version. If you are an SWT developer you probably already knew this. Eclipse plug-in developers will need to ensure that your plug-in has the SWT plug-in as a dependency (and may want to consider including the SWT Timing Framework as source code rather than as a Jar file).

You do not need to include the demos Jar file on your project's classpath. The demo Jar file contains several image files and is therefore much larger than the library Jar file. If there is some code within a demo program that you want to use, I recommend copying that snippet of source code into your project rather than including the whole demos Jar file due to its size. As noted above the full source code is included in every release.

 
 
Close
loading
Please Confirm
Close