Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » eclipse how to set the location of a window?
eclipse how to set the location of a window? [message #441275] Thu, 12 August 2004 23:38 Go to next message
Eclipse UserFriend
Originally posted by: baohuazhang.hotmail.com

everytime the window is popped up in a different location, can I set the
location of the window, for example to the center of the screen? Thanks!
Re: eclipse how to set the location of a window? [message #441278 is a reply to message #441275] Fri, 13 August 2004 01:49 Go to previous messageGo to next message
Eclipse UserFriend
To center a Shell I am using this method:

public static void centerShell(Display display, Shell shell) {
Rectangle displayBounds = display.getPrimaryMonitor().getBounds();
Rectangle shellBounds = shell.getBounds();
int x = displayBounds.x + (displayBounds.width - shellBounds.width) / 2;
int y = displayBounds.y + (displayBounds.height - shellBounds.height) /
2;
shell.setLocation(x, y);
}
Re: eclipse how to set the location of a window? [message #441402 is a reply to message #441275] Fri, 13 August 2004 12:54 Go to previous message
Eclipse UserFriend
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet120.html

"baohuazhang" <baohuazhang@hotmail.com> wrote in message
news:cfhd33$qfj$1@eclipse.org...
> everytime the window is popped up in a different location, can I set the
> location of the window, for example to the center of the screen? Thanks!
>
Previous Topic:Why doesn't my ToolBar show up
Next Topic:TreeEditor ' bugs on solaris?
Goto Forum:
  


Current Time: Sat Jul 12 12:35:20 EDT 2025

Powered by FUDForum. Page generated in 0.11912 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top