1. /*
  2. * @(#)BlueprintGraphics.java 1.4 04/01/13
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.java.swing.plaf.gtk;
  8. import java.awt.*;
  9. /**
  10. * @version 1.4 01/13/04
  11. * @author Joshua Outwater
  12. */
  13. class BlueprintGraphics extends SynthGraphics {
  14. public void paintText(SynthContext context, Graphics g, String text,
  15. int x, int y, int mnemonicIndex) {
  16. int state = context.getComponentState();
  17. Region region = context.getRegion();
  18. // Paint menu and menu items with shadow defined by blueprint colors.
  19. if (((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER
  20. && (region == Region.MENU_ITEM ||
  21. region == Region.CHECK_BOX_MENU_ITEM ||
  22. region == Region.RADIO_BUTTON_MENU_ITEM)) ||
  23. ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED
  24. && region == Region.MENU)) {
  25. Color oldColor = g.getColor();
  26. g.setColor(context.getStyle().getColor(context,
  27. GTKColorType.BLACK));
  28. super.paintText(context, g, text, x + 1, y + 1, mnemonicIndex);
  29. g.setColor(context.getStyle().getColor(context,
  30. GTKColorType.WHITE));
  31. super.paintText(context, g, text, x, y, mnemonicIndex);
  32. g.setColor(oldColor);
  33. } else {
  34. super.paintText(context, g, text, x, y, mnemonicIndex);
  35. }
  36. }
  37. }