Using Superscript in the text displayed in JTable in Java Swing
Being new to Java Swing, I was wondering the other day if I could display a quantity value as for e.g. meter cube..i.e. m3.
I had to display the value in a JTable. The solution that I found finally was simple.
In my TableCellRenderer, I replaced
m3
by
< html >m< sup >3< / sup >< / html>
while setting the text in the JTable cell(by using setText(MYSTRING)), simply because we can use HTML in our “Strings” in Java.
Really Cool and How Simple!!