我已經做了一個簡單的JAVA程序來顯示一個HTML頁面。但我似乎無法獲得HTML頁面上的JAVA SCRIPT以在程序中工作。我用它來計算。如果我在瀏覽器中打開HTML頁面,它確實有效。有人可以幫助我如何讓它在我的JAVA程序中工作?JAVA程序顯示一個HTML頁面。 Javascript中的HTML不起作用
下面你會發現代碼。
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication16;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.io.FileReader;
/**
*
* @author chris
*/
public class JavaApplication16 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
String url = "http://members.multimania.nl/c75/";
JEditorPane editor = new JEditorPane("http://members.multimania.nl/c75/");
editor.setEditable(true);
JScrollPane pane = new JScrollPane(editor);
JFrame f = new JFrame("calculatie Program");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(pane);
f.setSize(800, 600);
f.setVisible(true);
}
}