This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes setting character width gap between characters in jtextpane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setting character width gap between characters in jtextpane" Watch "setting character width gap between characters in jtextpane" New topic
Author

setting character width gap between characters in jtextpane

mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
hi all, just wondering if it is possible to set a space character's width when painted in a jtextpane?

this is because i want to draw a fat symbol on the space character


Website/Java Games: http://www.chitgoks.com
Tech Blog: http://tech.chitgoks.com
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

If the JTextPane (not jtextpane) has a HTMLDocument, you can use & n b s p ; (without the spaces) along with one (or flanked by two) normal space characters.

edit The nbsp is parsed even within code tags?


luck, db
There are no new questions, but there may be new answers.
mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
no. i dont want that. i actually am going to draw/paint a symbol to replace the space

im guessing you have to customize the View but if there is a way to set a space character's width without creating a custom View, that is what i am looking for
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Darryl Burke wrote: . . . The nbsp is parsed even within code tags?
I tried it and I had it parsed inside code tags too.
mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
this is what im following

http://java-sl.com/showpar.html

however, the middle dot is so small. i want to replace it with a bigger symbol
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

 

Simply escape the & with & when posting:  


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Stanislav Lapitsky
Ranch Hand

Joined: Dec 01, 2009
Posts: 53
It's possible by custom GlyphPainter. See for example http://java-sl.com/gp_effects.html
You can use the same approach to enlarge space only.
mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
thanks. will check this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting character width gap between characters in jtextpane
 
Similar Threads
Displaying all of the text in a JTextPane How???
Display character for HTML Number
How to get a tab character in a LJist or Jlabel?
Call a servlet on the url pattern /_/
Word wrapping long text without whitespaces