[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] GUIDE: how to center a JFace dialog
|
- From: Tan Nhu <eclipse@xxxxxxxx>
- Date: Wed, 20 Jul 2005 00:35:15 +0700
- Newsgroups: eclipse.platform.swt
- Organization: EclipseCorner
- User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
Just overloading initializeBounds() method in your class, like this:
protected void initializeBounds()
{
super.initializeBounds();
Shell shell = this.getShell();
Monitor primary = shell.getMonitor();
Rectangle bounds = primary.getBounds ();
Rectangle rect = shell.getBounds ();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation (x, y);
}
hope it can help :)