1. /*
  2. * @(#)DebugGraphicsInfo.java 1.11 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing;
  8. import java.awt.*;
  9. import java.util.*;
  10. /** Class used by DebugGraphics for maintaining information about how
  11. * to render graphics calls.
  12. *
  13. * @version 1.11 01/23/03
  14. * @author Dave Karlton
  15. */
  16. class DebugGraphicsInfo {
  17. Color flashColor = Color.red;
  18. int flashTime = 100;
  19. int flashCount = 2;
  20. Hashtable componentToDebug;
  21. JFrame debugFrame = null;
  22. java.io.PrintStream stream = System.out;
  23. void setDebugOptions(JComponent component, int debug) {
  24. if (componentToDebug == null) {
  25. componentToDebug = new Hashtable();
  26. }
  27. if (debug > 0) {
  28. componentToDebug.put(component, new Integer(debug));
  29. } else {
  30. componentToDebug.remove(component);
  31. }
  32. }
  33. int getDebugOptions(JComponent component) {
  34. if (componentToDebug == null) {
  35. return 0;
  36. } else {
  37. Integer integer = (Integer)componentToDebug.get(component);
  38. return integer == null ? 0 : integer.intValue();
  39. }
  40. }
  41. void log(String string) {
  42. stream.println(string);
  43. }
  44. }