SwingWT would be good

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
allquixotic
Posts: 3
Joined: Mon Jul 18, 2005 4:41 pm

SwingWT would be good

Post by allquixotic » Tue Aug 23, 2005 5:17 pm

Hey all,

In attempting to integrate JFreeChart and SWT, the main problem that people have mentioned before is that AWT and SWT have different event loops, and are not very interoperable. If you want users to be able to use the context menu to print or save the chart, you can't just capture it as a JPEG; and the SWT_AWT component isn't mature enough to make this a viable alternative for production applications with an eye for multiplatform ability.

What SwingWT would do is to change the internal representation of JFreeChart into SWT widgets, while keeping the API in Swing... you could use existing API to modify your charts if they don't need to interoperate with SWT; but if you did need to interoperate with SWT, you could drill down from the top-level container (Shell) and get access to the JFreeChart as a real SWT widget. Of course you'd have to heuristically determine how SwingWT has implemented the Swing calls in the SWT paradigm, but it could be done.

It may also be possible to use a JFreeChart, recompiled with SwingWT, as a staging ground to produce a SWT-only API to the JFreeChart library, by letting SwingWT implement JFreeChart in SWT and then writing a utility library to gather information about the SWT implementation, and expose a JFreeChart API using SWT objects (without any SwingWT translation) based on the (hidden) SWT implementation generated by SwingWT. If SwingWT is this flexible, then this route would truly produce a SWT version of JFreeChart, with a SWT API, without having to re-write the library from scratch using SWT widgets. Thoughts?

I'm going to try the recompile with SwingWT and see if it mangles it like it mangles JGoodies forms. We'll see.

-Sean

kelsey
Posts: 2
Joined: Wed Apr 19, 2006 6:51 pm

SwingWT would be good

Post by kelsey » Wed Apr 19, 2006 8:01 pm

Sean,

I am curious to hear the results of your build experiment, as I was about to try this myself.

I have been looking for a way to use JFreeChart (with full functionality, not just images) in my Eclipse RCP app, on Mac OS X. SwingWT may be the only hope at this point, though for now I am trying RChart instead of JFreeChart (it is the only full featured Java graphing library that has a SWT implementation from what I've found).

Locked