• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struck with Document Interface

 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to use Rich Text Capabilities in my application.I came to know that this can be achieved by using Document Interface(StyledDocument,DefaultStyledDocument) in javax.swing.text Package. I am new to this Document Interface can you guys guide me in this matter.

If you can point me where can i get more details about this interface. Where can i get a beginning material in this topic.I Searched for this in Google and ended up with nothing.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's StyledDocument you want to work with.

This interface has methods called "setCharacterAttributes" and "setParagraphAttributes". With these method, you can set attributes for a specific range of text (to be honest, I don't know the difference between the two).

Such attributes include boldness, foreground colors, background colors, fonts, etc.

You can create attributes as follows:

Check out the other StyleConstants methods.

To switch bold etc off, you explicitly have to turn it off in the attribute set, then set it. If it isn't explicitly turned to off nothing will change.
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Rob for the information you shared.

I will work it out and reply you back

 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic