• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying UniCode characters

 
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm puzzling on how to have my screen output the actual character given by myChessPiece, rather than a '?'; Do I need to use Graphics2D and draw a string?


Related links
1. Unicode chart helper
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Windows XP console prompt uses a font that does not contain all Unicode characters. There are many characters that it cannot display. If you want to show these characters, you could indeed write a Swing application, making sure that you use a font which contains the characters that you want to display.
 
Jon Camilleri
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:The Windows XP console prompt uses a font that does not contain all Unicode characters. There are many characters that it cannot display. If you want to show these characters, you could indeed write a Swing application, making sure that you use a font which contains the characters that you want to display.



However I think I need to add something on to my JPanel, because on my screen it does not show the chess piece that I am expecting:




Sourced from Core Java Vol I (8th ed).
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It shows a little crown on my Windows 7 system. Can you create a screen shot of what it looks like for you?
 
Jon Camilleri
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:It shows a little crown on my Windows 7 system. Can you create a screen shot of what it looks like for you?



Sure here it is
scr.GIF
[Thumbnail for scr.GIF]
screenshot
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm blogging this right now. I totally need to get this article finished and published.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're not setting the font anywhere, so it is most likely still using a font that does not contain the Unicode character you are trying to display, so you get a square instead of the character.

Note that the Graphics object you are using inside the paintComponent method has a setFont() method. Make sure you use a font that contains the characters you want to display. Not all fonts contain all possible Unicode characters - in fact, most fonts contain only a small subset of all available Unicode characters.

Apparently the default font on Rob's Windows 7 system does contain the character, but the font on your Windows XP system does not.
reply
    Bookmark Topic Watch Topic
  • New Topic