JEditorPane:Como abrir arquivos html locais?

Eu estou fazendo uma aplicação que exibe uma ajuda em html.
O arquivo está no diretorio do projeto.
Estou tentando: JEditorPane tab= new JEditorPane();
tab.setEditable(false);
tab.setPage(“ajuda.htm”);
Mas, tah dando erro!!!
O que faço???me ajudem!!!

ei galera dar uma força!!!

Maryrose,
dei uma pesquisada na net e achei um fonte que pode te ajudar!!!

import javax.swing.*;
import java.awt.*;

public class DisplayHtml{

  public DisplayHtml(String urlString){
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container con = frame.getContentPane();

    JEditorPane jep = new JEditorPane();
    JScrollPane jsp = new JScrollPane(jep);
    con.add(jsp);

    jep.setContentType("text/html");
    try{
      jep.setPage(urlString);
    }
    catch (Exception e){
      e.printStackTrace();
    }

    frame.setBounds(50, 50, 600, 800);
    frame.setVisible(true);
  }

  public static void main(String[] args){
    String ustr = "http://homepage1.nifty.com/algafield/";

    if (args.length > 0){ // local file URL should begin with file://
      ustr = args[0];     // ex.  file:///root/mytest.html
    }                     // ex.  file://C:\mytest.html
    new DisplayHtml(ustr);
  }
}

Espero que tenha ajudado!!!

[]´s

Ela quer ler de um arquivo local. Isso é possível, e o modo mais fácil é a partir de um “resource”.

http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html

http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html

Já tentei usar:
Url ender= getClass().getResource(“ajuda.html”);
JEditorPane edit= new JEditorPane();
edit.setPage(ender);//não é aceito

não funciona!!!

Continuem mandando sugestões!!!
Agradeço!!!

JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
[color=red]java.net.URL helpURL = TextSamplerDemo.class.getResource(
“TextSamplerDemoHelp.html”);[/color]
if (helpURL != null) {
try {
editorPane.setPage(helpURL);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + helpURL);
}
} else {
System.err.println(“Couldn’t find file: TextSamplerDemoHelp.html”);
}

//Put the editor pane in a scroll pane.

Acho que o trecho no codigo acima vai me ajuda.
Depois que testar digo se funcionou ou não.

Obrigado Faiter e thingol

JScrollPane editorScrollPane = new JScrollPane(editorPane);
editorScrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
editorScrollPane.setPreferredSize(new Dimension(250, 145));
editorScrollPane.setMinimumSize(new Dimension(10, 10));

[color=blue][/color]

Obrigada, realmente funcionou!!!

Url ende= Aplicacao.class.getResource(“ajuda.html”);

JEditorPane edit= new JEditorPane(ende);

Opa pessoal… só um adendo à dúvida deste tópico, eu gostaria de abrir um arquivo html no browser padrão do sistema…

Existe algum comando em java pra isso?

[quote]
Opa pessoal… só um adendo à dúvida deste tópico, eu gostaria de abrir um arquivo html no browser padrão do sistema…

Existe algum comando em java pra isso?[/quote]

cara, tem sim:

try{
    Runtime.getRuntime().exec("C:/WINDOWS/system32/calc.exe");
}catch(Exception re){
    JOptionPane.showMessageDialog(null, "Seu computador não possui uma calculadora instalada!");
}

bruxo, faz tempo que não mecho nisso. ai em cima eu uso pra abrir a calc do rwindows, mas te digo q o caminho é esse mesmo ;)

Sei que o tópico é antigo mas usa algo assim cara:

     Windows:

           Runtime.getRuntime().exec("rundll32 SHELL32.DLL, ShellExec_RunDLL "+temp.getAbsolutePath());