HI i guess this is rather a simple question, but Ido not get it. I used to place a startup dialog in the middle of the screen by asking for the display size. but with a dual head this places the dialog half on one screen half on the other. what would be a nice way to have a dialog centered on the primary screen ?
Thomas Kratz пишет:
> HI i guess this is rather a simple question, but Ido not get it. I
> used to place a startup dialog in the middle of the screen by asking
> for the display size. but with a dual head this places the dialog half
> on one screen half on the other. what would be a nice way to have a
> dialog centered on the primary screen ?
> public static void centre(Shell shell) {
> Rectangle bounds =
> shell.getDisplay().*getPrimaryMonitor()*.getBounds();
>
> shell.setLocation(
> bounds.width / 2 - shell.getSize().x / 2,
> bounds.height / 2 - shell.getSize().y / 2
> );
> }