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


Java Point类代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createTextWidget

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
protected void createTextWidget(String textContents) {
	StyledText styledText = new StyledText(getComposite(), SWT.NONE);
	styledText.setText(textContents);
	styledText.setFont(getCourierFont());
	styledText.setEditable(false);
	//styledText.setWordWrap(true);		// seems to throw size out-of-whack
	Point size = styledText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	getComposite().setContent(styledText);
	getComposite().setExpandHorizontal(true);
	getComposite().setExpandVertical(true);
	getComposite().setMinWidth(size.x);
	getComposite().setMinHeight(size.y);
	getComposite().getContent().addListener(SWT.KeyUp, getToolbarCommandHandler());

	getToolItem().setSelection(true);		
	setContentTypeAdapter(new StyledTextAdapter(styledText, getFileEntry().getFilename()));
}
 
开发者ID:marvinmalkowskijr,项目名称:applecommander,代码行数:18,代码来源:TextFilterAdapter.java

示例2: render

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final boolean hovered = mouse.isEntered();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final XVirtualCalendar calendar = model.getCalendar();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String t1 = this.type.text(theme, calendar);
	gc.setForeground(theme.getForeground(true, false, true));
	gc.setFont(theme.getBold()); final Point s1 = extent(gc, t1);
	gc.drawText(t1, x + 1 + ((w - s1.x) >> 1), y + 1 + ((h - s1.y) >> 1));
	
	if(this.type == XCalendarTime.HOUR || this.type == XCalendarTime.MINUTE) {
		String t2 = ":"; Point s2 = extent(gc, t2);
		gc.setBackground(theme.getBackground(true, false, false, false));
		gc.drawText(t2, x + 1 + w + (getMargin().x >> 2), y + 1 + ((h - s2.y) >> 1));
	}
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:28,代码来源:XCalendarTimeWidget.java

