1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
public class MyJLabelUI extends BasicLabelUI
{
private String mText = null;
public MyJLabelUI()
{
super();
}
protected String layoutCL(
JLabel label,
FontMetrics fontMetrics,
String text,
Icon icon,
Rectangle viewR,
Rectangle iconR,
Rectangle textR)
{
String textRevert = new StringBuilder(text).reverse().toString();
String lCompound = SwingUtilities.layoutCompoundLabel(
(JComponent) label,
fontMetrics,
textRevert,
icon,
label.getVerticalAlignment(),
label.getHorizontalAlignment(),
label.getVerticalTextPosition(),
label.getHorizontalTextPosition(),
viewR,
iconR,
textR,
label.getIconTextGap());
return (new StringBuilder(lCompound).reverse().toString());
}
} |
Partager