Skip to content Skip to sidebar Skip to footer

Hyperlinkupdate() Gives Me Nullpointerexception Every Time I Click A Hyperlink In The Jeditorpane?

I just want to add that the initial file loaded is a javadoc that has the names of all the classes, I want it to display the corresponding page for each class when I click on the h

Solution 1:

But where are you getting this NullPointerException?

I run your example code, and got NullPointerException on:

htmlPane.setPage(event.getURL());

so htmlPage field was null.

when added line:

this.htmlPane = htmlPane;

in:

publicvoidframe() {
    JFrameframe=newJFrame("asdd");
    JLabell=newJLabel("asdsada");
    try {
        JEditorPanehtmlPane=newJEditorPane(url);
        this.htmlPane = htmlPane;

I can now click on any link (in my case in "http://www.google.com/")

Post a Comment for "Hyperlinkupdate() Gives Me Nullpointerexception Every Time I Click A Hyperlink In The Jeditorpane?"