This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTextPane and Justified Paragraphs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextPane and Justified Paragraphs" Watch "JTextPane and Justified Paragraphs" New topic
Author

JTextPane and Justified Paragraphs

Stephan Bardubitzki
Greenhorn

Joined: Dec 26, 2005
Posts: 29
Hi all,

I have to display some formatted paragraphs in a JTextPane. Each paragraph should have a header in bold letters and following some justified text. I can change font style and color, but the justified alignment won't happen with this code:


Any suggestions to solve the task are highly appreciated.

Thanks in advance.
Stephan
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Stephan Bardubitzki
Greenhorn

Joined: Dec 26, 2005
Posts: 29
Thank you very much Craig, works like a charm.
Hmmm... the last line of the paragraph should be aligned left. Any ideas?
Sorry, I'm not very familiar with text components.

Stephan
 
Don't get me started about those stupid light bulbs.
 
subject: JTextPane and Justified Paragraphs