What’s the best way to insert statistics symbols in a JLabel
‘s text? For example, the x-bar? I tried assigning the text field the following with no success:
<html>x̄
Advertisement
Answer
Html codes will not work in Java. However, you can use the unicode escape in Java Strings
.
For example:
JLabel label = new JLabel(new String("u0304"));
Also, here is a cool website for taking Unicode text and turning it into Java String leterals.