英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论