KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > java > swing > plaf > gtk > BlueprintGraphicsUtils


1 /*
2  * @(#)BlueprintGraphicsUtils.java 1.5 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 com.sun.java.swing.plaf.gtk;
8
9 import java.awt.*;
10 import javax.swing.plaf.synth.*;
11
12 /**
13  * @version 1.5 12/19/03
14  * @author Joshua Outwater
15  */

16 class BlueprintGraphicsUtils extends SynthGraphicsUtils {
17     public void paintText(SynthContext context, Graphics g, String JavaDoc text,
18             int x, int y, int mnemonicIndex) {
19         int state = context.getComponentState();
20         Region region = context.getRegion();
21
22         // Paint menu and menu items with shadow defined by blueprint colors.
23
if (((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER
24                     && (region == Region.MENU_ITEM ||
25                         region == Region.CHECK_BOX_MENU_ITEM ||
26                         region == Region.RADIO_BUTTON_MENU_ITEM)) ||
27                 ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED
28                     && region == Region.MENU)) {
29             g.setColor(context.getStyle().getColor(context,
30                         GTKColorType.BLACK));
31             super.paintText(context, g, text, x + 1, y + 1, mnemonicIndex);
32
33             g.setColor(context.getStyle().getColor(context,
34                         GTKColorType.WHITE));
35             super.paintText(context, g, text, x, y, mnemonicIndex);
36         } else {
37             super.paintText(context, g, text, x, y, mnemonicIndex);
38         }
39     }
40 }
41
Popular Tags