Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

Loading local file in EditorPane

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)
{
//blah
});

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

Thanx.
0
Element115
Asked:
Element115
1 Solution
 
allahabadCommented:
help2Item.addActionListener(new ActionListener()
              {
              public void actionPerformed(ActionEvent ev)
              {
              JEditorPane displayPane = new JEditorPane() ;
              displayPane.setPage(demo.html );
              });
0
 
girionisCommented:
 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.
0
 
Element115Author Commented:
Well you forgot the try and catch, and "file://".  But it's close enough ;o)
setPage is what i was forgetting.

Cheers boss.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now