我的applet将在IDE中运行,但不会在浏览器中运行。当" Next"它将打开但似乎没有在html文件中读入jEditorPane1。单击按钮。事实上当" Next"单击按钮,没有任何反应,但在IDE中运行正常。 这是方法代码:
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
if(fileNumber > 4){
fileNumber = 0;
}
java.net.URL helpURL = NewJFrame.class.getResource(
fileNumbers.get(fileNumber));
if (helpURL != null) {
try {
jEditorPane1.setPage(helpURL);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + helpURL);
}
} else {
System.err.println("Couldn't find file: file.html");
}
fileNumber++;
}
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
if(problemNumber>3){
problemNumber = 0;
}
fileNumbers = problems.get(problemNumber);
fileNumber =0;
java.net.URL helpURL = NewJFrame.class.getResource(
fileNumbers.get(fileNumber));
if (helpURL != null) {
try {
jEditorPane1.setPage(helpURL);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + helpURL);
}
} else {
System.err.println("Couldn't find file: file.html");
}
fileNumber++;
problemNumber++;
}