< prev index next >
src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java
Print this page
*** 111,127 ****
// throw new InconsistencyException("No metrics for Font " + font());
return;
}
if (justification == CENTER) {
! drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
if (drawWidth > width) {
drawWidth = width;
}
startX = x + (width - drawWidth) / 2;
} else if (justification == RIGHT) {
! drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
if (drawWidth > width) {
drawWidth = width;
}
startX = x + width - drawWidth;
} else {
--- 111,129 ----
// throw new InconsistencyException("No metrics for Font " + font());
return;
}
if (justification == CENTER) {
! drawWidth = SwingUtilities2.getTextUIDrawing(c)
! .getStringWidth(c, fontMetrics, aString);
if (drawWidth > width) {
drawWidth = width;
}
startX = x + (width - drawWidth) / 2;
} else if (justification == RIGHT) {
! drawWidth = SwingUtilities2.getTextUIDrawing(c)
! .getStringWidth(c, fontMetrics, aString);
if (drawWidth > width) {
drawWidth = width;
}
startX = x + width - drawWidth;
} else {
*** 133,143 ****
delta = 0;
}
startY = y + height - delta - fontMetrics.getDescent();
! SwingUtilities2.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
--- 135,146 ----
delta = 0;
}
startY = y + height - delta - fontMetrics.getDescent();
! 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,277 ****
int mnemIndex = b.getDisplayedMnemonicIndex();
if(!model.isEnabled()) {
// *** paint the text disabled
g.setColor(b.getBackground().brighter());
! SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
mnemIndex,
textRect.x, textRect.y + fmAccel.getAscent());
g.setColor(b.getBackground().darker());
! SwingUtilities2.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,
mnemIndex,
textRect.x,
textRect.y + fm.getAscent());
}
}
--- 255,282 ----
int mnemIndex = b.getDisplayedMnemonicIndex();
if(!model.isEnabled()) {
// *** paint the text disabled
g.setColor(b.getBackground().brighter());
! SwingUtilities2.getTextUIDrawing(c).drawStringUnderlineCharAt(b, g,text,
mnemIndex,
textRect.x, textRect.y + fmAccel.getAscent());
g.setColor(b.getBackground().darker());
! 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.getTextUIDrawing(c)
! .drawStringUnderlineCharAt(b, g,text,
mnemIndex,
textRect.x,
textRect.y + fm.getAscent());
}
}
*** 295,318 ****
g.setFont( UIManager.getFont("MenuItem.acceleratorFont") );
if(!model.isEnabled()) {
// *** paint the acceleratorText disabled
g.setColor(b.getBackground().brighter());
! SwingUtilities2.drawString(c, g,acceleratorText,
acceleratorRect.x - accOffset, acceleratorRect.y + fm.getAscent());
g.setColor(b.getBackground().darker());
! SwingUtilities2.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,
acceleratorRect.x - accOffset,
acceleratorRect.y + fmAccel.getAscent());
}
}
--- 300,323 ----
g.setFont( UIManager.getFont("MenuItem.acceleratorFont") );
if(!model.isEnabled()) {
// *** paint the acceleratorText disabled
g.setColor(b.getBackground().brighter());
! SwingUtilities2.getTextUIDrawing(c).drawString(c, g,acceleratorText,
acceleratorRect.x - accOffset, acceleratorRect.y + fm.getAscent());
g.setColor(b.getBackground().darker());
! 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.getTextUIDrawing(c).drawString(c, g,acceleratorText,
acceleratorRect.x - accOffset,
acceleratorRect.y + fmAccel.getAscent());
}
}
*** 381,391 ****
acceleratorR.width = acceleratorR.height = 0;
acceleratorText = "";
}
else {
acceleratorR.width
! = SwingUtilities2.stringWidth(c, fmAccel, acceleratorText);
acceleratorR.height = fmAccel.getHeight();
}
/* Initialize the checkIcon bounds rectangle checkIconR.
*/
--- 386,397 ----
acceleratorR.width = acceleratorR.height = 0;
acceleratorText = "";
}
else {
acceleratorR.width
! = SwingUtilities2.getTextUIDrawing(c)
! .getStringWidth(c, fmAccel, acceleratorText);
acceleratorR.height = fmAccel.getHeight();
}
/* Initialize the checkIcon bounds rectangle checkIconR.
*/
< prev index next >