aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to set these style constants in JTextPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to set these style constants in JTextPane?" Watch "how to set these style constants in JTextPane?" New topic
Author

how to set these style constants in JTextPane?

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Hello Everybody,
I was trying to use JTextPane with the following StyleConstants:
1. LeftIndent
2. rightInent
3. FirstLineIndent
4. Alignemnt(center)
I was trying the following code but in vain. Can you please help me to achieve same?
regards,
Arun
Code:-
*********
arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Hi,
Can somebody help me to achieve this. I hope I am not asking such a stupid question. Pl atleast reply for this post, evenif this is very basic question.
regards,
Arun
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I got some of the indentation working by calling setLogicalStyle( Style ) on the JTextPane... I'll look for more documentation on how to set StyleConstants and post them...

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
I am still waiting some help for this. I hope it is not so tedious or is it such a basic question?
I would be highly obliged if some one can provide me a code snippet or same.

regards,
Arun
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Actually, I have found that there is a documented bug with the StyleConstants class... several of the constants have not been implemented, and thus don't affect the text. There's an article about it in the JDC on Sun's site, the bug and suggested fix are in Sun's bug database.

-Nate
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to set these style constants in JTextPane?