Check out java.text.AttributedString, which supports subscripts and more. e.g., in your paintComponent() you could go:
public void paintComponent(Graphics g) {
super.paintComponent(g);
AttributedString as = new AttributedString("I love you 104 gazillion");
as.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 13, 14);
as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 2, 6);
g.drawString(as.getIterator(), 20, 20);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…