在SWT中,您可以使用getShell().getDisplay().getPrimaryMonitor().getClientArea();
final Display display = getShell().getDisplay();
final Monitor monitor = display.getPrimaryMonitor();
final Rectangle rect;
if (monitor != null) {
rect = monitor.getClientArea();
} else {
// In case we cannot find the primary monitor get the entire display rectangle
// Note that it may include the dimensions of multiple monitors.
rect = display.getBounds();
}
System.out.println("Monitor width=" + String.valueOf(rect.width));
System.out.println("Monitor height=" + String.valueOf(rect.height));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8394 次 |
| 最近记录: |