It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes is it possible to make some words of jtextarea as bold? 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 "is it possible to make some words of jtextarea as bold?" Watch "is it possible to make some words of jtextarea as bold?" New topic
Author

is it possible to make some words of jtextarea as bold?

sudheer kiran
Ranch Hand

Joined: Jun 26, 2008
Posts: 237

hi all,
i have a requirement where i need to put first word of the JTextArea in bold font.
i need to use only JTextArea as this is a table column header.any suggestions please.



thanks,

Sudheer
SCWCD, SCJP 5
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Switch to JTextPane instead. JTextArea only knows plain text. It takes a Document as its model. JTextPane take a StyledDocument which can be used to add style information like bold etc.

There are some drawbacks however. JTextPane misses some features JTextArea does have, like word wrapping.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sudheer kiran
Ranch Hand

Joined: Jun 26, 2008
Posts: 237

thanks prime thats very useful info.
 
Don't get me started about those stupid light bulbs.
 
subject: is it possible to make some words of jtextarea as bold?
 
Similar Threads
JTextArea, JEditorPane or JTextPane: which is better suited for my application?
JTextArea
xsl
JEditorPane .... ??
data saving question