0

I need to show the function eAxn inside a JLabel, but trying to do so doesn't work and only shows as eAxn which is confusing. eAx^n could help, but that's not what I'm looking for.
Probably is because of the html version, or JLabels just dislike nested superscripts.
How else would you approach this for a JLabel?

Jedabero
  • 23
  • 1
  • 7
  • I stumbled upon a discussion about this in the [java-forums](http://www.java-forums.org/awt-swing/55491-sup-tag-doesnt-work-properly.html). They recommend using JavaFX components to do this, but that's just too much for what I have to do, I'll stick to eAx^n – Jedabero May 25 '13 at 22:27
  • See also this related [example](http://stackoverflow.com/a/7452088/230513). – trashgod May 25 '13 at 22:56

1 Answers1

1

For that specific case there exists a special-2 \u00b2.

<html>e<sup>0.5x²</sup>

The HTML editor kit, and styled text uses character attributes, which probably prevent nesting of <sup> tags. Maybe with <span style='...'> something can be done too.

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138