KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > util > display > DebugStatsPainter


1 package prefuse.util.display;
2
3 import java.awt.Graphics2D JavaDoc;
4
5 import prefuse.Display;
6 import prefuse.util.PrefuseLib;
7
8 /**
9  * PinatListener that paints useful debugging statistics over a prefuse
10  * display. This includes the current frame rate, the number of visible
11  * items, memory usage, and display navigation information.
12  *
13  * @author <a HREF="http://jheer.org">jeffrey heer</a>
14  */

15 public class DebugStatsPainter implements PaintListener {
16
17     /**
18      * Does nothing.
19      * @see prefuse.util.display.PaintListener#prePaint(prefuse.Display, java.awt.Graphics2D)
20      */

21     public void prePaint(Display d, Graphics2D JavaDoc g) {
22         
23     }
24     
25     /**
26      * Prints a debugging statistics string in the Display.
27      * @see prefuse.util.display.PaintListener#postPaint(prefuse.Display, java.awt.Graphics2D)
28      */

29     public void postPaint(Display d, Graphics2D JavaDoc g) {
30         g.setFont(d.getFont());
31         g.setColor(d.getForeground());
32         g.drawString(PrefuseLib.getDisplayStats(d), 5, 15);
33     }
34
35 } // end of class DebugStatsPainter
36
Popular Tags