• Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing Special Characters, TAB, CR, etc  RSS feed

 
Chris Baty
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I'm designing a virtual keyboard in JAVA. My current challenge is printing out character representations of special characters, like the 'tab key', 'carrage return' and the 'shift key'. I was hoping to use standard characters, like up-arrow, down-arrow, etc, but I'm begining to think that they don't exist in JAVA. Is this correct?

I tried:

Thanks.
Chris
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure they exist in Java. Every character in the Unicode character set -- which is pretty much every character known to man -- exists in Java. You can find everything you ever wanted to know about them at http://unicode.org/.

But don't expect your console to support more than a tiny fraction of those characters. You would be better off using a GUI if you want to do that, or perhaps that was already your plan?
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably find chars < 0xff (I wrote 0xff rather than 255 because those numbers are intended to work in hexadecimal) are available on your console, but remember they will include things like (char) 0xa (= line feed) and (char) 0x1a (= end of file on DOS/Windows) so you may get peculiar results printing them to the command line.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!