我有一个扩展org.eclipse.jface.dialogs.Dialog
类的类。我创建了一个自定义对话框,因此需要删除其默认的“确定”取消按钮,为此我重写一个父类(super class)方法来执行此操作,如下所示。
protected Button createButton(Composite arg0, int arg1, String arg2, boolean arg3)
{
//Retrun null so that no default buttons like 'OK' and 'Cancel' will be created
return null;
}
一切都很好,现在我观察到删除“确定”取消按钮后,shell 中留下了一个默认区域。
我尝试了很多但没有被删除,我所做的所有更改都反射(reflect)了这一点。 所以请告诉我出了什么问题。
最佳答案
您可以重写 createButtonBar()
并简单地返回 null
,而不是重写 createButton()
,这样就不会出现空的情况对话框底部的按钮栏:
@Override
protected Control createButtonBar(Composite parent)
{
/* You don't want a button bar, so just return null */
return null;
}
关于java - 删除 swt 对话框中的默认对话框区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25484831/