/* | |
* Copyright (c) Robert Bosch GmbH. All rights reserved. | |
*/ | |
package org.eclipse.blockchain.ui.util; | |
import org.eclipse.swt.graphics.Rectangle; | |
import org.eclipse.swt.widgets.Display; | |
import org.eclipse.swt.widgets.Shell; | |
/** | |
* @author ADG5COB | |
*/ | |
public class UIUtilities { | |
/** | |
* @param display - | |
* @param parent - | |
*/ | |
public static void moveShellToCenterOfScreen(final Display display, final Shell parent) { | |
Rectangle monitorBound = display.getPrimaryMonitor().getBounds(); | |
Rectangle shellBounds = parent.getBounds(); | |
int x = monitorBound.x + ((monitorBound.width - shellBounds.width) / 2); | |
int y = monitorBound.y + ((monitorBound.height - shellBounds.height) / 2); | |
parent.setLocation(x, y); | |
} | |
} |