本文整理了Java中org.eclipse.swt.widgets.Shell.setLocationInPixels()
方法的一些代码示例,展示了Shell.setLocationInPixels()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.setLocationInPixels()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:setLocationInPixels
暂无
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void center () {
if (parent == null) return;
Rectangle rect = getBoundsInPixels ();
Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
Rectangle monitorRect = parent.getMonitor ().getClientArea();
if (x + rect.width > monitorRect.x + monitorRect.width) {
x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
} else {
x = Math.max (x, monitorRect.x);
}
if (y + rect.height > monitorRect.y + monitorRect.height) {
y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
} else {
y = Math.max (y, monitorRect.y);
}
setLocationInPixels (x, y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void center () {
if (parent == null) return;
Rectangle rect = getBoundsInPixels ();
Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
if (x + rect.width > monitorRect.x + monitorRect.width) {
x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
} else {
x = Math.max (x, monitorRect.x);
}
if (y + rect.height > monitorRect.y + monitorRect.height) {
y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
} else {
y = Math.max (y, monitorRect.y);
}
setLocationInPixels (x, y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void center () {
if (parent == null) return;
Rectangle rect = getBoundsInPixels ();
Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
if (x + rect.width > monitorRect.x + monitorRect.width) {
x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
} else {
x = Math.max (x, monitorRect.x);
}
if (y + rect.height > monitorRect.y + monitorRect.height) {
y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
} else {
y = Math.max (y, monitorRect.y);
}
setLocationInPixels (x, y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void center () {
if (parent == null) return;
Rectangle rect = getBoundsInPixels ();
Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
if (x + rect.width > monitorRect.x + monitorRect.width) {
x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
} else {
x = Math.max (x, monitorRect.x);
}
if (y + rect.height > monitorRect.y + monitorRect.height) {
y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
} else {
y = Math.max (y, monitorRect.y);
}
setLocationInPixels (x, y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
setLocationInPixels(oldX, oldY);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
setLocationInPixels(oldX, oldY);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
setLocationInPixels(oldX, oldY);
内容来源于网络,如有侵权,请联系作者删除!