In my Java web browser, the javascript alert() is not working how to make it active?
Example:
package www;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.text.Document;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
public class HtmlEditorKitTest {
  public static void main(String[] args) {
    new HtmlEditorKitTest();
  }
  public HtmlEditorKitTest() {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        JEditorPane jEditorPane = new JEditorPane();
        jEditorPane.setEditable(false);
        JScrollPane scrollPane = new JScrollPane(jEditorPane);
        HTMLEditorKit kit = new HTMLEditorKit();
        jEditorPane.setEditorKit(kit);
        StyleSheet styleSheet = kit.getStyleSheet();
        styleSheet.addRule("body {color:#000; font-family:times; margin: 4px; }");
        styleSheet.addRule("h1 {color: blue;}");
        styleSheet.addRule("h2 {color: #ff0000;}");
        styleSheet.addRule("pre {font : 10px monaco; color : black; background-color : #fafafa; }");
        String htmlString = "<html>\n"
                          + "<body>\n"
                          + "<script>alert('Show Javascript works or not');</script>\n"
                          + "<h1>Welcome!</h1>\n"
                          + "<h2>H2 header</h2>\n"
                          + "<p>Text description</p>\n"
                          + "<p><a href=\"http://www.google.com/can/whynot?Oracle?/\">SiteOpen</a></p>\n"
                          + "</body>\n";
        Document doc = kit.createDefaultDocument();
        jEditorPane.setDocument(doc);
        jEditorPane.setText(htmlString);
        JFrame j = new JFrame("WebBrowser in Java");
        j.getContentPane().add(scrollPane, BorderLayout.CENTER);
        j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        j.setSize(new Dimension(300,200));
        j.setLocationRelativeTo(null);
        j.setVisible(true);
      }
    });
  }
}