< prev index next >
src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java
Print this page
*** 251,261 ****
// 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);
} 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
--- 251,261 ----
// 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.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,280 ****
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);
} 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);
}
}
}
// Draw the Text
--- 264,286 ----
if (leftToRight) {
g.setFont(acceleratorFont);
drawString(g, c, modifiersString, underlinedChar, acceleratorRect.x, yAccel, isEnabled, isSelected);
g.setFont(f);
! 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.getTextUIDrawing(c)
! .drawString(c, g, keyString,
! xAccel - fm.stringWidth(keyString),
! yAccel);
}
}
}
// Draw the Text
*** 423,433 ****
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);
}
/*
* Returns false if the component is a JMenu and it is a top
* level menu (on the menubar).
--- 429,440 ----
if (uci == -1) index = lci;
else if (lci == -1) index = uci;
else index = (lci < uci) ? lci : uci;
}
! 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 >