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


Java Shell.setBounds方法代码示例

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


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

示例1: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText("Limit chars logs");
	newShell.setSize(nWidth, nHeight);

	int nLeft = 0;
	int nTop = 0;

	Display display = newShell.getDisplay();

	Point pt = display.getCursorLocation();
	Monitor[] monitors = display.getMonitors();

	for (int i = 0; i < monitors.length; i++) {
		if (monitors[i].getBounds().contains(pt)) {
			Rectangle rect = monitors[i].getClientArea();

			if (rect.x < 0)
				nLeft = ((rect.width - nWidth) / 2) + rect.x;
			else
				nLeft = (rect.width - nWidth) / 2;

			if (rect.y < 0)
				nTop = ((rect.height - nHeight) / 2) + rect.y;
			else
				nTop = (rect.height - nHeight) / 2;

			break;
		}
	}

	newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:36,代码来源:LimitCharsLogsPreferenceDialog.java

示例2: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText("Parameters availables");
	newShell.setSize(nWidth, nHeight);

	int nLeft = 0;
	int nTop = 0;

	Display display = newShell.getDisplay();

	Point pt = display.getCursorLocation();
	Monitor[] monitors = display.getMonitors();

	for (int i = 0; i < monitors.length; i++) {
		if (monitors[i].getBounds().contains(pt)) {
			Rectangle rect = monitors[i].getClientArea();

			if (rect.x < 0)
				nLeft = ((rect.width - nWidth) / 2) + rect.x;
			else
				nLeft = (rect.width - nWidth) / 2;

			if (rect.y < 0)
				nTop = ((rect.height - nHeight) / 2) + rect.y;
			else
				nTop = (rect.height - nHeight) / 2;

			break;
		}
	}

	newShell.setBounds(nLeft, nTop, nWidth, nHeight);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:35,代码来源:CouchVariablesDialog.java