示例3: getInitialSize

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
protected Point getInitialSize() {
	IDialogSettings dialogSettings = getDialogSettings();
	if (dialogSettings == null) {
		/* no dialog settings available, so fall back to min settings */
		return new Point(minWidth, minHeight);
	}
	Point point = super.getInitialSize();
	if (point.x < minWidth) {
		point.x = minWidth;
	}
	if (point.y < minHeight) {
		point.y = minHeight;
	}
	return point;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:17,代码来源:AbstractFilterableTreeQuickDialog.java

示例4: createShell

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param arrayModificationHandler The ArrayModificationHandler the holds the represented array.
 * @param myDimension The dimension of a probably multidimensional array this Window represents.
 * @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of.
 */
private void createShell(ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Array Entries");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));

	// Initialize the composite.
	new ArrayEntriesComposite(this, this.shell, this.display, SWT.NONE, arrayModificationHandler, myDimension, dimensionsIndexes);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, this.parent.getShell());
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:22,代码来源:ArrayEntriesWindow.java

示例5: render

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
public void render ( final Graphics g, final Rectangle clientRectangle )
{
    if ( this.title == null || this.title.isEmpty () )
    {
        return;
    }

    g.setClipping ( this.rect );

    g.setFont ( createFont ( g.getResourceManager () ) );

    final Point size = g.textExtent ( this.title );

    final int x = this.rect.width / 2 - size.x / 2;
    final int y = this.padding;
    g.drawText ( this.title, this.rect.x + x, this.rect.y + y, null );

    g.setClipping ( clientRectangle );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:TitleRenderer.java

示例6: createShell

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param parentShell The parent windows' Shell.
 * @param className The name of the class to inspect.
 * @param classFile The ClassFile to inspect.
 */
private void createShell(Shell parentShell, String className, ClassFile classFile) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Class File Inspection");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));

	// No need to read it later, so it is not assigned to a variable.
	new ClassInspectionComposite(this, this.shell, this.display, SWT.NONE, className, classFile);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:22,代码来源:ClassInspectionWindow.java

示例7: computeSizeOfTextAndImages

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
private Point computeSizeOfTextAndImages() {
	int width = 0, height = 0;
	final boolean textISNotEmpty = getText() != null && !getText().equals("");

	if (textISNotEmpty) {
		final GC gc = new GC(this.parentBreadcrumb);
		gc.setFont(this.parentBreadcrumb.getFont());
		final Point extent = gc.stringExtent(getText());
		gc.dispose();
		width += extent.x;
		height = extent.y;
	}

	final Point imageSize = computeMaxWidthAndHeightForImages(getImage(),
			this.selectionImage, this.disabledImage);

	if (imageSize.x != -1) {
		width += imageSize.x;
		height = Math.max(imageSize.y, height);
		if (textISNotEmpty) {
			width += MARGIN * 2;
		}
	}
	width += MARGIN;
	return new Point(width, height);
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:27,代码来源:BreadcrumbItem.java

示例8: render

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * Render
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final boolean hovered = this.mouse.isEntered();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String text = trash_o;
	gc.setForeground(theme.getToolBarBackground(false));
	gc.setFont(Fonts.getAwesomeFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:21,代码来源:XCalendarClearWidget.java

示例9: createShell

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param parentShell The parent windows' Shell.
 * @param classLoader The system MugglClassLoader.
 */
private void createShell(Shell parentShell, MugglClassLoader classLoader) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Options");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));
	
	final Image small = new Image(shell.getDisplay(),
	        OptionsWindow.class.getResourceAsStream("/images/tray_small.png"));
	final Image large = new Image(shell.getDisplay(),
			OptionsWindow.class.getResourceAsStream("/images/tray_large.png"));
	this.shell.setImages(new Image[] { small, large });
	
	// No need to read it later, so it is not assigned to a variable.
	new OptionsComposite(this, this.shell, SWT.NONE, classLoader);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:27,代码来源:OptionsWindow.java

示例10: paintVerticalRuler

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * Handle paint requests for vertical ruler.
 */
protected void paintVerticalRuler(PaintEvent event) {
	// FIXME - not i18n safe!!
	String label = (disk.getBitmapLabels()[0] + "s").toUpperCase(); //$NON-NLS-1$
	if (disk.getBitmapLabels().length == 2) {
		label = (disk.getBitmapLabels()[1] + "s").toUpperCase(); //$NON-NLS-1$
	}
	StringBuffer buf = new StringBuffer();
	for (int i=0; i<label.length(); i++) {
		if (i>0) buf.append("\n"); //$NON-NLS-1$
		buf.append(label.charAt(i));
	}
	label = buf.toString();
	Canvas canvas = (Canvas) event.widget;
	Rectangle area = canvas.getClientArea();
	event.gc.drawLine(area.x + area.width/2, area.y, area.x + area.width/2, area.y + area.height);
	Point size = event.gc.textExtent(label);
	event.gc.drawText(label, area.x + area.width/2 - size.x/2, area.y + area.height/2 - size.y/2);
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:22,代码来源:DiskMapTab.java

示例11: obfuscatedImage

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
public Image obfuscatedImage(Image image) {
	Rectangle bounds = swtItem == null ? null : swtItem.getBounds();
	if ( bounds != null ){

		boolean isActive = swtItem.getParent().getSelection() == swtItem;
		boolean isHeaderVisible = swtItem.isShowing();

		Point location = Utils.getLocationRelativeToShell(swtItem.getParent());

		bounds.x += location.x;
		bounds.y += location.y;

		Map<String, Object> map = new HashMap<>();
		map.put("image", image);
		map.put("obfuscateTitle", false);
		if (isActive) {
			triggerEvent(UISWTViewEvent.TYPE_OBFUSCATE, map);

			if (viewTitleInfo instanceof ObfuscateImage) {
				((ObfuscateImage) viewTitleInfo).obfuscatedImage(image);
			}
		}

		if (isHeaderVisible) {
 			if (viewTitleInfo instanceof ObfuscateTab) {
 				String header = ((ObfuscateTab) viewTitleInfo).getObfuscatedHeader();
 				if (header != null) {
 					UIDebugGenerator.obfuscateArea(image, bounds, header);
 				}
 			}

 			if (MapUtils.getMapBoolean(map, "obfuscateTitle", false)) {
 				UIDebugGenerator.obfuscateArea(image, bounds);
 			}
		}
	}

	return image;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:41,代码来源:TabbedEntry.java

示例12: getToolTipBounds

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * 
 * Returns tooltip bounds
 * 
 * @return org.eclipse.swt.graphics.Rectangle
 */
public Rectangle getToolTipBounds(){
	Point tooltipSize = getToolTipWidthHeight();
	Rectangle bounds = new Rectangle(0, 0, tooltipSize.x, tooltipSize.y);
	logger.debug("tooltip bounds=" + bounds);
	return bounds;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:13,代码来源:PaletteToolTip.java

示例13: hideTabs

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
 * If there is just one page in the multi-page editor part,
 * this hides the single tab at the bottom.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void hideTabs() {
	if (getPageCount() <= 1) {
		setPageText(0, "");
		if (getContainer() instanceof CTabFolder) {
			((CTabFolder)getContainer()).setTabHeight(1);
			Point point = getContainer().getSize();
			getContainer().setSize(point.x, point.y + 6);
		}
	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:18,代码来源:SrmEditor.java

示例14: getSignedSelection

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
protected final IRegion getSignedSelection(ISourceViewer sourceViewer) {
	Point viewerSelection = sourceViewer.getSelectedRange();

	StyledText text = sourceViewer.getTextWidget();
	Point selection = text.getSelectionRange();
	if (text.getCaretOffset() == selection.x) {
		viewerSelection.x = viewerSelection.x + viewerSelection.y;
		viewerSelection.y = -viewerSelection.y;
	}

	return new Region(viewerSelection.x, viewerSelection.y);
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:13,代码来源:BashBracketsSupport.java

示例15: computeSize

import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
public Point computeSize(int wHint, int hHint) {
	if (!inSetSize && wHint > 0 && hHint == SWT.DEFAULT) {
		inSetSize = true;
		return super.computeSize(Utils.adjustPXForDPI(wHint), hHint);
	}
	return super.computeSize(wHint, hHint);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:9,代码来源:ShellFactory.java


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