classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: DebugGraphics logging implemented


From: Roman Kennke
Subject: [cp-patches] FYI: DebugGraphics logging implemented
Date: Wed, 19 Oct 2005 13:11:30 +0000

Hi,

I implemented the logging facility of javax.swing.DebugGraphics. This is
a really useful tool for debugging our Swing. All you have to do is to
call setDebugGraphicsOptions(DebugGraphics.LOG_OPTION) on a Swing
component, and all painting operations on the component and its children
are then logged.

For convenience I made JComponent.getDebugGraphicsOptions() recognize a
system property gnu.javax.swing.DebugGraphics, if it is set to LOG then
logging is turned on globally at runtime. It also recognizes FLASH, but
I think the flashing in DebugGraphics is not implemented very
well/complete yet.

So, in the future, if you see painting problems, or ask yourself how some
component is painted, then you really should try this class. Hint: this
is also useful for finding out how swing components, icons and borders
are drawn on the reference implementation.

BTW: This really went in as two commits, since I forgot  a little piece
in JComponent the first time.

2005-10-19  Roman Kennke  <address@hidden>

        * javax/swing/JComponent.java
        (getDebugGraphicsOptions): Fixed to load system property if present.

2005-10-19  Roman Kennke  <address@hidden>

        * javax/swing/DebugGraphics.java
        (counter): New field.
        (color): Removed unneeded field.
        (DebugGraphics()): Count up.
        (DebugGraphics(Graphics,JComponent)): Call this(Graphics).
        (DebugGraphics(Graphics)): Call this().
        (setColor): Implemented logging facility.
        (create): Copy debugOptions over to new DebugGraphics instance.
        (create(int,int,int,int)): Likewise.
        (setFont): Implemented logging facility.
        (getColor): Return graphics.getColor().
        (translate): Implemented logging facility.
        (setPaintMode): Likewise.
        (setXORMode): Likewise.
        (clipRect): Likewise.
        (setClip(int,int,int,int)): Likewise.
        (setClip(Shape)): Likewise.
        (drawRect): Likewise. Only flash when FLASH_OPTION is set.
        (fillRect): Likewise.
        (clearRect): Implemented logging facility.
        (drawRoundRect): Likewise.
        (fillRoundRect): Likewise.
        (drawLine): Likewise.
        (draw3DRect): Likewise.
        (fill3DRect): Likewise.
        (drawOval): Likewise.
        (fillOval): Likewise.
        (drawArc): Likewise.
        (fillArc): Likewise.
        (drawPolyline): Likewise.
        (drawPolygon): Likewise.
        (fillPolygon): Likewise.
        (drawString(String,int,int)): Likewise.
        (drawString(AttributedCharacterIterator,int,int)): Likewise.
        (drawByted): Likewise.
        (drawChars): Likewise. Only flash if FLASH_OPTION is set.
        (drawImage): Implemented logging facility. (Also applies to all
        overloaded versions of this method).
        (copyArea): Likewise.
        (setDebugOptions): Likewise.
        (prefix): New helper method.
        * javax/swing/JComponent.java
        (getComponentGraphics): Implemented to return DebugGraphics when
        needed.
        (getDebugGraphicsOptions): Implemented to return the correct options.
        Also, this loads a system property gnu.javax.swing.DebugGraphics
        if present and evaluates it.

/Roman

Attachment: DebugGraphics.diff
Description: Text Data

Attachment: JComponent.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]