示例3: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
	public void configureShell(Shell newShell) {
		super.configureShell(newShell);
		
		newShell.setText(dialogTitle);	
		
		int nLeft = 0;
		int nTop = 0;
		 
		Display display = newShell.getDisplay();

//		// mods jmc 22/10/2013
//		nWidth = newShell.getSize().x;
//		nHeight = newShell.getSize().y;
		
		Point pt = display.getCursorLocation();
	    Monitor [] monitors = display.getMonitors();

	    for (int i= 0; i<monitors.length; i++) {
	          if (monitors[i].getBounds().contains(pt)) {
	             Rectangle rect = monitors[i].getClientArea();
	             
	             if (rect.x < 0)
	         		nLeft = ((rect.width - nWidth) / 2) + rect.x;
	             else
	         		nLeft = (rect.width - nWidth) / 2;

	             if (rect.y < 0)
	         		nTop = ((rect.height - nHeight) / 2) + rect.y;
	             else
	         		nTop = (rect.height - nHeight) / 2;
	             
	             break;
	          }
	    }

	    newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:39,代码来源:MyAbstractDialog.java

示例4: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText("Engine Log settings");
	newShell.setSize(nWidth, nHeight);

	int nLeft = 0;
	int nTop = 0;

	Display display = newShell.getDisplay();

	Point pt = display.getCursorLocation();
	Monitor[] monitors = display.getMonitors();

	for (int i = 0; i < monitors.length; i++) {
		if (monitors[i].getBounds().contains(pt)) {
			Rectangle rect = monitors[i].getClientArea();

			if (rect.x < 0)
				nLeft = ((rect.width - nWidth) / 2) + rect.x;
			else
				nLeft = (rect.width - nWidth) / 2;

			if (rect.y < 0)
				nTop = ((rect.height - nHeight) / 2) + rect.y;
			else
				nTop = (rect.height - nHeight) / 2;

			break;
		}
	}

	newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:36,代码来源:EnginePreferenceDialog.java

示例5: createCommentBoxShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
private void createCommentBoxShell(org.eclipse.swt.graphics.Rectangle commentBoxEditorBounds) {
	shell = new Shell(getParent(), SWT.NONE);
	shell.setBounds(commentBoxEditorBounds);
	GridLayout gl_shell = new GridLayout(1, false);
	gl_shell.verticalSpacing = 0;
	gl_shell.marginWidth = 0;
	gl_shell.marginHeight = 0;
	gl_shell.horizontalSpacing = 0;
	shell.setLayout(gl_shell);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:CommentBoxEditor.java

示例6: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
protected void configureShell(Shell shell) {
	shell.setText("Schema Viewer Preferences");
	shell.setImage(AvroSchemaEditorActivator.getImage(AvroSchemaEditorImages.CONFIGURE));		
	shell.setBounds(bounds);
	super.configureShell(shell);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:8,代码来源:SchemaViewerPreferencesDialog.java

示例7: performPostDialogCreation

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void performPostDialogCreation() {
	// mods jmc 26/07/2013
			
	int nWidth;
	int nHeight;
	int nLeft = 0;
	int nTop = 0;
	 
	Shell newShell = this.parentDialog.getShell();

	// mods jmc 22/10/2013
	nWidth = (int) (0.50 * newShell.getSize().x);
	nHeight = (int) (0.60 * newShell.getSize().y);
	Display display = newShell.getDisplay();
	
	Point pt = display.getCursorLocation();
    Monitor [] monitors = display.getMonitors();

    for (int i= 0; i<monitors.length; i++) {
          if (monitors[i].getBounds().contains(pt)) {
             Rectangle rect = monitors[i].getClientArea();
             
             if (rect.x < 0)
         		nLeft = ((rect.width - nWidth) / 2) + rect.x;
             else
         		nLeft = (rect.width - nWidth) / 2;

             if (rect.y < 0)
         		nTop = ((rect.height - nHeight) / 2) + rect.y;
             else
         		nTop = (rect.height - nHeight) / 2;
             
             break;
          }
    }

    newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	
	super.performPostDialogCreation();
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:42,代码来源:SqlQueryEditorComposite.java

示例8: openFilesMiniView

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
private void openFilesMiniView(DownloadManager dm, TableCell cell) {
	Shell shell = ShellFactory.createShell(Utils.findAnyShell(), SWT.SHELL_TRIM);

	FillLayout fillLayout = new FillLayout();
	fillLayout.marginHeight = 2;
	fillLayout.marginWidth = 2;
	shell.setLayout(fillLayout);

	Rectangle bounds = ((TableCellSWT) cell).getBoundsOnDisplay();
	bounds.y += bounds.height;
	bounds.width = 630;
	bounds.height = (16 * dm.getNumFileInfos()) + 60;
	Rectangle realBounds = shell.computeTrim(0, 0, bounds.width, bounds.height);
	realBounds.width -= realBounds.x;
	realBounds.height -= realBounds.y;
	realBounds.x = bounds.x;
	realBounds.y = bounds.y;
	if (bounds.height > 500) {
		bounds.height = 500;
	}
	shell.setBounds(realBounds);
	shell.setAlpha(230);

	Utils.verifyShellRect(shell, true);


	final FilesView view = new FilesView(false);
	view.dataSourceChanged(dm);

	view.initialize(shell);

	Composite composite = view.getComposite();
	//composite.setLayoutData(null);
	//shell.setLayout(new FillLayout());

	view.viewActivated();
	view.refresh();

	final UIUpdatable viewUpdater = new UIUpdatable() {
		@Override
		public void updateUI() {
			view.refresh();
		}

		@Override
		public String getUpdateUIName() {
			return view.getFullTitle();
		}
	};
	UIUpdaterSWT.getInstance().addUpdater(viewUpdater);

	shell.addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent e) {
			UIUpdaterSWT.getInstance().removeUpdater(viewUpdater);
			view.delete();
		}
	});

	shell.layout(true, true);


	shell.setText(dm.getDisplayName());

	shell.open();
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:67,代码来源:ColumnFileCount.java

示例9: copyToClipBoard

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
void copyToClipBoard() {
	Composite item = viewer;
	Point p = viewer.computeSize(SWT.DEFAULT, SWT.DEFAULT);

	Rectangle size = item.getClientArea();

	System.out.println(p +  "    " + size);
	//			compositeViewer.setBackground(Constants.HIGHLIGHT_COLOR);
	GC gc = new GC(item);
	//			Rectangle clipping2 = gc.getClipping();
	//			Image img = new Image(Display.getDefault(), size.width, size.height);
	//			gc.copyArea(img, 0, 0);
	//			ImageData imageData = img.getImageData();

	RGB[] rgb = new RGB[256];
	// build grey scale palette: 256 different grey values are generated. 
	for (int i = 0; i < 256; i++) {
		rgb[i] = new RGB(i, i, i);
	}

	// Construct a new indexed palette given an array of RGB values.
	PaletteData palette = new PaletteData(rgb);
	Image img2 = new Image(Display.getDefault(), new ImageData(size.width, size.height, 8, palette));
	//			gc.setClipping(0, 0, p.x, p.y);
	gc.copyArea(img2, 0, 0);
	Shell popup = new Shell(Display.getDefault());
	popup.setText("Image");
	popup.setBounds(50, 50, 200, 200);
	Canvas canvas = new Canvas(popup, SWT.NONE);
	canvas.setBounds(img2.getBounds());
	canvas.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent e) {
			e.gc.drawImage(img2, 0, 0);
		}
	});
	popup.open();
	Clipboard clipboard = new Clipboard(Display.getDefault());
	clipboard.setContents(new Object[]{img2.getImageData()}, new Transfer[]{ ImageTransfer.getInstance()}); 
	img2.dispose();
	gc.dispose();
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:42,代码来源:FrameView.java


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