user13270936
user13270936

Reputation:

Opening displaying internal help (html) page

I can't seem to remember how to open and display an internal html help file (readable only).

I'm using Netbeans IDE 8.2 and have created a desktop pane with a menubar. When the user selects help from the help menu I want it to display it an internal frame displaying the html help file that I have added to my resources.

Within the menuHelpHelpActionPerformed I'm calling myHelpFile(). MyHelpFile:

    initialUrl = "C:\\Users\\Mike\\Documents\\NetBeansProjects\\IwtTest2\\src\\iwt\\Resoruces\\iwtHelp.html";

    try{
        html = new JEditorPane(initialUrl);
        html.setEditable(false);
        html.addHyperlinkListener((HyperlinkListener) this);
        scrollpane = new JScrollPane(html);
        getContentPane().add(html);

    }catch(IOException ioe){
        JOptionPane.showMessageDialog(null,"<html>OOPS! no file: <br></br></html>" + ioe);
    }

All that happens when I select help it only shows the message dialog. How can I fix this?

Upvotes: 0

Views: 40

Answers (1)

user13270936
user13270936

Reputation:

Resolved: From following an example from Core Java 2 advanced feature by Cay S. Horstmann & Gary Cornell (example 6-15) I was able to achieve what I wanted:

animated gif showing solution

Upvotes: 1

Related Questions