当用户实际单击链接时,我正在尝试处理BrowserField中的事件。
我研究了BrowserFieldListener,尝试了它的documentCreated()方法,但是当页面开始加载时,这给了我一个响应。我希望在用户单击browserField内的链接时触发。

我在这里想念什么?

最佳答案

覆盖ProtocolController的handleNavigationRequest()



ProtocolController controller = new ProtocolController(browserField) {
    public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {
         /*
         Here you get the redirection link using
           request.getURL()
         and do what you want to do
          */
      // to display url in browserfield use
      InputConnection inputConnection = handleResourceRequest(request);
      browserField.displayContent(inputConnection, request.getURL());

    }
};

browserField.getConfig().setProperty(BrowserFieldConfig.CONTROLLER, controller);

09-03 19:47