• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

problem with browser Listener in linux

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic