• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JEditorPane nbsp handling error ?

 
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
 
Water proof donuts! Eat them while reading this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic