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. 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.13 12/19/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 (debug == 0) {
  25. return;
  26. }
  27. if (componentToDebug == null) {
  28. componentToDebug = new Hashtable();
  29. }
  30. if (debug > 0) {
  31. componentToDebug.put(component, new Integer(debug));
  32. } else {
  33. componentToDebug.remove(component);
  34. }
  35. }
  36. int getDebugOptions(JComponent component) {
  37. if (componentToDebug == null) {
  38. return 0;
  39. } else {
  40. Integer integer = (Integer)componentToDebug.get(component);
  41. return integer == null ? 0 : integer.intValue();
  42. }
  43. }
  44. void log(String string) {
  45. stream.println(string);
  46. }
  47. }