471,851 Members | 851 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,851 software developers and data experts.

How to get greek "mu"-symbol in JLabel-text?

42
Hi all!
I want a mu (the micro symbol) in the text property of a JLabel.
(I want to be able to display the unit micro-seconds as "mu"s...)
Can anyone help me with that, pretty please?
Oct 26 '07 #1
4 14549
r035198x
13,262 8TB
Hi all!
I want a mu (the micro symbol) in the text property of a JLabel.
(I want to be able to display the unit micro-seconds as "mu"s...)
Can anyone help me with that, pretty please?
Open the API specs for the JLabel class (first hit on google if you search for "JLabel.java 6"). You will see the constructor which takes a String and also the setText method.
Oct 26 '07 #2
MimiMi
42
Thanks for answering and sorry for not being clear enough. The question should have been "How do I get a greek "mu"-symbol in a java string?"
I already knew how to set a JLabel text, that wasn't the problem, but anyhow thank you for taking the time to answer, that was nice of you!

Found out the answer myself. This is really what I wanted:
Expand|Select|Wrap|Line Numbers
  1. String microSeconds = "\u00B5"+"s";
  2.  microSecondsjLabel.setText(microSeconds);
Oct 26 '07 #3
JosAH
11,448 Expert 8TB
Found out the answer myself. This is really what I wanted:
Expand|Select|Wrap|Line Numbers
  1. String microSeconds = "\u00B5"+"s";
  2.  microSecondsjLabel.setText(microSeconds);
Good; put this link in your bookmarks. That
site shows all codepoints for all available characters.

kind regards,

Jos
Oct 26 '07 #4
I see you found the answer there are 2 ways I know of:
In this example I want to show the degree celcius symbol in the label:

1) using html codes (note the <HTML> tag in front of the label
JLabel label = new JLabel("<HTML>Temperature &deg;C");

2) using unicode (the same as you have already found)
JLabel label = new JLabel("Temperature \u00B0C");

I personally think the html version is more readable.
Oct 11 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Yannick Turgeon | last post: by
4 posts views Thread by Phil Powell | last post: by
3 posts views Thread by Sean Berry | last post: by
7 posts views Thread by James Johnson | last post: by
5 posts views Thread by Lakesider | last post: by
4 posts views Thread by Kurt Mueller | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.