是否可以在Jface中设置MessageDialog的位置?

问题描述

我正在使用Jface MessageDialogWithToggle.openYesNoQuestion()弹出问题对话框。但是对话框并未在应用程序的中心弹出。

有什么方法可以使对话框显示在应用程序的中心?

解决方法

对话框通常显示在您在openYesNoQuestion方法中指定的父外壳的中心。

如果要以其他外壳为中心,则必须创建一个扩展MessageDialogWithToggle的新类并覆盖

protected Point getInitialLocation(Point initialSize)

基于该外壳计算位置的方法。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...