See the SWT.Selection listener below: import org.eclipse.swt.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.browser.*; import org.mozilla.interfaces.*;
public class Main { public static void main(String [] args) { Display display = new Display (); final Shell shell = new Shell (display); shell.setLayout(new RowLayout (SWT.VERTICAL)); final Browser browser; try { browser = new Browser (shell, SWT.MOZILLA); } catch (SWTError e) { System.out.println ("Could not instantiate Browser: " + e.getMessage ()); return; } browser.setLayoutData (new RowData (600,600)); browser.setUrl ("eclipse.org"); Button button = new Button (shell, SWT.PUSH); button.setText ("Find Next \"eclipse\""); button.addListener (SWT.Selection, new Listener () { public void handleEvent (Event event) { nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser (); if (webBrowser == null) { System.out.println ("Could not get the nsIWebBrowser from the Browser widget"); // see http://www.eclipse.org/swt/faq.php#howusejavaxpcom return; } nsIInterfaceRequestor requestor = (nsIInterfaceRequestor)webBrowser.queryInterface (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID); nsIWebBrowserFind find = (nsIWebBrowserFind)requestor.getInterface (nsIWebBrowserFind.NS_IWEBBROWSERFIND_IID); find.setSearchString ("eclipse"); find.findNext (); } }); shell.pack (); shell.open (); browser.setUrl ("http://eclipse.org"); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } } Grant <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there any way to get nsiWebBrowserFind interface from SWT browser > widget? _______________________________________________ dev-embedding mailing list dev-embedding@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-embedding