I have jFrame, many components there, jLabel too. I want set jLabel text not as string or through picture as icon. But as symbol (epsilon). Is that possible?
3 Answers
Sure. You can use a Unicode escape sequence for this. A lower-case epsilon is "\u03B5"
.
There are plenty of charts of Unicode escape sequences online, to help you find other symbols. There's also a really good tool at http://www.fileformat.info/info/unicode/ where you can search for a symbol by name, and see exactly how to insert it in your Java.
There are some excellent answers on Why does Java permit escaped unicode characters in the source code? that describe advantages of this approach.

- 1
- 1

- 77,785
- 15
- 98
- 110
-
1Or OP can probably just put an ε character in the code since java interpret source code as utf-8 IIRC. – Sylvain Defresne May 07 '14 at 19:19
-
Yes, if she can type it; and if she can guarantee that her IDE is set up to save files in UTF-8. I find using the escape sequence to be safer. You could post your suggestion as an answer though @SylvainDefresne – Dawood ibn Kareem May 07 '14 at 19:20
-
I was thinking too complicated. Such a simple solution I did not expect. Thanks – Dominika May 07 '14 at 19:24
You can easily add a picture for jLabel. Check this url: set Icon to a JLabel
Besides you can check this url too :Java: how to add image to Jlabel?
For your Problem: Just download the image epsilon(Any image according to the your requirement) and place it in a image folder, from that folder you can easily set the image for jlabel.

- 1
- 1

- 33
- 5