• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with browser Listener in linux  RSS feed

chakri bobby
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new too swt.
i am able to close the opened window after clicking the cancel button in the browser
but the same code is not working in linux window is not closing when i clicked cancel button in the browser.

could you please tell me how to close the window in linux

please find the below code

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.CloseWindowListener;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.browser.WindowEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;

public class test1 {
static String waitURL = "";
static String closeXTS;
public static void main(String[] args) {
Display display = new Display();

final Shell shell = new Shell(display);

final Browser browser = new Browser(shell, SWT.NONE);

browser.setUrl("C:\\test.jsp"); ///is for windows
browser.setUrl("/home/chakri/Desktop/test.jsp"); //is for linux
browser.addCloseWindowListener(new CloseWindowListener() {
public void close(WindowEvent event) {
Browser browser = (Browser)event.widget;
Shell shell = browser.getShell();
browser.addStatusTextListener(new StatusTextListener() {
public void changed(StatusTextEvent event) {
System.out.println("1111111" + event.text);

browser.addProgressListener(new ProgressListener() {
public void changed(ProgressEvent progressEvent) {
String jScript = "var ca = document.cookie;\n"
+ "window.status=ca;\n";

public void completed(ProgressEvent progressEvent) { //when the request is completed, process the response
String jScript1 = "var cancel = document.getElementById('cmdCancel');cancel.onclic k=closefix; function closefix(){window.close();} ";


while (!shell.isDisposed()) {
if (!display.readAndDispatch())

and jsp is





<INPUT id=cmdCancel type=button value=Cancel>



thanks in advance
Rob Camick
Ranch Hand
Posts: 2801
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Different forum, same old stuff:

1) Still not using "Code" tags

2) Cross posting: http://forums.sun.com/thread.jspa?threadID=5442083&tstart=0

Be Forthright When Cross Posting To Other Sites
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!