46 |
import java.awt.Graphics; |
import java.awt.Graphics; |
47 |
import java.awt.Insets; |
import java.awt.Insets; |
48 |
import java.awt.Shape; |
import java.awt.Shape; |
49 |
|
import java.awt.font.FontRenderContext; |
50 |
|
import java.awt.font.LineMetrics; |
51 |
|
import java.awt.geom.AffineTransform; |
52 |
|
|
53 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
54 |
|
|
610 |
case TOP: |
case TOP: |
611 |
case DEFAULT_POSITION: |
case DEFAULT_POSITION: |
612 |
default: |
default: |
613 |
textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent; |
textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent |
614 |
|
+ mes.lineHeight; |
615 |
break; |
break; |
616 |
|
|
617 |
case BELOW_TOP: |
case BELOW_TOP: |
1004 |
|
|
1005 |
m.textAscent = fmet.getAscent(); |
m.textAscent = fmet.getAscent(); |
1006 |
m.textDescent = fmet.getDescent(); |
m.textDescent = fmet.getDescent(); |
1007 |
|
|
1008 |
|
FontRenderContext frc = new FontRenderContext(new AffineTransform(), false, |
1009 |
|
false); |
1010 |
|
LineMetrics lmet = m.font.getLineMetrics(m.trimmedText, 0, |
1011 |
|
m.trimmedText.length(), frc); |
1012 |
|
m.lineHeight = (int) lmet.getStrikethroughOffset(); |
1013 |
|
// Fallback in case that LineMetrics is not available/working. |
1014 |
|
if (m.lineHeight == 0) |
1015 |
|
m.lineHeight = (int) (0.3333 * (double) m.textAscent); |
1016 |
|
|
1017 |
if (m.trimmedText != null) |
if (m.trimmedText != null) |
1018 |
m.textWidth = fmet.stringWidth(m.trimmedText) + 3; |
m.textWidth = fmet.stringWidth(m.trimmedText) + 3; |
1019 |
|
|
1086 |
*/ |
*/ |
1087 |
int textDescent; |
int textDescent; |
1088 |
|
|
1089 |
|
/** |
1090 |
|
* The number of pixels between the base line and the height where |
1091 |
|
* a strike-through would be drawn. |
1092 |
|
*/ |
1093 |
|
int lineHeight; |
1094 |
|
|
1095 |
/** |
/** |
1096 |
* The title text after removing leading and trailing white space |
* The title text after removing leading and trailing white space |