Loading local file in EditorPane

Posted on 2003-03-18
Medium Priority
Last Modified: 2008-03-17
This is pathetically easy I know, but it's getting late here and I can think properly.

When I click on a menu item:

help2Item.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ev)

I want my JEditorPane to load a local html file called demo.html

Question by:Element115
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

allahabad earned 80 total points
ID: 8162365
help2Item.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent ev)
              JEditorPane displayPane = new JEditorPane() ;
              displayPane.setPage(demo.html );
LVL 35

Expert Comment

ID: 8162408
 Look here: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20282390.html . The answer you want is already given by Ovi at the end of the page.

Author Comment

ID: 8162418
Well you forgot the try and catch, and "file://".  But it's close enough ;o)
setPage is what i was forgetting.

Cheers boss.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month9 days, 6 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question