Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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] Fri, 13 August 2004 03: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 05:49 Go to previous messageGo to next message
Benjamin Pasero is currently offline Benjamin PaseroFriend
Messages: 337
Registered: July 2009
Senior Member
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 16:54 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
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: Fri Apr 26 13:26:11 GMT 2024

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

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

Back to the top