// Center to parent frame or to screen
if (centerToParentFrame) {
frameD = frame.getSize();
framePos = frame.getLocation();
} else {
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();
// dual head, use first screen
if (ge.getScreenDevices().length > 1) {
try {
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration config = gd.getConfigurations()[0];
frameD = config.getBounds().getSize();
framePos = config.getBounds().getLocation();
} catch (RuntimeException e) {
frameD = Toolkit.getDefaultToolkit().getScreenSize();