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


Java Graphics.getBackgroundColor方法代码示例

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


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

示例1: paintTitle

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
public void paintTitle(Graphics graphics) {
	if (Utils.isNotEmpty(getText())){
		graphics.pushState();
		Color bgColor = graphics.getBackgroundColor(); 
		graphics.setBackgroundColor(ColorConstants.white);
		int titleHeight = FigureUtilities.getStringExtents(getText(), titleFont).height;
		Rectangle titleRect = getTextHolderRectangle();
		Rectangle imRect = new Rectangle(titleRect.x + getMargin(),
				titleRect.y + getMargin(), titleHeight,	titleHeight);
		graphics.fillArc(imRect, 0, 360);
		
		graphics.setBackgroundColor(bgColor);
		imRect.shrink(4, 4);
		graphics.fillArc(imRect, 0, 360);
		
		graphics.setBackgroundColor(ColorConstants.white);
		graphics.fillPolygon(new int[]{imRect.x + imRect.width / 6,
				imRect.y + imRect.width / 3,
				imRect.x + imRect.width - imRect.width/ 6,
				imRect.y + imRect.width / 3,
				imRect.x + imRect.width/ 2,
				imRect.y + imRect.width});
		
		graphics.setBackgroundColor(ColorConstants.gray);
		graphics.drawLine(titleRect.x + 50, titleRect.y + titleHeight + getMargin() + 1,
				titleRect.right() - 50, titleRect.y + titleHeight + getMargin() + 1);
		graphics.popState();
		titleRect.x += titleHeight + getMargin()*2;
		titleRect.width -= titleHeight + getMargin()*3;
		paintString(graphics, getText(), titleRect);
		
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:35,代码来源:AndroidAlertDialogFigure.java

示例2: draw

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * Template method to enforce all standard logic for drawing the shape and its border.
 */
@Override
public final void draw(A shapeAttribute, Graphics graphics, ResourceManager resourceManager) {
  Color stdFgColor = graphics.getForegroundColor();
  Color stdBgColor = graphics.getBackgroundColor();
  float stdLineWidth = graphics.getLineWidthFloat();
  int stdAlpha = graphics.getAlpha();

  try {
    Point tlp = getTopLeftLocation(shapeAttribute);
    Dimension dim = getDimension(shapeAttribute, resourceManager);

    Color lineColor = getSwtColor(shapeAttribute.lineColor, resourceManager);
    Color fillColor = getSwtColor(shapeAttribute.fillColor, resourceManager);
    if (lineColor != null) {
      graphics.setForegroundColor(lineColor);
    }
    if (fillColor != null) {
      graphics.setBackgroundColor(fillColor);
    }

    float lineWidth = (float) ((DoubleToken) shapeAttribute.lineWidth.getToken()).doubleValue();
    graphics.setLineWidthFloat(lineWidth);

    Rectangle bounds = new Rectangle(tlp.x, tlp.y, dim.width(), dim.height());
    // do the filling of the shape
    graphics.setAlpha(fillColor.getAlpha());
    doFillShape(shapeAttribute, graphics, bounds);
    // draw the border of the shape
    graphics.setAlpha(lineColor.getAlpha());
    doDrawBorder(shapeAttribute, graphics, bounds);
  } catch (IllegalActionException e) {
    getLogger().error("Error reading properties of " + shapeAttribute.getFullName(), e);
  } finally {
    graphics.setLineWidthFloat(stdLineWidth);
    graphics.setForegroundColor(stdFgColor);
    graphics.setBackgroundColor(stdBgColor);
    graphics.setAlpha(stdAlpha);
  }
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:43,代码来源:FilledShapeDrawingStrategy.java

示例3: draw

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
public void draw(ArrowAttribute arrowAttr, Graphics graphics, ResourceManager resourceManager) {
  Color fgColor = graphics.getForegroundColor();
  Color bgColor = graphics.getBackgroundColor();
  Color rgb = getSwtColor(arrowAttr.lineColor, resourceManager);
  if (rgb != null) {
    graphics.setForegroundColor(rgb);
    graphics.setBackgroundColor(rgb);
  }

  try {
    float lineWidth = (float) ((DoubleToken) arrowAttr.lineWidth.getToken()).doubleValue();
    graphics.setLineWidthFloat(lineWidth);
    int x = (int) ((DoubleToken) arrowAttr.x.getToken()).doubleValue();
    int y = (int) ((DoubleToken) arrowAttr.y.getToken()).doubleValue();
    int width = (int) ((DoubleToken) arrowAttr.arrowWidth.getToken()).doubleValue();
    int length = (int) ((DoubleToken) arrowAttr.arrowLength.getToken()).doubleValue();
    int halfWidth = width/2;
    Point tlp = getTopLeftLocation(arrowAttr);
    Transform transform = new Transform();
    transform.setRotation(Math.atan2(y, x));
    PointList pList = new PointList();
    pList.addPoint(0, halfWidth);
    pList.addPoint(length + 3,  0);
    pList.addPoint(length,  halfWidth);
    pList.addPoint((int) Math.sqrt(x*x + y*y),  halfWidth);
    pList.addPoint(length,  halfWidth);
    pList.addPoint(length + 3,  width);
    pList = getTransformedPolygon(transform, pList);
    pList.translate(tlp);
    graphics.fillPolygon(pList);
    graphics.drawPolygon(pList);
  } catch (IllegalActionException e) {
    LOGGER.error("Error reading dimensions for " + arrowAttr.getFullName(), e);
  }
  graphics.setForegroundColor(fgColor);
  graphics.setBackgroundColor(bgColor);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:39,代码来源:ArrowDrawingStrategy.java


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