运行它时,我在控制台中收到此错误消息。我哪里出错了?“显示 C:/Users/Nimit/Desktop/n.txt 时出错”
import java.io.IOException;
import javax.swing.*;
public class exmpleText
{
public static void main(String[] args)
{
String url = "C:/Users/Nimit/Desktop/n.txt";
try
{
JFrame frame=new JFrame("Hi");
JEditorPane Pane = new JEditorPane(url);
Pane.setEditable(false);
frame.add(new JScrollPane(Pane));
}
catch(IOException ioe)
{
System.err.println("Error displaying " + url);
}
}
}