< prev index next >

src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java

Print this page

        

@@ -111,17 +111,19 @@
 //            throw new InconsistencyException("No metrics for Font " + font());
             return;
         }
 
         if (justification == CENTER) {
-            drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
+            drawWidth = SwingUtilities2.getTextUIDrawing(c)
+                    .getStringWidth(c, fontMetrics, aString);
             if (drawWidth > width) {
                 drawWidth = width;
             }
             startX = x + (width - drawWidth) / 2;
         } else if (justification == RIGHT) {
-            drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
+            drawWidth = SwingUtilities2.getTextUIDrawing(c)
+                    .getStringWidth(c, fontMetrics, aString);
             if (drawWidth > width) {
                 drawWidth = width;
             }
             startX = x + width - drawWidth;
         } else {

@@ -133,11 +135,12 @@
             delta = 0;
         }
 
         startY = y + height - delta - fontMetrics.getDescent();
 
-        SwingUtilities2.drawString(c, g, aString, startX, startY);
+        SwingUtilities2.getTextUIDrawing(c)
+                .drawString(c, g, aString, startX, startY);
     }
 
   /**
    * This method is not being used to paint menu item since
    * 6.0 This code left for compatibility only. Do not use or

@@ -252,26 +255,28 @@
                 int mnemIndex = b.getDisplayedMnemonicIndex();
 
                 if(!model.isEnabled()) {
                     // *** paint the text disabled
                     g.setColor(b.getBackground().brighter());
-                    SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
+                    SwingUtilities2.getTextUIDrawing(c).drawStringUnderlineCharAt(b, g,text,
                         mnemIndex,
                         textRect.x, textRect.y + fmAccel.getAscent());
                     g.setColor(b.getBackground().darker());
-                    SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
+                    SwingUtilities2.getTextUIDrawing(c).
+                            drawStringUnderlineCharAt(b, g,text,
                         mnemIndex,
                         textRect.x - 1, textRect.y + fmAccel.getAscent() - 1);
 
                 } else {
                     // *** paint the text normally
                     if (model.isArmed()|| (c instanceof JMenu && model.isSelected())) {
                         g.setColor(foreground);
                     } else {
                         g.setColor(b.getForeground());
                     }
-                    SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
+                    SwingUtilities2.getTextUIDrawing(c)
+                            .drawStringUnderlineCharAt(b, g,text,
                                                   mnemIndex,
                                                   textRect.x,
                                                   textRect.y + fm.getAscent());
                 }
             }

@@ -295,24 +300,24 @@
 
             g.setFont( UIManager.getFont("MenuItem.acceleratorFont") );
             if(!model.isEnabled()) {
                 // *** paint the acceleratorText disabled
                 g.setColor(b.getBackground().brighter());
-                SwingUtilities2.drawString(c, g,acceleratorText,
+                SwingUtilities2.getTextUIDrawing(c).drawString(c, g,acceleratorText,
                                               acceleratorRect.x - accOffset, acceleratorRect.y + fm.getAscent());
                 g.setColor(b.getBackground().darker());
-                SwingUtilities2.drawString(c, g,acceleratorText,
+                SwingUtilities2.getTextUIDrawing(c).drawString(c, g,acceleratorText,
                                               acceleratorRect.x - accOffset - 1, acceleratorRect.y + fm.getAscent() - 1);
             } else {
                 // *** paint the acceleratorText normally
                 if (model.isArmed()|| (c instanceof JMenu && model.isSelected()))
                     {
                         g.setColor(foreground);
                     } else {
                         g.setColor(b.getForeground());
                     }
-                SwingUtilities2.drawString(c, g,acceleratorText,
+                SwingUtilities2.getTextUIDrawing(c).drawString(c, g,acceleratorText,
                                               acceleratorRect.x - accOffset,
                                               acceleratorRect.y + fmAccel.getAscent());
             }
         }
 

@@ -381,11 +386,12 @@
             acceleratorR.width = acceleratorR.height = 0;
             acceleratorText = "";
         }
         else {
             acceleratorR.width
-                = SwingUtilities2.stringWidth(c, fmAccel, acceleratorText);
+                = SwingUtilities2.getTextUIDrawing(c)
+                        .getStringWidth(c, fmAccel, acceleratorText);
             acceleratorR.height = fmAccel.getHeight();
         }
 
         /* Initialize the checkIcon bounds rectangle checkIconR.
          */
< prev index next >