org.eclipse.swt.graphics.Rectangle.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.eclipse.swt.graphics.Rectangle.<init>方法的一些代码示例,展示了Rectangle.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.<init>方法的具体详情如下:
包路径:org.eclipse.swt.graphics.Rectangle
类名称:Rectangle
方法名:<init>

Rectangle.<init>介绍

[英]Construct a new instance of this class given the x, y, width and height values.
[中]给定x、y、width和height值,构造此类的新实例。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public WindowProperty( String name, boolean maximized, int x, int y, int width, int height ) {
 this.name = name;
 this.maximized = maximized;
 this.rectangle = new Rectangle( x, y, width, height );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Rectangle Real2Screen( Rectangle r ) {
 return new Rectangle( r.x + offsetx, r.y + offsety, r.width, r.height );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Rectangle Screen2Real( Rectangle r ) {
 return new Rectangle( r.x - offsetx, r.y - offsety, r.width, r.height );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Rectangle getAndNotSize( GC gc ) {
 Point p = gc.textExtent( Condition.operators[Condition.OPERATOR_AND_NOT] );
 return new Rectangle( 0, 0, p.x, p.y );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Rectangle getUpSize( GC gc ) {
 Point p = gc.textExtent( STRING_UP );
 return new Rectangle( size_not.x + size_not.width + 40, size_not.y, p.x + 20, size_not.height );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Rectangle getNotSize( GC gc ) {
 Point p = gc.textExtent( STRING_NOT );
 return new Rectangle( 0, 0, p.x + 10, p.y + 4 );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Rectangle getAddSize( GC gc ) {
 Rectangle is = imageAdd.getBounds(); // image size
 Rectangle cs = getBounds(); // Canvas size
 return new Rectangle( cs.width - is.width - 5 - X_PADDING, 5, is.width, is.height );
}

代码示例来源:origin: pentaho/pentaho-kettle

public static void setSize( Shell shell, int prefWidth, int prefHeight ) {
 PropsUI props = PropsUI.getInstance();
 WindowProperty winprop = props.getScreen( shell.getText() );
 if ( winprop != null ) {
  winprop.setShell( shell, prefWidth, prefHeight );
 } else {
  shell.layout();
  winprop = new WindowProperty( shell.getText(), false, new Rectangle( 0, 0, prefWidth, prefHeight ) );
  winprop.setShell( shell );
  // Now, as this is the first time it gets opened, try to put it in the middle of the screen...
  Rectangle shellBounds = shell.getBounds();
  Monitor monitor = shell.getDisplay().getPrimaryMonitor();
  if ( shell.getParent() != null ) {
   monitor = shell.getParent().getMonitor();
  }
  Rectangle monitorClientArea = monitor.getClientArea();
  int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2;
  int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2;
  shell.setLocation( middleX, middleY );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

String operator = condition.getOperatorDesc();
 size_oper[nr] = new Rectangle( opx, opy, opw, oph );
 if ( nr == hover_operator ) {
  gc.setBackground( gray );
size_cond[nr] = new Rectangle( cx, cy, cw, ch );

代码示例来源:origin: pentaho/pentaho-kettle

public void paintControl( final PaintEvent event ) {
  if ( transGraph.trans != null && transGraph.trans.isFinished() ) {
   refreshImage( event.gc );
   if ( image != null && !image.isDisposed() ) {
    event.gc.drawImage( image, 0, 0 );
   }
  } else {
   Rectangle bounds = canvas.getBounds();
   if ( bounds.width <= 0 || bounds.height <= 0 ) {
    return;
   }
   event.gc.setForeground( GUIResource.getInstance().getColorWhite() );
   event.gc.setBackground( GUIResource.getInstance().getColorWhite() );
   event.gc.fillRectangle( new Rectangle( 0, 0, bounds.width, bounds.height ) );
   event.gc.setForeground( GUIResource.getInstance().getColorBlack() );
   String metricsMessage =
    BaseMessages.getString( PKG, "TransMetricsDelegate.TransformationIsNotRunning.Message" );
   org.eclipse.swt.graphics.Point extent = event.gc.textExtent( metricsMessage );
   event.gc.drawText( metricsMessage, ( bounds.width - extent.x ) / 2, ( bounds.height - extent.y ) / 2 );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void paintControl( PaintEvent event ) {
  if ( jobGraph.job != null && ( jobGraph.job.isFinished() || jobGraph.job.isStopped() ) ) {
   refreshImage( event.gc );
   if ( image != null && !image.isDisposed() ) {
    event.gc.drawImage( image, 0, 0 );
   }
  } else {
   Rectangle bounds = canvas.getBounds();
   if ( bounds.width <= 0 || bounds.height <= 0 ) {
    return;
   }
   event.gc.setForeground( GUIResource.getInstance().getColorWhite() );
   event.gc.setBackground( GUIResource.getInstance().getColorWhite() );
   event.gc.fillRectangle( new Rectangle( 0, 0, bounds.width, bounds.height ) );
   event.gc.setForeground( GUIResource.getInstance().getColorBlack() );
   String metricsMessage = BaseMessages.getString( PKG, "JobMetricsDelegate.JobIsNotRunning.Message" );
   org.eclipse.swt.graphics.Point extent = event.gc.textExtent( metricsMessage );
   event.gc.drawText( metricsMessage, ( bounds.width - extent.x ) / 2, ( bounds.height - extent.y ) / 2 );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

size_left = new Rectangle( x + 5, y + size_not.height + 5, ext_left.x + 5, ext_left.y + 5 );
 new Rectangle( size_left.x + size_left.width + 15, y + size_not.height + 5, ext_fn.x + 5, ext_fn.y + 5 );
 new Rectangle( size_fn.x + size_fn.width + 15, y + size_not.height + 5, ext_rval.x + 5, ext_rval.y + 5 );
 new Rectangle(
  size_fn.x + size_fn.width + 15, y + size_not.height + 5 + size_rightval.height + 5, ext_rex.x + 5,
  ext_rex.y + 5 );

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public Rectangle getBounds() {
  if (bounds == null) {
    return new Rectangle(0, 0, 0, 0);
  }
  return new Rectangle(bounds.x + marginWidth, bounds.y + marginHeight,
      bounds.width - (marginWidth * 2), bounds.height - (marginHeight * 2));
}

代码示例来源:origin: BiglySoftware/BiglyBT

public void setPosition(int x, int y) {
  if (area == null) {
    area = new Rectangle(x, y, 0, 0);
    return;
  }
  area.x = x;
  area.y = y;
}

代码示例来源:origin: BiglySoftware/BiglyBT

public Rectangle getBoundsRaw() {
  if (bounds == null) {
    return null;
  }
  return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public Rectangle getBounds() {
  //TableViewPainted view = (TableViewPainted) getView();
  //Rectangle clientArea = view.getClientArea();
  return new Rectangle(0, drawOffset.y, 9990, getHeight());
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

private Rectangle getCaretRectangle(int offset) {
  Point location= fContentAssistSubjectControlAdapter.getLocationAtOffset(offset);
  Control subjectControl= fContentAssistSubjectControlAdapter.getControl();
  Point controlSize= subjectControl.getSize();
  constrainLocation(location, new Point(0, 0), new Rectangle(0, 0, controlSize.x, controlSize.y));
  location= subjectControl.toDisplay(location);
  Rectangle subjectRectangle= new Rectangle(location.x, location.y, 1, fContentAssistSubjectControlAdapter.getLineHeight());
  return subjectRectangle;
}

代码示例来源:origin: BiglySoftware/BiglyBT

public Rectangle getDrawBounds() {
  TableViewPainted view = (TableViewPainted) getView();
  Rectangle clientArea = view.getClientArea();
  int offsetX = TableViewPainted.DIRECT_DRAW ? -clientArea.x : 0;
  Rectangle bounds = new Rectangle(offsetX, drawOffset.y - clientArea.y, 9990,
      getHeight());
  return bounds;
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void paintControl(PaintEvent e) {
    GC gc = e.gc;
    gc.setForeground( Colors.grey);
    Point size = engine_comp.getSize();
    gc.drawRectangle( new Rectangle( 0,  0, size.x-1, size.y-1 ));
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

protected Point getStackedLocation(Shell shell, Shell parent) {
  Point p= parent.getLocation();
  Point size= parent.getSize();
  p.x += size.x / 4;
  p.y += size.y;
  p= parent.toDisplay(p);
  Point shellSize= shell.getSize();
  Monitor monitor= getClosestMonitor(parent.getDisplay(), new Rectangle(p.x, p.y, 0, 0));
  Rectangle displayBounds= monitor.getClientArea();
  constrainLocation(p, shellSize, displayBounds);
  return p;
}

相关文章