当前位置: 首页>>代码示例>>Java>>正文


Java Monitor.getBounds方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Monitor.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Monitor.getBounds方法的具体用法?Java Monitor.getBounds怎么用?Java Monitor.getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Monitor的用法示例。


在下文中一共展示了Monitor.getBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDialogArea

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent)
{
	parent.setBackgroundMode(SWT.INHERIT_DEFAULT);
	parent.setBackground(BTSUIConstants.VIEW_BACKGROUND_DESELECTED_COLOR);
	Composite control = createContentArea(parent);
	control.setData("org.eclipse.e4.ui.css.id", "LoginDialog");
	Rectangle controlRect = control.getBounds();

	// looks strange in multi monitor environments
	// Rectangle displayBounds = shell.getDisplay().getBounds();

	shell.getDisplay();
	Monitor primary = Display.getDefault().getPrimaryMonitor();
	Rectangle displayBounds = primary.getBounds();

	int x = (displayBounds.width - controlRect.width) / 2;
	int y = (displayBounds.height - controlRect.height) / 2;
	shell.setBounds(x, y, controlRect.width, controlRect.height);

	return control;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:LoginDialog.java

示例2: initShell

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
private void initShell() {
	shell = new Shell(Display.getCurrent(), SWT.APPLICATION_MODAL
			| SWT.SHEET);
	shell.setText("Feature-Expression Management Dialog");
	shell.setImage(VariantSyncPlugin.getDefault()
			.getImageDescriptor("icons/featureExpression.png")
			.createImage());
	shell.setSize(500, 485);

	GridLayout shellLayout = new GridLayout();
	shellLayout.marginWidth = 0;
	shellLayout.marginHeight = 0;
	shell.setLayout(shellLayout);

	Monitor primary = shell.getDisplay().getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();
	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;
	shell.setLocation(x, y);
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:22,代码来源:FeatureManagementDialog.java

示例3: getDisplayBounds

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
private Rectangle getDisplayBounds(final Point location) {

		Rectangle displayBounds;
		final Monitor[] allMonitors = _ownerControl.getDisplay().getMonitors();

		if (allMonitors.length > 1) {
			// By default present in the monitor of the control
			displayBounds = _ownerControl.getMonitor().getBounds();
			final Point p = new Point(location.x, location.y);

			// Search on which monitor the event occurred
			Rectangle tmp;
			for (final Monitor element : allMonitors) {
				tmp = element.getBounds();
				if (tmp.contains(p)) {
					displayBounds = tmp;
					break;
				}
			}

		} else {
			displayBounds = _ownerControl.getDisplay().getBounds();
		}

		return displayBounds;
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:27,代码来源:AnimatedToolTipShell.java

示例4: getDisplayBounds

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
public static Rectangle getDisplayBounds(final Control composite, final Point location) {

		Rectangle displayBounds;
		final Monitor[] allMonitors = composite.getDisplay().getMonitors();

		if (allMonitors.length > 1) {
			// By default present in the monitor of the control
			displayBounds = composite.getMonitor().getBounds();
			final Point p = new Point(location.x, location.y);

			// Search on which monitor the event occurred
			Rectangle tmp;
			for (final Monitor element : allMonitors) {
				tmp = element.getBounds();
				if (tmp.contains(p)) {
					displayBounds = tmp;
					break;
				}
			}

		} else {
			displayBounds = composite.getDisplay().getBounds();
		}

		return displayBounds;
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:27,代码来源:UI.java

示例5: configureShell

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
@Override
   protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText("JIsoCreator");
shell.setSize(800, 600);
shell.setImage(ImageUtils.getInstance().loadImage("iso.png"));

Monitor primary = Display.getCurrent().getPrimaryMonitor();
Rectangle bounds = primary.getBounds();
Rectangle rect = shell.getBounds();

int x = bounds.x + ((bounds.width - rect.width) / 2);
int y = bounds.y + ((bounds.height - rect.height) / 2);

shell.setLocation(x, y);
   }
 
开发者ID:Cavallinux,项目名称:jisocreator,代码行数:17,代码来源:MainWindow.java

示例6: center

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
private static Point center(Display display, Shell shell) {
	Monitor primary = display.getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();

	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;

	Point location = new Point(x, y);
	return location;
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:12,代码来源:ScrolledTextEx.java

示例7: center

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
/**
 * Centers the shell on the given monitor.
 *
 * @param shell
 * @param monitor
 */
public static void center(Shell shell, Monitor monitor) {
    Rectangle shellRect = shell.getBounds();
    Rectangle displayRect = monitor.getBounds();
    int x = (displayRect.width - shellRect.width) / 2;
    int y = (displayRect.height - shellRect.height) / 2;
    shell.setLocation(displayRect.x + x, displayRect.y + y);
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:14,代码来源:SWTUtil.java

示例8: center

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
public void center() {
	Monitor primary = Display.getCurrent().getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = getShell().getBounds();
	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;

	getShell().setLocation(x, y);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:10,代码来源:TrpMainWidgetView.java

示例9: centerShell

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
public static void centerShell(Shell shell) {
	Display display = shell.getDisplay();

	Monitor primary = display.getPrimaryMonitor();
    Rectangle bounds = primary.getBounds();
    Rectangle rect = shell.getBounds();
    
    int x = bounds.x + (bounds.width - rect.width) / 2;
    int y = bounds.y + (bounds.height - rect.height) / 2;
    
    shell.setLocation(x, y);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:13,代码来源:SWTUtil.java

示例10: setLocation

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
private void setLocation(Display display, Shell shell)
{
	Monitor monitor = display.getPrimaryMonitor();
	Rectangle monitorRect = monitor.getBounds();
	Rectangle shellRect = shell.getBounds();
	int x = monitorRect.x + (monitorRect.width - shellRect.width) / 2;
	int y = monitorRect.y + (monitorRect.height - shellRect.height) / 2;
	shell.setLocation(x, y);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:Login.java

示例11: getMonitorCenter

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
private Point getMonitorCenter(Shell shell)
{
	Monitor primary = shell.getDisplay().getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();
	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;
	return new Point(x, y);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:SplashScreenControllerImpl.java

示例12: initShell

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
/**
 * initializes the shell
 */
private void initShell() {
	shell = new Shell(Display.getCurrent(), SWT.APPLICATION_MODAL
			| SWT.SHEET);
	shell.setText(DEFAULT_DIALOG_TITLE);
	shell.setImage(VariantSyncPlugin.getDefault()
			.getImageDescriptor("icons/featureExpression.png")
			.createImage());
	shell.setSize(500, 585);

	GridLayout shellLayout = new GridLayout();
	shellLayout.marginWidth = 0;
	shellLayout.marginHeight = 0;
	shell.setLayout(shellLayout);

	Monitor primary = shell.getDisplay().getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();
	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;
	shell.setLocation(x, y);
	shell.addListener(SWT.Traverse, new Listener() {
		public void handleEvent(Event event) {
			if (event.detail == SWT.TRAVERSE_ESCAPE
					&& !adapter.isProposalPopupOpen()) {

				closeButtonPressEvent();

			}
		}
	});
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:35,代码来源:ConstraintDialog.java

示例13: initializeBounds

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
@Override
protected void initializeBounds() {
	super.initializeBounds();
	Shell shell = getShell();
	Monitor primary = shell.getMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();
	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;
	shell.setLocation(x, y);
}
 
开发者ID:evilwan,项目名称:raptor-chess-interface,代码行数:12,代码来源:IcsLoginDialog.java

示例14: getInitialLocation

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
@Override
protected Point getInitialLocation(Point initialSize) {
	Monitor primaryMonitor = Display.getDefault().getPrimaryMonitor();
	Rectangle bounds = primaryMonitor.getBounds();
	int x = bounds.x + (bounds.width) / 2 - getShell().getSize().x / 2;
	int y = bounds.y + (bounds.height) / 2 - getShell().getSize().y / 2;
	return new Point(x, y);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:9,代码来源:NoticeDialog.java

示例15: show

import org.eclipse.swt.widgets.Monitor; //导入方法依赖的package包/类
public void show(Rectangle r) {
	
	dialog = setDialogLayout();
	dialog.pack();
	
	UIUtil.setDialogDefaultFunctions(dialog);
	
	if (p.tags.size() > 0) {
		dialog.setSize(600, 400);
	} else {
		dialog.setSize(600, 300);
	}
	
	int timeout = PManager.getInstance().getInt(PreferenceConstants.P_ALERT_DIALOG_TIMEOUT);
	if (timeout > 0) {
		timer = new Timer(true);
		timer.schedule(new TimerTask() {
			public void run() {
				ExUtil.exec(dialog, new Runnable() {
					public void run() {
						close();
					}
				});
			}
		}, timeout * 1000);
	}
    
	Monitor primaryMonitor = display.getPrimaryMonitor ();
    Rectangle bounds = primaryMonitor.getBounds ();
    Rectangle rect = dialog.getBounds ();
    int x = bounds.x + (bounds.width - rect.width) / 2 ;
    int y = bounds.y + (bounds.height - rect.height) / 2 ;
    dialog.setLocation (x, y);
	dialog.open();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:36,代码来源:AlertNotifierDialog.java


注:本文中的org.eclipse.swt.widgets.Monitor.getBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。