One problem today is that jfreechart graphics should be displayed in an Eclipse plug-in, because the latter is based on java2d and the graphics should be displayed in SWT applications.ProgramThe need to use the SWT-AWT bridge to achieve, although the bridge approach will be accompanied by a decline in performance, but is always a solution.
CodeNot complex. Here is a piece:
Public Void Createpartcontrol (composite parent) {
Parent. setlayout ( New Filllayout (SWT. Vertical ));
Composite drawarea = New Composite (parent, SWT. Embedded );
Drawarea. setlayout ( New Filllayout ());
Frame canvasframe = Swt_awt.new_frame (drawarea );
Canvas = New Java. AWT. Canvas () {
Public Void Paint (Graphics g) {
Super. Paint (g );
If(Chart! = Null)
Chart. Draw (graphics2d) g, getbounds ());
}
} ;
Canvasframe. Add (canvas );
}
The key lies in the swt_awt.new_frame () method. The result is a Java. AWT. Frame object, where all the AWT content to be displayed is placed.
There seems to be very few free chart tools under BTW and SWT. You can only use jfreechart for the moment.
Update: If you want to display an AWT image with an animated effect in the swt, you 'd better put a jpanel control with a double buffer on the frame, otherwise, the image will flash significantly during motion.