This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Subclassing  HTMLEditorKit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Subclassing  HTMLEditorKit" Watch "Subclassing  HTMLEditorKit" New topic
Author

Subclassing HTMLEditorKit

Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
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


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
Thanks,
Sounds good to me; I'll try it at work on Monday
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
It worked, thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Subclassing HTMLEditorKit
 
Similar Threads
HTMLEditorKIT
User Help - JEditorPane
HTMLEditorKit
pagination in jtextpane
Loading Webpage in JFrame