• Post Reply Bookmark Topic Watch Topic
  • New Topic

Do we have Greek letters in Java??  RSS feed

 
Pomchi Bedi
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Do we have Greek letters in Java??I am creating a GUI using Java and I want to display a few equations in my GUI.Is there any way to do this???
thx,
Pomchi
 
Matt Hansen
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just need to use a font that supports those characters.
 
Karen Parker
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try using Unicode characters for this.
Try these URLs for some good info on using unicode in Java: http://www.sun.com/developers/gadc/faq/java/files/unicode.html#1.1 http://www.pccl.demon.co.uk/java/unicode.html
 
Pomchi Bedi
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matt & Karen,
Can you give me a simple example of how to do this??I have never done any such thing before.Infact in Java I never got a chance to play with fonts either.
I highly appreciate your prompt response.
Thanks
Pomchi
 
Karen Parker
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to find the unicode values for the specific characters you need (see www.unicode.org), but I will give you an example.
The unicode value for the Greek capital theta is 0398. To display this character in Java:

(where x and y are the coordinated at which you wish to draw the string)
This would display the string "This is theta: " followed by a theta symbol.
The "\u" basically tells Java to take the value of the next four characters in the string and convert them into a unicode character.
 
Pomchi Bedi
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Karen!!
I got it!
-Pomchi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!