// Get the resolution
Rectangle pDisplayBounds = getShell().getDisplay().getBounds();
// Set Width and Height(doesn't matter value)
nWidth = pDisplayBounds.width / 2;
nHeight = pDisplayBounds.height / 2;
// This formulae calculate the shell's Left ant Top
int nLeft = (pDisplayBounds.width - nMinWidth) / 2;
int nTop = (pDisplayBounds.height - nMinHeight) / 2;
// Set shell bounds,
getShell().setBounds(nLeft, nTop, nMinWidth, nMinHeight);
Rectangle pDisplayBounds = getShell().getDisplay().getBounds();
// Set Width and Height(doesn't matter value)
nWidth = pDisplayBounds.width / 2;
nHeight = pDisplayBounds.height / 2;
// This formulae calculate the shell's Left ant Top
int nLeft = (pDisplayBounds.width - nMinWidth) / 2;
int nTop = (pDisplayBounds.height - nMinHeight) / 2;
// Set shell bounds,
getShell().setBounds(nLeft, nTop, nMinWidth, nMinHeight);