• Post Reply Bookmark Topic Watch Topic
  • New Topic

Working out EditorKits for JTextPane

 
Kevin Kahl
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!