Salve galera,
Eu preciso abrir arquivos .html com funções em javascript em uma aplicação que estou desenvolvendo, com JEditorPane eu consigo abrir o HTML puro, mas as funções JavaScript não funcionam. Alguém tem alguma idéia de como fazê-lo?
meu código:
public class Browser extends JFrame{
private JEditorPane htmlPane;
private URL initialURL;
public Browser(URL initialURL) {
super("Simple Swing Browser");
this.initialURL = initialURL;
JPanel topPanel = new JPanel();
topPanel.setBackground(Color.lightGray);
getContentPane().add(topPanel, BorderLayout.NORTH);
try {
htmlPane = new JEditorPane(initialURL);
htmlPane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(htmlPane);
getContentPane().add(scrollPane, BorderLayout.CENTER);
} catch(IOException ioe) {
ioe.printStackTrace();
}
Dimension screenSize = getToolkit().getScreenSize();
int width = screenSize.width * 8 / 10;
int height = screenSize.height * 8 / 10;
setBounds(width/8, height/8, width, height);
setVisible(true);
}
}
vlw