本文整理了Java中org.eclipse.swt.graphics.Point
类的一些代码示例,展示了Point
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point
类的具体详情如下:
包路径:org.eclipse.swt.graphics.Point
类名称:Point
[英]Instances of this class represent places on the (x, y) coordinate plane.
The coordinate space for rectangles and points is considered to have increasing values downward and to the right from its origin making this the normal, computer graphics oriented notion of (x, y) coordinates rather than the strict mathematical one.
The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.
Application code does not need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no dispose()
method is provided.
[中]此类的实例表示(x,y)坐标平面上的位置。
矩形和点的坐标空间被认为从原点向下和向右具有递增的值,这使得这是正常的、面向计算机图形学的(x,y)坐标概念,而不是严格的数学概念。
此类中的hashCode()方法使用公共字段的值来计算哈希值。在散列集合中存储类的实例时,不要在插入对象后修改这些字段。
当不再需要每个实例时,应用程序代码不需要显式释放这些实例管理的资源,因此不提供dispose()
方法。
代码示例来源:origin: pentaho/pentaho-kettle
public void open() {
sShell = new Shell( parent, SWT.DIALOG_TRIM | SWT.NO_REDRAW_RESIZE | SWT.APPLICATION_MODAL );
sShell.setImage( GUIResource.getInstance().getImageSpoon() );
sShell.setText( strHeader );
sShell.setSize( new Point( 360, 126 ) );
FormLayout formLayout = new FormLayout();
sShell.setLayout( formLayout );
代码示例来源:origin: pentaho/pentaho-kettle
public JobGraph( Composite par, final Spoon spoon, final JobMeta jobMeta ) {
super( par, SWT.NONE );
shell = par.getShell();
this.log = spoon.getLog();
this.spoon = spoon;
mainComposite = new Composite( this, SWT.NONE );
mainComposite.setLayout( new FillLayout() );
toolbarFd.right = new FormAttachment( 100, 0 );
toolbarControl.setLayoutData( toolbarFd );
toolbarControl.setParent( this );
toolTip.setRespectDisplayBounds( true );
toolTip.setPopupDelay( 350 );
toolTip.setShift( new org.eclipse.swt.graphics.Point( ConstUI.TOOLTIP_OFFSET, ConstUI.TOOLTIP_OFFSET ) );
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
GC gc= new GC(fText);
gc.setFont(fTextFont);
int width= gc.getFontMetrics().getAverageCharWidth();
int height= fText.getLineHeight(); //https://bugs.eclipse.org/bugs/show_bug.cgi?id=377109
gc.dispose();
return new Point(widthInChars * width, heightInChars * height);
}
}
代码示例来源:origin: org.eclipse.egit/ui
@Override
protected Point getSize() {
Rectangle bounds = image.getBounds();
return new Point(bounds.width, bounds.height);
}
代码示例来源:origin: pentaho/pentaho-kettle
public void printImage( Shell sh, Image img ) {
if ( printerdata != null ) {
Rectangle imgbounds = img.getBounds();
Point max = new Point( imgbounds.width, imgbounds.height );
GC gc_printer = new GC( printer );
gc_printer.drawImage(
img, fromx, fromy, imx, imy, (int) page_left, (int) page_top, (int) printx, (int) printy );
System.out.println( "img dept = " + img.getImageData().depth );
System.out.println( "prn dept = " + printer.getDepth() );
System.out.println( "img size = ("
+ img.getBounds().x + "," + img.getBounds().y + ") : (" + img.getBounds().width + ","
+ img.getBounds().height + ")" );
System.out.println( "fromx="
gc_printer.dispose();
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
protected Point getInitialLocation(Point initialSize) {
if (getShell().getParent() == null) {
return super.getInitialLocation(initialSize);
}
Rectangle bounds = getShell().getParent().getMonitor().getBounds();
GC gc = new GC(getShell().getDisplay());
int textExtendX = gc.textExtent(message).x;
gc.dispose();
return new Point(bounds.x + bounds.width / 2 - textExtendX / 2, bounds.y + bounds.height / 5);
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
protected Point getInitialSize() {
return new Point( DIALOG_WIDTH, DIALOG_HEIGHT );
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.server.ui
public StatusLineLabel(Composite parent, int style) {
super(parent, style);
GC gc= new GC(parent);
gc.setFont(parent.getFont());
Point extent= gc.textExtent("MMMMMMMMM"); //$NON-NLS-1$
gc.dispose();
fFixedSize= new Point(extent.x + INDENT * 2, 10);
}
代码示例来源:origin: pentaho/pentaho-kettle
Display disp = parent.getDisplay();
TableView.dummyImage = new Image( disp, 1, 1 );
TableView.dummyGC = new GC( TableView.dummyImage );
TableView.dummyGC.setFont( gridFont );
if ( !shift && !control ) {
Rectangle clientArea = table.getClientArea();
Point pt = new Point( event.x, event.y );
int index = table.getTopIndex();
while ( index < table.getItemCount() ) {
代码示例来源:origin: rinde/RinSim
Image renderStatic() {
size = new org.eclipse.swt.graphics.Point((int) (m * viewRect.width),
(int) (m * viewRect.height));
final Image img = new Image(getDisplay(), size.x, size.y);
final GC gc = new GC(img);
for (final CanvasRenderer r : canvasRenderers) {
r.renderStatic(gc, new ViewPort(new Point(0, 0), viewRect, m));
}
gc.dispose();
return img;
}
代码示例来源:origin: org.eclipse.xtext/ui
@Override
protected Point getDefaultLocation(Point initialSize) {
Control textWidget = (Control) xtextEditor.getAdapter(Control.class);
Point size = textWidget.getSize();
Point popupLocation = new Point((size.x / 2) - (initialSize.x / 2), (size.y / 2) - (initialSize.y / 2));
return textWidget.toDisplay(popupLocation);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
Control[] children= composite.getChildren();
Point size= new Point(0, 0);
for (Control element : children) {
Point s= element.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
size.x += s.x;
size.y= Math.max(size.y, s.y);
}
size.x += (Math.max(0, children.length -1) * fGap);
return size;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
int SizeBrowserTo (int aCX, int aCY) {
size = new Point (aCX, aCY);
boolean isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
if (isChrome) {
Shell shell = browser.getShell ();
shell.setSize (shell.computeSize (size.x, size.y));
}
return XPCOM.NS_OK;
}
代码示例来源:origin: pentaho/pentaho-kettle
private boolean willLicenseTextFit( String licenseText, GC gc ) {
Point splashSize = splash.getSize();
Point licenseDrawLocation = new Point( 290, 290 );
Point requiredSize = gc.textExtent( licenseText );
int width = splashSize.x - licenseDrawLocation.x;
int height = splashSize.y - licenseDrawLocation.y;
boolean fitsVertically = width >= requiredSize.x;
boolean fitsHorizontally = height >= requiredSize.y;
return ( fitsVertically && fitsHorizontally );
}
代码示例来源:origin: angelozerr/jdt-codemining
@Override
public Point draw(GC gc, StyledText textWidget, Color color, int x, int y) {
Image image = getImage();
gc.drawImage(image, x, y + gc.getFontMetrics().getDescent());
Rectangle bounds = image.getBounds();
return new Point(bounds.width, bounds.height);
}
代码示例来源:origin: org.eclipse.pde.api.tools/ui
protected Point getSize() {
if (fSize == null) {
ImageData data = fOriginalImage.getImageData();
fSize = new Point(data.width, data.height);
}
return fSize;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
private Point getInitialDialogLocation( Point initialSize ) {
Rectangle dispayBounds = getShell().getDisplay().getBounds();
Point centerPoint = Geometry.centerPoint( dispayBounds );
int x = centerPoint.x - ( initialSize.x / 2 );
int y = Math.min( centerPoint.y - ( initialSize.y * 2 / 3 ),
dispayBounds.height - initialSize.y );
return new Point( x, Math.max( 0, y ) );
}
//RAPEND [if]
代码示例来源:origin: BiglySoftware/BiglyBT
public static Point getLocationRelativeToShell(Control control) {
Point controlLocation = control.toDisplay(0, 0);
Point shellLocation = control.getShell().getLocation();
return new Point(controlLocation.x - shellLocation.x, controlLocation.y - shellLocation.y);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public Point computeSizeHint() {
Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point constrains= getSizeConstraints();
if (constrains == null)
return preferedSize;
int trimWidth= getShell().computeTrim(0, 0, 0, 0).width;
Point constrainedSize= getShell().computeSize(constrains.x - trimWidth, SWT.DEFAULT, true);
int width= Math.min(preferedSize.x, constrainedSize.x);
int height= Math.max(preferedSize.y, constrainedSize.y);
return new Point(width, height);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
Point textExtentInPixels(String string, int flags) {
setString(string, flags);
checkGC(FONT);
if (data.stringWidth == -1) {
computeStringSize();
}
return new Point(data.stringWidth, data.stringHeight);
}
内容来源于网络,如有侵权,请联系作者删除!