0

I have been trying to achieve the following :

I want to be able to paste a string of Unicode characters ex : without java showing them as being unrecognized. How do I make a Java JTextPane able to handle Unicode characters?

Alde
  • 428
  • 1
  • 5
  • 20
  • 1
    Java uses UTF-16 Unicode internally. If you are seeing characters as unrecognized it's because you are not using a Unicode capable font in your `JTextPane` – Jim Garrison May 22 '16 at 05:58

1 Answers1

1

If you want to use Unicode character you have to write it like this: \u[unicode]. So for example:

 JOptionPane.showMessageDialog(null, "\u2764Guess number", "game", JOptionPane.INFORMATION_MESSAGE);

would produce the folowing: ❤Guess number. I hope i answered your question.

Unknown
  • 108
  • 9