This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JEditorPane nbsp handling error ?  RSS feed

 
Albert Kam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi people,

I've found a weird problem that spins my head (daily story of my office life ). I want to use JEditorPane to show a simple HTML with monospace font. But the problem occurs when the bold tag encloses the & nbsp ;, the spacing seems not to be a fixed width anymore. Please try my code below :


When i run this on my eclipse, jdk1.4.2_15, linux suse 10.2, the line that is bold has different margin with the second line. It seems that the nbsp special character is not made monospaced if wrapped with bold tag. If the bold tag is removed, everything is fine.

At first, i thought this could be the font problem im using, so i changed in the source code from :

into this :


I think is what i want because Lucida Sans Typewriter is available in the JVM without additional font installation required. The result : The spacing width is allright, but instead of spaces, the line that is bold has small boxes instead.

Any ideas to solve this matter ?

Cheers,
Albert Kam

[ February 19, 2008: Message edited by: Albert Kam ]
[ February 19, 2008: Message edited by: Albert Kam ]
 
Albert Kam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone tried out my code ? How's the output on your side ?
Helpp
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!