This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Displaying UniCode characters  RSS feed

 
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • 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: 21421
94
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!