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


Java GC.fillRectangle方法代码示例

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


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

示例1: drawButtonDeepDown

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawButtonDeepDown(GC gc, String text, int textAlign,
      Image image, int imageAlign, int x, int y, int w, int h) {
    Display display = Display.getCurrent();
    gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
    gc.drawLine(x, y, x + w - 2, y);
    gc.drawLine(x, y, x, y + h - 2);
    gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
    gc.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
    gc.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    gc.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
    gc.drawLine(x + w - 2, y + h - 2, x + w - 2, y + 1);
    //
gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
gc.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(x + 2, y + 2, w - 4, 1);
gc.fillRectangle(x + 1, y + 2, 2, h - 4);
//
    gc.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    drawTextImage(gc, text, textAlign, image, imageAlign, x + 2 + 1,
        y + 2 + 1, w - 4, h - 3 - 1);
  }
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:23,代码来源:SWTX.java

示例2: onPaint

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
protected void onPaint(PaintEvent event) {
  Rectangle rect = getClientArea();
  GC gc = event.gc;

  doCalculations();

  if (m_Model != null) {

    drawBottomSpace(gc);
    drawCells(gc, gc.getClipping(), 0, m_Model.getFixedColumnCount(),
        0, m_Model.getFixedRowCount());
    drawCells(gc, gc.getClipping(), m_LeftColumn, m_Model
        .getColumnCount(), 0, m_Model.getFixedRowCount());
    drawCells(gc, gc.getClipping(), 0, m_Model.getFixedColumnCount(),
        m_TopRow, m_TopRow + m_RowsVisible);
    drawCells(gc, gc.getClipping(), m_LeftColumn, m_Model
        .getColumnCount(), m_TopRow, m_TopRow + m_RowsVisible);
  } else {
    gc.fillRectangle(rect);
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:22,代码来源:KTable.java

示例3: paintElement

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
@Override
void paintElement(PaintEvent e) {
	GC g = e.gc;
	g.setBackground(this.getBackground());
	int width  = this.getBounds().width;
	int height = this.getBounds().height;
	
	// clear entire canvas where button will be painted
	g.fillRectangle(0, 0, width, height);
	
	// draw text
	g.setForeground(this.meColorForeground);
	FontData fd = new FontData();
	fd.setHeight(8);
	if(textIsBold){
		fd.setStyle(SWT.BOLD);
	}else{
		fd.setStyle(SWT.NORMAL);
	}
	g.setFont(new Font(this.getDisplay(), fd));
	Point textPt = g.textExtent(this.meLabel);			
	g.drawText(this.meLabel, (width-textPt.x)/2, (height-textPt.y)/2);
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:24,代码来源:MELabel.java

示例4: paintElement

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
@Override
void paintElement(PaintEvent e) {
	GC g = e.gc;
	g.setBackground(this.getBackground());
	int width  = this.getBounds().width;
	int height = this.getBounds().height;
	
	// clear entire canvas where button will be painted
	g.fillRectangle(0, 0, width, height);
	
	if(showImage && meIcon != null){
		Rectangle b = meIcon.getBounds();
		int imageX = Math.max((width-b.width)/2, 1);
		int imageY = Math.max((height-b.height)/2, 1);
		g.drawImage(meIcon, imageX, imageY);
	}
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:18,代码来源:MESpacer.java

示例5: getMissingImage

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * @return the small {@link Image} that can be used as placeholder for missing image.
 */
private static Image getMissingImage() {
	Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
	//
	GC gc = new GC(image);
	gc.setBackground(getColor(SWT.COLOR_RED));
	gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
	gc.dispose();
	//
	return image;
}
 
开发者ID:fmcalcagno,项目名称:Sensors,代码行数:14,代码来源:SWTResourceManager.java

示例6: paintControl

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * Handle paint events.
 */
public void paintControl(PaintEvent event) {
	GC gc = event.gc;
	gc.drawImage (image, 0, 0);
	Rectangle rect = image.getBounds ();
	Rectangle client = getClientArea();
	int marginWidth = client.width - rect.width;
	if (marginWidth > 0) {
		gc.fillRectangle (rect.width, 0, marginWidth, client.height);
	}
	int marginHeight = client.height - rect.height;
	if (marginHeight > 0) {
		gc.fillRectangle (0, rect.height, client.width, marginHeight);
	}
}
 
开发者ID:marvinmalkowskijr,项目名称:applecommander,代码行数:18,代码来源:ImageCanvas.java

示例7: drawBox

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * Draw a box on the screen.  The shadowed box is only drawn if there is
 * enough space within the box; otherwise, the box is just filled in with
 * the fill color.  Additionally, drawBox ensures that a square is drawn.
 */
protected void drawBox(Rectangle box, GC gc, Color fill, Color outline, Color shadow) {
	if (box.width >= 10 && box.height >= 10) {
		// square the rectangle shape:
		int size = Math.min(box.height, box.width);
		box.height = size + ((box.height - size) / 2);
		box.width = size + ((box.width - size) / 2);
		// offset internal box:
		box.x+= 2;
		box.y+= 2;
		box.width-= 5;
		box.height-= 5;
		// draw!
		gc.setBackground(shadow);
		gc.fillRectangle(box);
		box.x-= 2;
		box.y-= 2;
		gc.setBackground(fill);
		gc.fillRectangle(box);
		gc.setForeground(outline);
		gc.drawRectangle(box);
	} else {
		// just fill:
		gc.setBackground(fill);
		gc.fillRectangle(box);
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:32,代码来源:DiskMapTab.java

示例8: makePreview

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static Image makePreview ( final Display display, final LineAttributes lineAttributes, final Color lineColor, final Point p )
{
    final Image img = new Image ( display, p.x, p.y );

    final GC gc = new GC ( img );
    try
    {
        gc.setForeground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
        gc.setBackground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
        gc.fillRectangle ( 0, 0, p.x, p.y );

        gc.setLineAttributes ( lineAttributes );

        if ( lineColor != null )
        {
            gc.setForeground ( lineColor );
        }

        gc.drawLine ( 0, p.y / 2, p.x, p.y / 2 );
    }
    finally
    {
        gc.dispose ();
    }

    return img;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:LineInput.java

示例9: drawTransparentImage

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawTransparentImage(GC gc, Image image, int x, int y) {
  if (image == null)
    return;
  Point imageSize = new Point(image.getBounds().width,
      image.getBounds().height);
  Image img = new Image(Display.getCurrent(), imageSize.x, imageSize.y);
  GC gc2 = new GC(img);
  gc2.setBackground(gc.getBackground());
  gc2.fillRectangle(0, 0, imageSize.x, imageSize.y);
  gc2.drawImage(image, 0, 0);
  gc.drawImage(img, x, y);
  gc2.dispose();
  img.dispose();
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:15,代码来源:SWTX.java

示例10: drawImageVerticalAlign

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawImageVerticalAlign(GC gc, Image image,
      int imageAlign, int x, int y, int h) {
    if (image == null)
      return;
    Point imageSize = new Point(image.getBounds().width,
        image.getBounds().height);
    //
if ((imageAlign & ALIGN_VERTICAL_MASK) == ALIGN_VERTICAL_TOP) {
  drawTransparentImage(gc, image, x, y);
  gc.fillRectangle(x, y + imageSize.y, imageSize.x, h - imageSize.y);
  return;
}
if ((imageAlign & ALIGN_VERTICAL_MASK) == ALIGN_VERTICAL_BOTTOM) {
  drawTransparentImage(gc, image, x, y + h - imageSize.y);
  gc.fillRectangle(x, y, imageSize.x, h - imageSize.y);
  return;
}
if ((imageAlign & ALIGN_VERTICAL_MASK) == ALIGN_VERTICAL_CENTER) {
  int yOffset = (h - imageSize.y) / 2;
  drawTransparentImage(gc, image, x, y + yOffset);
  gc.fillRectangle(x, y, imageSize.x, yOffset);
  gc.fillRectangle(x, y + yOffset + imageSize.y, imageSize.x, h
      - (yOffset + imageSize.y));
  return;
}
throw new SWTException(
    "H: "
            + (imageAlign & ALIGN_VERTICAL_MASK));
  }
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:30,代码来源:SWTX.java

示例11: drawButtonUp

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawButtonUp(GC gc, String text, int textAlign,
    Image image, int imageAlign, int x, int y, int w, int h,
    Color face, Color shadowHigh, Color shadowNormal, Color shadowDark,
    int leftMargin, int topMargin) {
  Color prevForeground = gc.getForeground();
  Color prevBackground = gc.getBackground();
  try {
    gc.setBackground(face);
    gc.setForeground(shadowHigh);
    gc.drawLine(x, y, x, y + h - 1);
    gc.drawLine(x, y, x + w - 2, y);
    gc.setForeground(shadowDark);
    gc.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
    gc.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    gc.setForeground(shadowNormal);
    gc.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);
    gc.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
    //
    gc.fillRectangle(x + 1, y + 1, leftMargin, h - 3);
    gc.fillRectangle(x + 1, y + 1, w - 3, topMargin);
    gc.setForeground(prevForeground);
    drawTextImage(gc, text, textAlign, image, imageAlign, x + 1
        + leftMargin, y + 1 + topMargin, w - 3 - leftMargin, h - 3
        - topMargin);
  } finally {
    gc.setForeground(prevForeground);
    gc.setBackground(prevBackground);
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:30,代码来源:SWTX.java

示例12: changeImageBackgroundColor

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * Change the background color of an image and draw a rectangle on it that
 * has the same bounds as the image. This effectively turns the image into
 * the color supplied with the RGB.
 * @param image The image to be painted.
 * @param rgb The desired RGB for the image.
 */
protected void changeImageBackgroundColor(Image image, RGB rgb) {
	Display display = this.shell.getDisplay();
	GC gc = new GC(image);
	gc.setBackground(new Color(display, rgb));
	gc.fillRectangle(this.fileInspConstantClassImage.getBounds());
	gc.dispose();
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:15,代码来源:OptionsComposite.java

示例13: drawFlatButtonUp

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawFlatButtonUp(GC gc, String text, int textAlign,
    Image image, int imageAlign, int x, int y, int w, int h,
    Color face, Color shadowLight, Color shadowNormal, int leftMargin,
    int topMargin) {
  Color prevForeground = gc.getForeground();
  Color prevBackground = gc.getBackground();
  try {
    gc.setForeground(shadowLight);
    gc.drawLine(x, y, x + w - 1, y);
    gc.drawLine(x, y, x, y + h);
    gc.setForeground(shadowNormal);
    gc.drawLine(x + w, y, x + w, y + h);
    gc.drawLine(x + 1, y + h, x + w, y + h);
    //
gc.setBackground(face);
gc.fillRectangle(x + 1, y + 1, leftMargin, h - 1);
gc.fillRectangle(x + 1, y + 1, w - 1, topMargin);
//
    gc.setBackground(face);
    gc.setForeground(prevForeground);
    drawTextImage(gc, text, textAlign, image, imageAlign, x + 1
        + leftMargin, y + 1 + topMargin, w - 1 - leftMargin, h - 1
        - topMargin);
  } finally {
    gc.setForeground(prevForeground);
    gc.setBackground(prevBackground);
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:29,代码来源:SWTX.java

示例14: draw

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
private void draw(GC gc,float x,float y,float h,DHTControlContact contact,int distance,float error) {
  if(x == 0 && y == 0) return;
  if(error > 1) error = 1;
  int errDisplay = (int) (100 * error);
  int x0 = scale.getX(x,y);
  int y0 = scale.getY(x,y);

  Image img = ImageRepository.getCountryFlag( contact.getTransportContact().getTransportAddress().getAddress(), true );

  if ( img != null ){
  	Rectangle bounds = img.getBounds();
  	int old = gc.getAlpha();
  	gc.setAlpha( 150 );
  	gc.drawImage( img, x0-bounds.width/2, y0-bounds.height);
  	gc.setAlpha( old );
  }

  gc.fillRectangle(x0-1,y0-1,3,3);
  //int elevation =(int) ( 200*h/(scale.maxY-scale.minY));
  //gc.drawLine(x0,y0,x0,y0-elevation);

  //String text = /*contact.getTransportContact().getAddress().getAddress().getHostAddress() + " (" + */distance + " ms \nerr:"+errDisplay+"%";
  String text = /*contact.getTransportContact().getAddress().getAddress().getHostAddress() + " (" + */distance + " ms "+errDisplay+"%";

  int lineReturn = text.indexOf("\n");
  int xOffset = gc.getFontMetrics().getAverageCharWidth() * (lineReturn != -1 ? lineReturn:text.length()) / 2;
  gc.drawText(text,x0-xOffset,y0,true);

  currentPositions.add( new Object[]{ x0, y0, h, contact, x, y, distance });
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:31,代码来源:VivaldiPanel.java

示例15: getMissingImage

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
private static Image getMissingImage() {
	Image image = new Image(Display.getCurrent(), IMAGE_SIZE, IMAGE_SIZE);
	GC gc = new GC(image);
	gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	gc.fillRectangle(0, 0, IMAGE_SIZE, IMAGE_SIZE);
	gc.dispose();
	return image;
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:9,代码来源:SimpleToolBarEx.java


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