< prev index next >
src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java
Print this page
@@ -251,11 +251,11 @@
// Draw the accelerator first in case the HTML renderer changes the color
if (keyString != null && !keyString.equals("")) {
final int yAccel = acceleratorRect.y + fm.getAscent();
if (modifiersString.equals("")) {
// just draw the keyString
- SwingUtilities2.drawString(c, g, keyString, acceleratorRect.x, yAccel);
+ SwingUtilities2.getTextUIDrawing(c).drawString(c, g, keyString, acceleratorRect.x, yAccel);
} else {
final int modifiers = accelerator.getModifiers();
int underlinedChar = 0;
if ((modifiers & ALT_GRAPH_MASK) > 0) underlinedChar = kUOptionGlyph; // This is a Java2 thing, we won't be getting kOptionGlyph
// The keyStrings should all line up, so always adjust the width by the same amount
@@ -264,17 +264,23 @@
if (leftToRight) {
g.setFont(acceleratorFont);
drawString(g, c, modifiersString, underlinedChar, acceleratorRect.x, yAccel, isEnabled, isSelected);
g.setFont(f);
- SwingUtilities2.drawString(c, g, keyString, acceleratorRect.x + acceleratorRect.width - emWidth, yAccel);
+ SwingUtilities2.getTextUIDrawing(c)
+ .drawString(c, g, keyString,
+ acceleratorRect.x + acceleratorRect.width - emWidth,
+ yAccel);
} else {
final int xAccel = acceleratorRect.x + emWidth;
g.setFont(acceleratorFont);
drawString(g, c, modifiersString, underlinedChar, xAccel, yAccel, isEnabled, isSelected);
g.setFont(f);
- SwingUtilities2.drawString(c, g, keyString, xAccel - fm.stringWidth(keyString), yAccel);
+ SwingUtilities2.getTextUIDrawing(c)
+ .drawString(c, g, keyString,
+ xAccel - fm.stringWidth(keyString),
+ yAccel);
}
}
}
// Draw the Text
@@ -423,11 +429,12 @@
if (uci == -1) index = lci;
else if (lci == -1) index = uci;
else index = (lci < uci) ? lci : uci;
}
- SwingUtilities2.drawStringUnderlineCharAt(c, g, text, index, x, y);
+ SwingUtilities2.getTextUIDrawing(c)
+ .drawStringUnderlineCharAt(c, g, text, index, x, y);
}
/*
* Returns false if the component is a JMenu and it is a top
* level menu (on the menubar).
< prev index next >