I'm wondering if there's a way to do this in a "simple way" and maybe someone knows a solution:
I'm working with javax.swing.text.html.HTMLDocument class, but for some reason, at least 2 methods that I need are non-public, even so, I need to "override" them, to change a few things, but, in some way, I need to keep the HTMLDocument class because I'm using a lot of the package javax.swing.text.html...
So, what I first do, was create some MyHTMLDocument extends HTMLDocument, and tryed to override some methods... when that failed, I tried to solve it using reflection over some methods, but is not working.. so, being desesperated, I've "copy - paste all" HTMLDocument code as MyHTMLDocument, (extending HTMLDocument), change what I needed and put it on my own "javax.swing.text.html" package, and it seems to work for now, but...
...when I finally run it, I'm getting stuck on some "Illegal Access errors", when I call TagActions for example... and I'm getting frustrated...
please, if somebody could help me, I really appreciate it so much.
UPDATE:
Ok, let me clarify:
On the class javax.swing.text.html.HTMLDocument, you can find three methods:
public getReader(int pos)
public getReader(int pos, int pos, int popDepth, int pushDepth, HTML.Tag insertTag)
getReader(int pos, int pos, int popDepth, int pushDepth, HTML.Tag insertTag, boolean insertInsertTag)
the last one, is non public or protected.
Also, there is an inner-Class called HTMLReader and it has 3 constructors:
public HTMLReader(int offset)
public HTMLReader(int offset, int popDepth, int pushDepth, HTML.Tag insertTag)
HTMLReader(int offset, int popDepth, int pushDepth, HTML.Tag insertTag, boolean insertInsertTag, boolean insertAfterImplied, boolean wantsTrailingNewline)
again, the last one, is non public.
What I need to do is to call at least these 2 non-public from my custom class: public class MyHTMLDocument extends HTMLDocument{
} but I just dont know how to do it.. I even tryed with some reflection and it appears to work for methods, but I cant find a way to do the same for constructors... Thanks again.