• 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

Working out EditorKits for JTextPane

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I've ran into a problem as I build a small-time text editor. When I began this project, I had only a plain text editor in mind. I created a JTextPane and typed away. I then decided that I would like a rich text editor. So I did some research and applied the RTFEditorKit to the appropriate class that creates it. Before I did that however, I created a new set of menu options for font size, color, bold, italic, etc..I was able to to apply those styles to my plain text JTextPane. So I figured I needed to apply a "plain text" editor kit. I cannot see how to do that. I thought maybe the JTextPane would change its EditorKit dynamically from StyledEditorKit to RTFEditorKit. That doesn't appear to happen tho. getEditorKit() always shows as StyledEditorKit when it comes to that plain text JTextPane.

I am thinking about this in the wrong manner? I thought about just restricting the style menu's, therefore elimination any chance of a style being applied (showing it only for a rtf).

So, any ideas?
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic