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


Java Shell.setLocation方法代码示例

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


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

示例1: StartupSplashShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * create the startup splash shell and display it
 * @param display
 */
public StartupSplashShell(Display display){
	shell = new Shell(display, SWT.NO_TRIM);
	
	setupShell(); 				// place components in the main avoCADo shell
	
	shell.setText("avoCADo");
	shell.setBackgroundImage(ImageUtils.getIcon("./avoCADo-Splash.jpg", 360, 298));
	shell.setSize(360, 298);	//TODO: set intial size to last known size
	Rectangle b = display.getBounds();
	int xPos = Math.max(0, (b.width-360)/2);
	int yPos = Math.max(0, (b.height-298)/2);
	shell.setLocation(xPos, yPos);
	shell.setImage(ImageUtils.getIcon("./avoCADo.png", 32, 32));
	shell.open();
	
	// handle events while the shell is not disposed
	//while (!shell.isDisposed()) {
	//	if (!display.readAndDispatch())
	//		display.sleep();
	//}
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:26,代码来源:StartupSplashShell.java

示例2: AboutAvoCADoGPLShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * create the startup splash shell and display it
 * @param display
 */
public AboutAvoCADoGPLShell(Display display){
	shell = new Shell(display, SWT.PRIMARY_MODAL);
	
	setupShell(); 				// place components in the avoCADo license shell
	
	shell.setText("avoCADo GPLv2");
	shell.setSize(583, 350);	//TODO: set initial size to last known size
	Rectangle b = display.getBounds();
	int xPos = Math.max(0, (b.width-583)/2);
	int yPos = Math.max(0, (b.height-350)/2);
	shell.setLocation(xPos, yPos);
	shell.open();
	
	// handle events while the shell is not disposed
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:24,代码来源:AboutAvoCADoGPLShell.java

示例3: MainAvoCADoShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * create the main avoCADo shell and display it
 * @param display
 */
public MainAvoCADoShell(Display display){
	shell = new Shell(display);
	
	setupShell(); 				// place components in the main avoCADo shell
	
	shell.setText("avoCADo");
	shell.setSize(800, 600);	//TODO: set intial size to last known size
	shell.setMinimumSize(640, 480);
	Rectangle b = display.getBounds();
	int xPos = Math.max(0, (b.width-800)/2);
	int yPos = Math.max(0, (b.height-600)/2);
	shell.setLocation(xPos, yPos);
	shell.setImage(ImageUtils.getIcon("./avoCADo.png", 32, 32));
	shell.open();
	
	AvoGlobal.intializeNewAvoCADoProject(); // initialize app to starting model/view.
	
	StartupSplashShell.closeSplash();
			
	// handle events while the shell is not disposed
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:30,代码来源:MainAvoCADoShell.java

示例4: setCenterinParent

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void setCenterinParent(Shell parentshell, Shell shell) {
	int screenH = Toolkit.getDefaultToolkit().getScreenSize().height;
	int screenW = Toolkit.getDefaultToolkit().getScreenSize().width;
	int shellH = shell.getBounds().height;
	int shellW = shell.getBounds().width;
	// 如果窗口大小超过屏幕大小,调整为屏幕大小
	if (shellH > screenH) {
		shellH = screenH;
	}
	if (shellW > screenW) {
		shellW = screenW;
	}
	int targetx = parentshell.getLocation().x + parentshell.getBounds().width / 2 - shell.getBounds().width / 2;
	int targety = parentshell.getLocation().y + parentshell.getBounds().height / 2 - shell.getBounds().height / 2;
	if (targetx + shellW > screenW) {
		targetx = screenW - shellW;
	}
	if (targety + shellH > screenH) {
		targety = screenH - shellH;
	}
	shell.setLocation(targetx, targety);
}
 
开发者ID:cnldw,项目名称:APITools,代码行数:23,代码来源:PubUtils.java

示例5: setLocation

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * 
 */
protected void setLocation(final XCalendar popup) {
	//
	final Shell shell = popup.getShell();
	final Display display = popup.getDisplay();
	final Rectangle r1 = display.map(prevParent, null, prevBounds);
	final Rectangle r2 = popup.getMonitor().getClientArea(); // Client area
	
	//
	final int margin = 2;
	final Point size = shell.getSize();
	int x = r1.x, y = r1.y + r1.height + margin;
	if(y + size.y > r2.y + r2.height) y = r1.y - size.y - margin;
	if(x < r2.x) x = r2.x; else if(x + size.x > r2.x + r2.width) x = r2.x + r2.width - size.x;
	shell.setLocation(x, y);
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:19,代码来源:XCalendarDefaultLayout.java

示例6: center

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * Center the child shell within the parent shell window.
 */
public static void center(Shell parent, Shell child) {
	int x = parent.getLocation().x + 
		(parent.getSize().x - child.getSize().x) / 2;
	int y = parent.getLocation().y +
		(parent.getSize().y - child.getSize().y) / 2;
	if (x < 0) x = 0;
	if (y < 0) y = 0;
	child.setLocation(x,y);
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:13,代码来源:SwtUtil.java

示例7: setCenter

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void setCenter(Shell shell) {
	int screenH = Toolkit.getDefaultToolkit().getScreenSize().height;
	int screenW = Toolkit.getDefaultToolkit().getScreenSize().width;
	int shellH = shell.getBounds().height;
	int shellW = shell.getBounds().width;
	if (shellH > screenH) {
		shellH = screenH;
	}
	if (shellW > screenW) {
		shellW = screenW;
	}
	shell.setLocation(((screenW - shellW) / 2), ((screenH - shellH) / 2));
}
 
开发者ID:cnldw,项目名称:APITools,代码行数:14,代码来源:PubUtils.java

示例8: center

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
private void center(Shell shell) {

		Shell parent = (Shell) shell.getParent();
		Rectangle bounds = parent.getBounds();
		Point size = shell.getSize();

		int x = bounds.x + bounds.width / 2 - size.x / 2;
		int y = bounds.y + bounds.height / 2 - size.y / 2;
		// System.err.println("ChoiceDialog: center: x=" + x + " y=" + y);
		shell.setLocation(x, (y < 0) ? 0 : y);
	}
 
开发者ID:sergueik,项目名称:SWET,代码行数:12,代码来源:ChoicesDialog.java

示例9: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) {
	Shell shell = new Shell(new Display());
	shell.setSize(1200, 500);
	shell.setLayout(new GridLayout());
	shell.setLocation(100, 150);

	Figure root = new Figure();
	root.setFont(shell.getFont());
	//		XYLayout layout = new XYLayout();
	//		root.setLayoutManager(layout);

	org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(2,false);
	layout.horizontalSpacing = 100;
	root.setLayoutManager(layout);

	Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.white);
	canvas.setLayoutData(new GridData(GridData.FILL_BOTH));

	createDiagram(root);

	LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(root);

	Display display = shell.getDisplay();
	shell.open();
	while (!shell.isDisposed()) {
		while (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:33,代码来源:TestFigure.java

示例10: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) {
	Shell shell = new Shell(new Display());
	shell.setSize(1200, 500);
	shell.setLayout(new GridLayout());
	shell.setLocation(100, 150);
	
	Figure root = new Figure();
	root.setFont(shell.getFont());
	//		XYLayout layout = new XYLayout();
	//		root.setLayoutManager(layout);
	
	org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(2,false);
	layout.horizontalSpacing = 100;
	root.setLayoutManager(layout);
	
	Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.white);
	canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
	
	MatrixWidget widget = new MatrixWidget();
	MockArray array = new MockArray("int[]", new int[]{1,2,3}, new int[]{4,5,6}, new int[]{7,8,9}, new int[]{10,11,12});
	root.add(widget.createFigure(array));
	
	LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(root);
	
	Display display = shell.getDisplay();
	shell.open();
	while (!shell.isDisposed()) {
		while (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:35,代码来源:TestMatrixWidget.java

示例11: launchXMLTextContainerWindow

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * Launches the component property editor window for Unknown components. It is used to display XML content of Unknown
 * components on property window.
 * 
 * @return XML content of component. 
 */

public String launchXMLTextContainerWindow() {
	try{
		String xmlText = this.xmlText;
		Shell shell = new Shell(Display.getDefault().getActiveShell(), SWT.WRAP | SWT.MAX | SWT.APPLICATION_MODAL);

		shell.setLayout(new GridLayout(1, false));
		shell.setText("XML Content");
		shell.setSize(439, 432);
		text = new Text(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
		text.setEditable(false);
		text.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 250, 250, 250));
		if (this.xmlText != null) {
			xmlText = xmlText.substring(xmlText.indexOf('\n') + 1);
			xmlText = xmlText.substring(xmlText.indexOf('\n') + 1, xmlText.lastIndexOf('\n') - 13);

			text.setText(xmlText);
		} else
			text.setText(Messages.EMPTY_XML_CONTENT);
		GridData gd_text = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
		gd_text.widthHint = 360;
		gd_text.heightHint = 360;
		text.setLayoutData(gd_text);

		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.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!shell.getDisplay().readAndDispatch()) {
				shell.getDisplay().sleep();
			}
		}
	}catch(Exception e)
	{
		LOGGER.error("Error occurred while creating XML text container widget", e);
	}
	return getXmlText();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:52,代码来源:XMLTextContainer.java

示例12: center

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
/**
 * Shell
 */
public static void center(final Shell shell) {
    final Rectangle r1 = shell.getMonitor().getBounds(), r2 = shell.getBounds();
    shell.setLocation(r1.x + (r1.width - r2.width) / 2, r1.y + (r1.height - r2.height) / 2);
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:8,代码来源:SwtUtils.java


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