So far so good, but where’s the drawback? Well there are version issues between these packages and also some restrictions in functionality. Here I outline the installation process for JFreeChart and Orson. I’ll cover the functionality in a later post. JCommon is also required here since it contains code used by both JFreeChart and Orson.
- Get JFreeChart, JCommon and Orson from http://www.jfree.org/. At the time of writing the latest versions are jfreechart-1.0.13, jcommon-1.0.16 and orson-0.5.0.
- Unpack these to locations of your choice. Here I’ll use…
- <jfreechart> to mean the root of the corresponding unpacked zip file (this contains the folders: ant, checkstyle, docfiles and so on),
- <jcommon> to mean the root of the corresponding unpacked zip file (containing the folders: ant, checkstyle, javadoc etc.); and
- <orson> to mean the root of the corresponding unpacked zip file (containing the folders: ant, docs and images folders etc.)
- If you don’t have Ant you’ll need the following…
- Get WinAnt from http://code.google.com/p/winant/. Here I’m working on Windows (latest version winant-install-v5.exe). Ant is likely to be installed already on a Linux system. Not sure about Macintosh, but I guess you can probably find it.
- Install WinAnt. This installs the ANT_HOME environment variable for you and also modified your PATH. You (probably) need to restart the computer.
- Make sure your JAVA_HOME environment variable points to the root of Java JDK not the bin directory.
- Copy <jfreechart>\lib\jfreechart-1.0.13.jar and <jfreechart>\lib\jcommon-1.0.16.jar to the <orson>\lib folder.
- Delete the copies of jfreechart-#.#.##.jar and jcommon-#.#.##.jar previously in the <orson>\lib folder.
- Open <orson>\ant\build.xml in a text editor. I use Notepad++.
- Change (line 11 in my version)
<property name="jcommon.version" value="1.0.10" />
<property name="jcommon.version" value="1.0.16" />
or whichever version of the jcommon.jar you copied in step 4 above.
- Change (line 12 in my version)
<property name="jfreechart.version" value="1.0.6" />
<property name="jfreechart.version" value="1.0.13" />
or whichever version of the jfreechart.jar you copied in step 4 above.
- Save this modified build.xml file.
- Using a Command Prompt navigate to the <orson>\ant folder and run ‘ant’ (without quotes) to rebuild the Orson-0.5.0.jar using the new JFreeChart and JCommon JARs.
Installing these packages in Netbeans…
- Add JFreeChart, JCommon and Orson to your Libraries section in NetBeans. Instructions for this are given in the JFreeChart installation PDF (currently jfreechart-1.0.13-install.pdf) in Appendix 2. Note that you can find the jfreechart-x.x.xx.jar and jcommon-x.x.xx.jar files in the <jfreechart>\lib folder. Also you can download the javadoc files from Sourceforge currently: jfreechart-1.0.13-javadocs.zip.
- From the Tools menu select Palette then Swing/AWT Components.
- Click ‘New Category’.
- Enter a name, for example ‘Orson’.
- Click ‘Add from Library…’
- Select Orson from the list of available libraries. Click Next.
- Select all the components you require (all?). Click Next.
- Select Orson from the palette category list and click Finish.
Now you have the JFreeChart charting components available through Netbeans where they can be added to JInternalFrame components just like any other Bean.