[gui] Fixlets/Workarounds for JFreeChart

Mark Wielaard mark@klomp.org
Sun Sep 5 18:43:00 GMT 2004


Hi,

On Thu, 2004-09-02 at 21:04, Mark Wielaard wrote:
> To get the JFreeChart demo program working as described on
> http://classpath.wildebeest.org/dairy/index.php?p=31
> I needed the following Fixlets/Workarounds:

On irc Graydon told me to just remove the asserts() and replace them
with if blocks since they were wrong in the first place. And to save and
restore the new Composite field in DrawState.

I have committed this slightly revised patch which does both:

2004-09-03  Mark Wielaard  <mark@klomp.org>

       * gnu/java/awt/peer/gtk/GdkGraphics.java (setColor): Use
       Color.BLACK if c == null, don't create new Color object each time.
       * gnu/java/awt/peer/gtk/GdkGraphics2D.java (comp): New private
       field.
       (setColor): Use Color.BLACK when argument null.
       (setComposite): Set this.comp field.
       (getComposite): Return this.comp, or AlphaComposite.SrcOver when null.
       (DrawState.comp): New private field.
       (DrawState.save): Save Composite.
       (DrawState.restore): Restore comp field.
       * java/awt/FontMetrics.java (gRC): New static final private field.
       (getLineMetrics(String, Graphics)): New method.
       (getLineMetrics(String, int, int, Graphics)): Likewise.
       (getLineMetrics(char[], int, int, Graphics)): Likewise.
       (getLineMetrics(CharacterIterator, int, int, Graphics)): Likewise.
       * javax/swing/JMenu.java (JMenu(String, boolean)): Ignore tearoff
       argument. PR SWING/17294.
       * javax/swing/plaf/basic/BasicGraphicsUtils.java (): Always use
       the fall-back code since none of the TextArea methods are really
       implemented now. PR SWING/17296.
       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
       (GdkGlyphVector_setChars): Replace assert() with if block when
       pango_itemize() returns null. PR AWT/17295.
       (GdkGlyphVector_allInkExtents): Likewise when vec->glyphitems is null.

With this the jfreechart demo
(http://www.jfree.org/jfreechart/jfreechart-0.9.20.tar.gz) works out of
the box (more or less) on the gui branch with:

gij -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -classpath jfreechart-0.9.20-demo.jar:jfreechart-0.9.20.jar:lib/jcommon-0.9.5.jar org.jfree.chart.demo.JFreeChartDemo

Try it out, it is fun! (But a bit slow, so have patience.)

Cheers,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jfreechart-fixlets.patch2
Type: text/x-patch
Size: 14395 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040905/7ffecbc6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040905/7ffecbc6/attachment.sig>


More information about the Java-patches mailing list