📄 browser.java
字号:
* @since 3.0 */public void refresh() { checkWidget(); int[] rgdispid = auto.getIDsOfNames(new String[] { "Refresh" }); //$NON-NLS-1$ auto.invoke(rgdispid[0]);}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeCloseWindowListener(CloseWindowListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (closeWindowListeners.length == 0) return; int index = -1; for (int i = 0; i < closeWindowListeners.length; i++) { if (listener == closeWindowListeners[i]){ index = i; break; } } if (index == -1) return; if (closeWindowListeners.length == 1) { closeWindowListeners = new CloseWindowListener[0]; return; } CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length - 1]; System.arraycopy(closeWindowListeners, 0, newCloseWindowListeners, 0, index); System.arraycopy(closeWindowListeners, index + 1, newCloseWindowListeners, index, closeWindowListeners.length - index - 1); closeWindowListeners = newCloseWindowListeners;}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeLocationListener(LocationListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (locationListeners.length == 0) return; int index = -1; for (int i = 0; i < locationListeners.length; i++) { if (listener == locationListeners[i]){ index = i; break; } } if (index == -1) return; if (locationListeners.length == 1) { locationListeners = new LocationListener[0]; return; } LocationListener[] newLocationListeners = new LocationListener[locationListeners.length - 1]; System.arraycopy(locationListeners, 0, newLocationListeners, 0, index); System.arraycopy(locationListeners, index + 1, newLocationListeners, index, locationListeners.length - index - 1); locationListeners = newLocationListeners;}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeOpenWindowListener(OpenWindowListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (openWindowListeners.length == 0) return; int index = -1; for (int i = 0; i < openWindowListeners.length; i++) { if (listener == openWindowListeners[i]){ index = i; break; } } if (index == -1) return; if (openWindowListeners.length == 1) { openWindowListeners = new OpenWindowListener[0]; return; } OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length - 1]; System.arraycopy(openWindowListeners, 0, newOpenWindowListeners, 0, index); System.arraycopy(openWindowListeners, index + 1, newOpenWindowListeners, index, openWindowListeners.length - index - 1); openWindowListeners = newOpenWindowListeners;}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeProgressListener(ProgressListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (progressListeners.length == 0) return; int index = -1; for (int i = 0; i < progressListeners.length; i++) { if (listener == progressListeners[i]){ index = i; break; } } if (index == -1) return; if (progressListeners.length == 1) { progressListeners = new ProgressListener[0]; return; } ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length - 1]; System.arraycopy(progressListeners, 0, newProgressListeners, 0, index); System.arraycopy(progressListeners, index + 1, newProgressListeners, index, progressListeners.length - index - 1); progressListeners = newProgressListeners;}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeStatusTextListener(StatusTextListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (statusTextListeners.length == 0) return; int index = -1; for (int i = 0; i < statusTextListeners.length; i++) { if (listener == statusTextListeners[i]){ index = i; break; } } if (index == -1) return; if (statusTextListeners.length == 1) { statusTextListeners = new StatusTextListener[0]; return; } StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length - 1]; System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, index); System.arraycopy(statusTextListeners, index + 1, newStatusTextListeners, index, statusTextListeners.length - index - 1); statusTextListeners = newStatusTextListeners;}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeTitleListener(TitleListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (titleListeners.length == 0) return; int index = -1; for (int i = 0; i < titleListeners.length; i++) { if (listener == titleListeners[i]){ index = i; break; } } if (index == -1) return; if (titleListeners.length == 1) { titleListeners = new TitleListener[0]; return; } TitleListener[] newTitleListeners = new TitleListener[titleListeners.length - 1]; System.arraycopy(titleListeners, 0, newTitleListeners, 0, index); System.arraycopy(titleListeners, index + 1, newTitleListeners, index, titleListeners.length - index - 1); titleListeners = newTitleListeners;}/** * Removes the listener. * * @param listener the listener * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void removeVisibilityWindowListener(VisibilityWindowListener listener) { checkWidget(); if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (visibilityWindowListeners.length == 0) return; int index = -1; for (int i = 0; i < visibilityWindowListeners.length; i++) { if (listener == visibilityWindowListeners[i]){ index = i; break; } } if (index == -1) return; if (visibilityWindowListeners.length == 1) { visibilityWindowListeners = new VisibilityWindowListener[0]; return; } VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length - 1]; System.arraycopy(visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, index); System.arraycopy(visibilityWindowListeners, index + 1, newVisibilityWindowListeners, index, visibilityWindowListeners.length - index - 1); visibilityWindowListeners = newVisibilityWindowListeners;}/** * Renders HTML. * * @param html the HTML content to be rendered * * @return true if the operation was successful and false otherwise. * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the html is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @see #setUrl * * @since 3.0 */public boolean setText(String html) { checkWidget(); if (html == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); this.html = html; /* * Navigate to the blank page and insert the given html when * receiving the next DocumentComplete notification. See the * MSDN article "Loading HTML content from a Stream". * * Note. Stop any pending request. This is required to avoid displaying a * blank page as a result of consecutive calls to setUrl and/or setText. * The previous request would otherwise render the new html content and * reset the html field before the browser actually navigates to the blank * page as requested below. */ int[] rgdispid = auto.getIDsOfNames(new String[] { "Stop" }); //$NON-NLS-1$ auto.invoke(rgdispid[0]); /* Note. Internet Explorer can still fire DocumentComplete events from the previous * requests that were stopped. The DocumentComplete related to the blank page * will follow. The workaround is to verify the DocumentComplete event relates to * the blank page. */ rgdispid = auto.getIDsOfNames(new String[] { "Navigate", "URL" }); //$NON-NLS-1$ //$NON-NLS-2$ Variant[] rgvarg = new Variant[1]; rgvarg[0] = new Variant(ABOUT_BLANK); int[] rgdispidNamedArgs = new int[1]; rgdispidNamedArgs[0] = rgdispid[1]; Variant pVarResult = auto.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs); return pVarResult != null && pVarResult.getType() == OLE.VT_EMPTY;}/** * Loads a URL. * * @param url the URL to be loaded * * @return true if the operation was successful and false otherwise. * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the url is null</li> * </ul> * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @see #getUrl * * @since 3.0 */public boolean setUrl(String url) { checkWidget(); if (url == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); html = null; int[] rgdispid = auto.getIDsOfNames(new String[] { "Navigate", "URL" }); //$NON-NLS-1$ //$NON-NLS-2$ Variant[] rgvarg = new Variant[1]; rgvarg[0] = new Variant(url); int[] rgdispidNamedArgs = new int[1]; rgdispidNamedArgs[0] = rgdispid[1]; Variant pVarResult = auto.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs); return pVarResult != null && pVarResult.getType() == OLE.VT_EMPTY;}/** * Stop any loading and rendering activity. * * @exception SWTError <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> * </ul> * * @since 3.0 */public void stop() { checkWidget(); int[] rgdispid = auto.getIDsOfNames(new String[] { "Stop" }); //$NON-NLS-1$ auto.invoke(rgdispid[0]);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -