本文整理了Java中org.eclipse.swt.widgets.Monitor
类的一些代码示例,展示了Monitor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Monitor
类的具体详情如下:
包路径:org.eclipse.swt.widgets.Monitor
类名称:Monitor
[英]Instances of this class are descriptions of monitors.
[中]此类的实例是监视器的描述。
代码示例来源:origin: pentaho/pentaho-kettle
/**
* This method is needed in the case where the display has multiple monitors, but they do not form a uniform
* rectangle. In this case, it is possible for Geometry.moveInside() to not detect that the window is partially or
* completely clipped. We check to make sure at least the upper left portion of the rectangle is visible to give the
* user the ability to reposition the dialog in this rare case.
*
* @param constrainee
* @param display
* @return
*/
private boolean isClippedByUnalignedMonitors( Rectangle constrainee, Display display ) {
boolean isClipped;
Monitor[] monitors = display.getMonitors();
if ( monitors.length > 0 ) {
// Loop searches for a monitor proving false
isClipped = true;
for ( Monitor monitor : monitors ) {
if ( monitor.getClientArea().contains( constrainee.x + 10, constrainee.y + 10 ) ) {
isClipped = false;
break;
}
}
} else {
isClipped = false;
}
return isClipped;
}
代码示例来源:origin: pentaho/pentaho-kettle
Rectangle screenSize = display.getPrimaryMonitor().getBounds();
shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 );
closeButton.setFocus();
代码示例来源:origin: com.github.rinde/rinsim-example
shell.setLocation(primary.getClientArea().x, primary.getClientArea().y);
shell.setSize(primary.getClientArea().width,
primary.getClientArea().height);
final Button b = new Button(controlsComposite, SWT.CHECK);
b.setData(m);
final boolean isPrimary = m.equals(d.getPrimaryMonitor());
b.setText(i + " " + m.getBounds().width + "x" + m.getBounds().height
+ (isPrimary ? " PRIMARY" : ""));
b.setSelection(!isPrimary);
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns an array of monitors attached to the device.
*
* @return the array of monitors
*
* @since 1.2
*/
public Monitor[] getMonitors() {
checkDevice();
if( monitor == null ) {
monitor = new Monitor( this );
}
return new Monitor[] { monitor };
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
int /*long*/ monitorEnumProc (int /*long*/ hmonitor, int /*long*/ hdc, int /*long*/ lprcMonitor, int /*long*/ dwData) {
if (monitorCount >= monitors.length) {
Monitor[] newMonitors = new Monitor [monitors.length + 4];
System.arraycopy (monitors, 0, newMonitors, 0, monitors.length);
monitors = newMonitors;
}
MONITORINFO lpmi = new MONITORINFO ();
lpmi.cbSize = MONITORINFO.sizeof;
OS.GetMonitorInfo (hmonitor, lpmi);
Monitor monitor = new Monitor ();
monitor.handle = hmonitor;
Rectangle boundsInPixels = new Rectangle (lpmi.rcMonitor_left, lpmi.rcMonitor_top, lpmi.rcMonitor_right - lpmi.rcMonitor_left,lpmi.rcMonitor_bottom - lpmi.rcMonitor_top);
monitor.setBounds (DPIUtil.autoScaleDown (boundsInPixels));
Rectangle clientAreaInPixels = new Rectangle (lpmi.rcWork_left, lpmi.rcWork_top, lpmi.rcWork_right - lpmi.rcWork_left, lpmi.rcWork_bottom - lpmi.rcWork_top);
monitor.setClientArea (DPIUtil.autoScaleDown (clientAreaInPixels));
monitors [monitorCount++] = monitor;
return 1;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void updateSystemUIMode () {
if ((window.collectionBehavior() & OS.NSWindowCollectionBehaviorFullScreenPrimary) != 0) return;
if (!getMonitor ().equals (display.getPrimaryMonitor ())) return;
int mode = display.systemUIMode, options = display.systemUIOptions;
if (fullScreen) {
mode = OS.kUIModeAllHidden;
if (menuBar != null) {
mode = OS.kUIModeContentHidden;
}
options = 0;
}
int[] uiMode = new int[1], uiOptions = new int[1];
OS.GetSystemUIMode(uiMode, uiOptions);
if (uiMode[0] != mode || uiOptions[0] != options) OS.SetSystemUIMode (mode, options);
if (fullScreen) window.setFrame(fullScreenFrame, true);
}
代码示例来源:origin: rinde/RinSim
shell.setLocation(primary.getClientArea().x, primary.getClientArea().y);
shell.setSize(primary.getClientArea().width,
primary.getClientArea().height);
final Button b = new Button(controlsComposite, SWT.CHECK);
b.setData(m);
final boolean isPrimary = m.equals(d.getPrimaryMonitor());
b.setText(i + " " + m.getBounds().width + "x" + m.getBounds().height
+ (isPrimary ? " PRIMARY" : ""));
b.setSelection(!isPrimary);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
for (int i = 0; i < monitorCount; i++) {
OS.gdk_screen_get_monitor_geometry (screen, i, dest);
Monitor monitor = new Monitor ();
monitor.handle = i;
monitor.x = DPIUtil.autoScaleDown (dest.x);
Monitor monitor = new Monitor ();
Rectangle bounds = getBounds ();
monitor.x = bounds.x;
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
lpmi.cbSize = MONITORINFO.sizeof;
OS.GetMonitorInfo (hmonitor, lpmi);
Monitor monitor = new Monitor ();
monitor.handle = hmonitor;
Rectangle bounds = new Rectangle (lpmi.rcMonitor_left, lpmi.rcMonitor_top, lpmi.rcMonitor_right - lpmi.rcMonitor_left, lpmi.rcMonitor_bottom - lpmi.rcMonitor_top);
bounds = DPIUtil.autoScaleDown (bounds);
monitor.setBounds (bounds);
Rectangle clientArea = new Rectangle (lpmi.rcWork_left, lpmi.rcWork_top, lpmi.rcWork_right - lpmi.rcWork_left, lpmi.rcWork_bottom - lpmi.rcWork_top);
clientArea = DPIUtil.autoScaleDown (clientArea);
monitor.setClientArea (clientArea);
return monitor;
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
if (getMonitor().equals(display.getPrimaryMonitor ())) {
if (menuBar != null) {
double /*float*/ menuBarHt = NSStatusBar.systemStatusBar().thickness();
代码示例来源:origin: pentaho/pentaho-kettle
public static void setSize( Shell shell, int minWidth, int minHeight, boolean packIt ) {
PropsUI props = PropsUI.getInstance();
WindowProperty winprop = props.getScreen( shell.getText() );
if ( winprop != null ) {
winprop.setShell( shell, minWidth, minHeight );
} else {
if ( packIt ) {
shell.pack();
} else {
shell.layout();
}
// OK, sometimes this produces dialogs that are waay too big.
// Try to limit this a bit, m'kay?
// Use the same algorithm by cheating :-)
//
winprop = new WindowProperty( shell );
winprop.setShell( shell, minWidth, minHeight );
// Now, as this is the first time it gets opened, try to put it in the middle of the screen...
Rectangle shellBounds = shell.getBounds();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if ( shell.getParent() != null ) {
monitor = shell.getParent().getMonitor();
}
Rectangle monitorClientArea = monitor.getClientArea();
int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2;
int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2;
shell.setLocation( middleX, middleY );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
protected Splash( Display display, Shell splashShell ) throws KettleException {
log = new LogChannel( Spoon.APP_NAME );
Rectangle displayBounds = display.getPrimaryMonitor().getBounds();
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
for (int i = 0; i < monitorCount; i++) {
OS.gdk_screen_get_monitor_geometry (screen, i, dest);
Monitor monitor = new Monitor ();
monitor.handle = i;
monitor.x = DPIUtil.autoScaleDown (dest.x);
Monitor monitor = new Monitor ();
Rectangle bounds = getBounds ();
monitor.x = bounds.x;
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
checkDevice ();
if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
Monitor monitor = new Monitor();
int width = OS.GetSystemMetrics (OS.SM_CXSCREEN);
int height = OS.GetSystemMetrics (OS.SM_CYSCREEN);
Rectangle bounds = new Rectangle (0, 0, width, height);
bounds = DPIUtil.autoScaleDown (bounds);
monitor.setBounds (bounds);
RECT rect = new RECT ();
OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
Rectangle clientArea = new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
clientArea = DPIUtil.autoScaleDown (clientArea);
monitor.setClientArea( clientArea);
return monitor;
代码示例来源:origin: pentaho/pentaho-kettle
public static void setSize( Shell shell, int prefWidth, int prefHeight ) {
PropsUI props = PropsUI.getInstance();
WindowProperty winprop = props.getScreen( shell.getText() );
if ( winprop != null ) {
winprop.setShell( shell, prefWidth, prefHeight );
} else {
shell.layout();
winprop = new WindowProperty( shell.getText(), false, new Rectangle( 0, 0, prefWidth, prefHeight ) );
winprop.setShell( shell );
// Now, as this is the first time it gets opened, try to put it in the middle of the screen...
Rectangle shellBounds = shell.getBounds();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if ( shell.getParent() != null ) {
monitor = shell.getParent().getMonitor();
}
Rectangle monitorClientArea = monitor.getClientArea();
int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2;
int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2;
shell.setLocation( middleX, middleY );
}
}
代码示例来源:origin: stackoverflow.com
Monitor widgetMonitor = mTextWidget.getMonitor();
Rectangle monitorRect = widgetMonitor.getBounds();
if(monitorRect.x < 0){
// shown in left monitor, starting from the main monitor
}
if(monitorRect.x > monitorRect.width){
// shown in right monitor, starting from the main monitor
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
uiSession = ContextProvider.getUISession();
shells = new ArrayList<>();
monitor = new Monitor( this );
cursorLocation = new Point( 0, 0 );
bounds = readInitialBounds();
代码示例来源:origin: pentaho/pentaho-kettle
monitor = shell.getParent().getMonitor();
Rectangle monitorClientArea = monitor.getClientArea();
constrainRectangleToContainer( resizedRect, monitorClientArea );
代码示例来源:origin: rinde/RinSim
@Override
public void run() {
label.setText(monitor.getBounds().width + " x "
+ monitor.getBounds().height + "\n" + runner.getState());
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
for (int i = 0; i < monitorCount; i++) {
OS.gdk_screen_get_monitor_geometry (screen, i, dest);
Monitor monitor = new Monitor ();
monitor.handle = i;
monitor.x = DPIUtil.autoScaleDown (dest.x);
Monitor monitor = new Monitor ();
Rectangle bounds = getBounds ();
monitor.x = bounds.x;
内容来源于网络,如有侵权,请联系作者删除!