Disable the close button in the Java Jface dialog box?

How to disable the close button in the Java Jface dialog box (if possible, make it disappear completely)?

Solution

For an example of how to hide the close button in a dialog box, see here You only need to override the following methods:

protected void setShellStyle(int arg0){
    //Use the following not to show the default close X button in the title bar
    super.setShellStyle(SWT.TITLE);
}

Otherwise, override close () and return false to prevent closing

Update: Although the above code "solves" the problem at hand, it does not explain much and introduces a annoying error Please refer to Google's answer for a better version

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>