Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)

ZoomService allows you to register ZoomListener for receiving Zoom change events. Every time when zoom level for a specified web page has been changed, the onZoomChanged event will be fired: (ZoomService允许您注册ZoomListener以接收缩放更改事件。每次更改指定网页的缩放级别时,都会触发onZoomChanged事件:)

// Listen to zoom changed events
ZoomService zoomService = browser.getContext().getZoomService();
zoomService.addZoomListener(new ZoomListener() {
    public void onZoomChanged(ZoomEvent event) {
        System.out.println("event.getURL() = " + event.getURL());
        System.out.println("event.getZoomLevel() = " + event.getZoomLevel());