KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > DebugGraphicsInfo


1 /*
2  * @(#)DebugGraphicsInfo.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing;
9
10 import java.awt.*;
11 import java.util.*;
12
13 /** Class used by DebugGraphics for maintaining information about how
14   * to render graphics calls.
15   *
16   * @version 1.13 12/19/03
17   * @author Dave Karlton
18   */

19 class DebugGraphicsInfo {
20     Color flashColor = Color.red;
21     int flashTime = 100;
22     int flashCount = 2;
23     Hashtable componentToDebug;
24     JFrame JavaDoc debugFrame = null;
25     java.io.PrintStream JavaDoc stream = System.out;
26
27     void setDebugOptions(JComponent JavaDoc component, int debug) {
28     if (debug == 0) {
29         return;
30     }
31         if (componentToDebug == null) {
32             componentToDebug = new Hashtable();
33         }
34     if (debug > 0) {
35         componentToDebug.put(component, new Integer JavaDoc(debug));
36     } else {
37         componentToDebug.remove(component);
38     }
39     }
40
41     int getDebugOptions(JComponent JavaDoc component) {
42         if (componentToDebug == null) {
43             return 0;
44         } else {
45             Integer JavaDoc integer = (Integer JavaDoc)componentToDebug.get(component);
46
47             return integer == null ? 0 : integer.intValue();
48         }
49     }
50
51     void log(String JavaDoc string) {
52         stream.println(string);
53     }
54 }
55
56
57
Popular Tags