有没有选项可以在JFace的MessageDialog中设置位置?

huangapple go评论67阅读模式
英文:

Is there any option to set position of MessageDialog in Jface?

问题

使用Jface的MessageDialogWithToggle.openYesNoQuestion()来弹出问题对话框。但是对话框没有弹出在应用程序的中心。

有没有办法让对话框显示在应用程序的中心?

英文:

I am using Jface MessageDialogWithToggle.openYesNoQuestion() to pop up the question dialog. But the dialog is not popping up in the center of the application.

Is there any way to make the dialog to display in the center of the application?

答案1

得分: 0

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

如果您想在其他外壳上居中显示,您将需要创建一个扩展MessageDialogWithToggle类的新类,并覆盖

protected Point getInitialLocation(Point initialSize)

方法以根据该外壳计算位置。

英文:

The dialog is normally shown centred on the parent shell you specify on the openYesNoQuestion method.

If you want to centre on some other shell you will have to create a new class extending MessageDialogWithToggle and override the

protected Point getInitialLocation(Point initialSize)

method to calculate the postion based on that shell.

huangapple
  • 本文由 发表于 2020年8月31日 17:47:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/63668474.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定