blob: d246d426ebe0a4821ab9f30e070804c4cc5b8de6 [file] [log] [blame]
/*
* 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);
}
}