Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Subclassing HTMLEditorKit

 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
How do I get JEditorPane (and its subclass JTextPane) to use my subclass of javax.swing.text.html.HTMLEditorKit instead of that last class? I need to override the method createDefaultDocument() to do doc.setAsynchronousLoadPriority(-1) instead of ...(4).
Thanks,
Tony
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never done this for replacing the handling of a standard type, but for a non-standard type, you do this:
myJEditorPaneInstance.setEditorKitForContentType("text/foo", myCustomEditorKitInstance);
before setting the content type or loading in a file. I'd try this first and see if it works -- I'd expect it to, but you never know, I guess.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,
Sounds good to me; I'll try it at work on Monday
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked, thanks!
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!