2

当 JEditorPane 完成从 url 加载网页时,如何执行操作?这甚至可能吗?我无法在网上找到有关此的任何信息:s

谢谢你

4

1 回答 1

2

尝试使用 PropertyChangeListener:

JEditorPane html = new JEditorPane();
html.addPropertyChangeListener("page", this);
try
{
    html.setPage( new URL(webURL.getText()) );
}
catch(Exception exc)
{
    System.out.println(exc);
}

...

public void propertyChange(PropertyChangeEvent e)
{
    System.out.println("Page Loaded");
}

有一次,该事件将在加载初始页面之后但在加载所有子图像之前触发。但是我只是做了一个快速测试,它似乎在页面和图像加载后立即触发。

于 2010-06-24T14:36:29.573 回答