1 7 package com.sun.java.swing.plaf.gtk; 8 9 import javax.swing.*; 10 import javax.swing.plaf.synth.*; 11 import java.awt.Color ; 12 import java.awt.Graphics ; 13 import java.awt.Rectangle ; 14 15 19 class GTKGraphicsUtils extends SynthGraphicsUtils { 20 public void paintText(SynthContext context, Graphics g, String text, 21 int x, int y, int mnemonicIndex) { 22 int componentState = context.getComponentState(); 23 if ((componentState & SynthConstants.DISABLED) == 24 SynthConstants.DISABLED){ 25 Color orgColor = g.getColor(); 26 g.setColor(context.getStyle().getColor(context, 27 GTKColorType.WHITE)); 28 x += 1; 29 y += 1; 30 super.paintText(context, g, text, x, y, mnemonicIndex); 31 32 g.setColor(orgColor); 33 x -= 1; 34 y -= 1; 35 super.paintText(context, g, text, x, y, mnemonicIndex); 36 } 37 else { 38 super.paintText(context, g, text, x, y, mnemonicIndex); 39 } 40 } 41 42 53 public void paintText(SynthContext context, Graphics g, String text, 54 Rectangle bounds, int mnemonicIndex) { 55 Color color = g.getColor(); 56 57 Region region = context.getRegion(); 58 if ((region == Region.RADIO_BUTTON || region == Region.CHECK_BOX || 59 region == Region.TABBED_PANE_TAB) && 60 (context.getComponentState() & SynthConstants.FOCUSED) != 0) { 61 JComponent source = context.getComponent(); 62 if (!(source instanceof AbstractButton) || 63 ((AbstractButton)source).isFocusPainted()) { 64 ((GTKStyle)(context.getStyle())).getEngine(context).paintFocus( 65 context, g, SynthConstants.ENABLED, 66 "checkbutton", bounds.x - 2, bounds.y - 2, 67 bounds.width + 4, bounds.height + 4); 68 g.setColor(color); 69 } 70 } 71 super.paintText(context, g, text, bounds, mnemonicIndex); 72 } 73 } 74 | Popular Tags |