I have a renderer I've been using to draw a complex set of stuff onto a Graphics2D context, including rotated text using transforms and Graphics2D.drawString()
.
Now I want to see what it would take to draw stylized text, and it looks like it would be a quagmire, except that the JLabel class handles this nicely by itself if you use HTML e.g.:
<html>a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></html>
Which of the following is a simpler approach, and how do I get started down that path?
Use a JLabel to render text onto my Graphics2D context, emulating the way a JTable uses renderers by having a component like JLabel do the rendering. (which I tried doing, but I can't seem to get it to work; not sure what method to call -- paint() or paintComponents()? -- and not sure if it works with rotated graphics transforms)
Parse HTML or some other simplified formatting language (like the subset of TeX used by MATLAB for graphs) and continue using drawString(), but handle the formatting myself.