Wednesday, September 9, 2009

Disabling close button in SWT shell window

Below snippet of code can be used in a SWT dialog box to disable the close button on window.

//disabling the close button
dialogShell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
e.doit = false;


  1. Hi Abeish Babu..

    This is sudheer.
    I used your code to disable the window close button.It is working fine at the level only.

    And one more thing when i want to close the window in programatic maner it means when we write a button and that to be perform the event(close the window).It won't work.
    thank for your code...