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


Java Graphics.drawRectangle方法代码示例

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


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

示例1: paintFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.figure.AbstractNotationNodeFigure#paintFigure(org.eclipse.draw2d.Graphics)
 */
@Override
protected void paintFigure(Graphics graphics) {
    
    super.paintFigure(graphics);
    graphics.drawRectangle(getLocation().x, getLocation().y, getSize().width - 1, getSize().height - 1);

    graphics.setAntialias(SWT.ON);
    
    Rectangle bounds = getBounds();
    if(isDangling()){
        graphics.setForegroundColor(ColorConstants.red);
        graphics.drawOval(bounds.x, bounds.y, 12, 12);
        graphics.drawLine(bounds.x + 2, bounds.y + 2, bounds.x + 10, bounds.y + 10);
        graphics.drawLine(bounds.x + 10, bounds.y + 2, bounds.x + 2, bounds.y + 10);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:20,代码来源:DataTypeFigure.java

示例2: outlineShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see Shape#outlineShape(Graphics)
 */
@Override
protected void outlineShape ( final Graphics graphics )
{
    final float lineInset = Math.max ( 1.0f, getLineWidthFloat () ) / 2.0f;
    final int inset1 = (int)Math.floor ( lineInset );
    final int inset2 = (int)Math.ceil ( lineInset );

    final Rectangle r = Rectangle.SINGLETON.setBounds ( getBounds () );
    r.x += inset1;
    r.y += inset1;
    r.width -= inset1 + inset2;
    r.height -= inset1 + inset2;

    graphics.drawRectangle ( r );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:RectangleFigureExtension.java

示例3: paintFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics g) {
	super.paintFigure(g);
	
	Rectangle r = getBounds();
	Rectangle square = new Rectangle(r.getLocation().getTranslated(0, r.height/4), new Dimension(r.width/2, r.height/2));
	center = new Point(square.x + square.width/2, square.y + square.height/2);

	g.setBackgroundColor(dirty ? PandionJConstants.Colors.HIGHLIGHT : PandionJConstants.Colors.VARIABLE_BOX);
	g.fillRectangle(square);

	g.setForegroundColor(ref.getRole() == Role.FIXED_VALUE ? PandionJConstants.Colors.CONSTANT : ColorConstants.black);
	g.drawRectangle(square);

	g.setBackgroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
	g.fillOval(center.x-3, center.y-3, 7, 7);

	if(isnull) {
		g.setForegroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
		Point dest = center.getTranslated(20, 0);
		g.drawLine(center, dest);
		g.drawLine(dest.getTranslated(-3, 5), dest.getTranslated(3, -5));
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:25,代码来源:ReferenceLabel.java

示例4: paintFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.figure.AbstractNotationNodeFigure#paintFigure(org.eclipse.draw2d.Graphics)
 */
@Override
protected void paintFigure(Graphics graphics) {
    
    super.paintFigure(graphics);
    graphics.setAntialias(SWT.ON);

    graphics.drawRectangle(getLocation().x, getLocation().y, getSize().width - 1, getSize().height - 1);
    
    Rectangle bounds = getBounds();
    if(isDangling()){
        graphics.setForegroundColor(ColorConstants.red);
        graphics.drawOval(bounds.x, bounds.y, 12, 12);
        graphics.drawLine(bounds.x + 2, bounds.y + 2, bounds.x + 10, bounds.y + 10);
        graphics.drawLine(bounds.x + 10, bounds.y + 2, bounds.x + 2, bounds.y + 10);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:20,代码来源:ArtifactFigure.java

示例5: paint

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	Rectangle rect = getPaintRectangle(figure, insets);
	graphics.setForegroundColor(ColorConstants.white);
	graphics.drawLine(rect.x, rect.y, rect.x, rect.bottom());
	rect.x++;
	rect.width--;
	rect.resize(-1, -1);
	graphics.setForegroundColor(ColorConstants.black);
	graphics.drawLine(rect.x + 2, rect.bottom(), rect.right(),
			rect.bottom());
	graphics.drawLine(rect.right(), rect.bottom(), rect.right(),
			rect.y + 2);

	rect.resize(-1, -1);
	graphics.setForegroundColor(BLUE);
	graphics.drawRectangle(rect);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:18,代码来源:DirectEditManagerEx.java

示例6: paint

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * Request the painting of the border
 */
@Override
public void paint(Graphics graphics) {
	try {
		Graphics2D g = ComponentFigure.getG2D(graphics);
		if (g != null) {

			Rectangle b = getBounds();

			JRPrintElement pe = new JRBasePrintText(null);
			pe.setX(b.x + 10);
			pe.setY(b.y + 10);
			pe.setWidth(b.width - 20);
			pe.setHeight(b.height - 20);
			bd.drawBox(g, lineBox, pe);
		} else {
			graphics.drawRectangle(0, 0, 100, 100);
		}
	} catch (Exception e) {
		// when a font is missing exception is thrown by DrawVisitor
		// FIXME: maybe draw something, else?
		e.printStackTrace();
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:LineBoxRectangle.java

示例7: paintFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
public void paintFigure(Graphics g) {
	Rectangle bounds = getBounds().getCopy();

	// Avoid drawing images that are 0 in dimension
	if (bounds.width < 5 || bounds.height < 5)
		return;

	// Don't paint the selector figure if the entire source is visible.
	Dimension thumbnailSize = new Dimension(getThumbnailImage());
	// expand to compensate for rounding errors in calculating bounds
	Dimension size = getSize().getExpanded(1, 1);
	if (size.contains(thumbnailSize))
		return;

	bounds.height--;
	bounds.width--;

	Image image = new Image(Display.getCurrent(), iData);
	g.drawImage(image, iBounds, bounds);
	image.dispose();

	g.setForegroundColor(ColorConstants.menuBackgroundSelected);
	g.drawRectangle(bounds);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:25,代码来源:ScrollableThumbnail.java

示例8: paintFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
	super.paintFigure(graphics);
	graphics.setForegroundColor(error ? Constants.Colors.ERROR : ColorConstants.gray);
	graphics.setLineWidth(Constants.ARRAY_LINE_WIDTH);
	graphics.setLineDashOffset(2.5f);
	graphics.setLineStyle(Graphics.LINE_DASH);
	graphics.drawRectangle(getLocation().x, getLocation().y + TOP_PADDING, POSITION_WIDTH-1, POSITION_WIDTH-1);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:10,代码来源:ArrayPrimitiveFigure.java

示例9: paint1

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void paint1(final int i, final Color color, final Rectangle tempRect, final Graphics graphics) {
    tempRect.x++;
    tempRect.y++;
    tempRect.width -= 2;
    tempRect.height -= 2;

    graphics.setForegroundColor(color);
    graphics.drawRectangle(tempRect);
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:10,代码来源:ERDiagramLineBorder.java

示例10: paint1

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void paint1(int i, Color color, Rectangle tempRect,
		Graphics graphics) {
	tempRect.x++;
	tempRect.y++;
	tempRect.width -= 2;
	tempRect.height -= 2;

	graphics.setForegroundColor(color);
	graphics.drawRectangle(tempRect);
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:11,代码来源:ERDiagramLineBorder.java

示例11: paint

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see org.eclipse.draw2d.Border#paint(org.eclipse.draw2d.IFigure,
 *      org.eclipse.draw2d.Graphics, org.eclipse.draw2d.geometry.Insets)
 */
public void paint(IFigure figure, Graphics g, Insets insets) {
    tempRect.setBounds(getPaintRectangle(figure, insets));
    Rectangle rect = tempRect.getCopy();

    // 바를 그린다.
    if (this.barVisible) {
        if (isHorizontal()) {
            rect.width = getBarWidth();
            paintHorizontalBar(figure, g, rect);
        } else {
            rect.height = getBarWidth();
            paintVerticalBar(figure, g, rect);
        }
    }

    // 라인을 그린다.
    if (this.lineVisible) {
        // 바운더리 보기가 거짓이면 도트라인을 그린다.
        if (!this.boundaryVisible) {
            this.lineStyle = Graphics.LINE_DOT;
        }
        g.setLineWidth(this.lineWidth);
        if (this.lineColor != null) {
            g.setForegroundColor(this.lineColor);
        }
        int dw = this.lineWidth / 2;

        // 바 둘레를 그린다.
        doAdjustBoundary(rect, dw);
        g.drawRectangle(rect);

        // 전체 둘레를 그린다.
        rect = tempRect.getCopy();
        doAdjustBoundary(rect, dw);
        g.drawRectangle(rect);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:42,代码来源:TitleBarBorder.java

示例12: fillShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void fillShape(Graphics graphics) {
  LOGGER.trace("Ptolemy fillShape - entry - for {}", getIconURI());
  try {
    iconDef = iconDef != null ? iconDef : (EditorIcon) WorkflowUtils.readFrom(URI.create(getIconURI()));
    // As Ptolemy II icon definitions often use negative coordinates,
    // while draw2d graphics assumes a top-left corner at (0,0),
    // the overall icon shape drawing must first determine the most extreme
    // boundaries as defined in the icon MOML and translate the draw2d coordinates space
    // accordingly before starting the effective drawing.
    ptShapeBounds = ptShapeBounds != null ? ptShapeBounds : determineExtremeBounds(iconDef, graphics);
    LOGGER.debug("Extreme bounds for {} : {}", getIconURI(), ptShapeBounds);

    int width = ptShapeBounds.width;
    int height = ptShapeBounds.height;

    Rectangle bnds = getBounds();
    graphics.setAntialias(SWT.ON);
    graphics.setTextAntialias(SWT.ON);
    graphics.drawRectangle(bnds.x, bnds.y, width, height);
    graphics.translate(getLocation());
    graphics.translate(ptShapeBounds.getTopLeft().getNegated().getTranslated(1, 1));
    for (VisibleAttribute a : iconDef.attributeList(VisibleAttribute.class)) {
      DrawingStrategy drawingStrategy = drawingStrategies.get(a.getClass());
      if (drawingStrategy != null) {
        drawingStrategy.draw(a, graphics, resourceManager);
      }
    }
    setInitialSize(ga, width + 2, height + 2);
  } catch (Exception e) {
    LOGGER.error("Error drawing ptolemy shape " + getIconURI(), e);
  }
  LOGGER.trace("Ptolemy fillShape - exit - for {}", getIconURI());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:35,代码来源:PtolemyModelElementShape.java

示例13: outlineShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void outlineShape(Graphics graphics) {
  float lineInset = Math.max(1.0f, getLineWidthFloat()) / 2.0f;
  int inset1 = (int) Math.floor(lineInset);
  int inset2 = (int) Math.ceil(lineInset);

  Rectangle r = Rectangle.SINGLETON.setBounds(getBounds());
  r.x += inset1;
  r.y += inset1;
  r.width -= inset1 + inset2;
  r.height -= inset1 + inset2;

  graphics.drawRectangle(r);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:15,代码来源:PtolemyModelElementShape.java

示例14: doDrawBorder

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
public void doDrawBorder(RectangleAttribute rectangleAttr, Graphics graphics, Rectangle bounds) throws IllegalActionException {
  int rounding = (int) ((DoubleToken) rectangleAttr.rounding.getToken()).doubleValue();
  if (rounding > 0) {
    graphics.drawRoundRectangle(bounds, rounding, rounding);
  } else {
    graphics.drawRectangle(bounds);
  }
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:10,代码来源:RectangleDrawingStrategy.java

示例15: paintClientArea

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintClientArea(final Graphics graphics) {
	super.paintClientArea(graphics);
	if (showBorder) {
		graphics.setLineWidth(2);
		graphics.drawLine(bounds.x, bounds.y, bounds.x + bounds.width,
				bounds.y);
		graphics.drawLine(bounds.x + bounds.width, bounds.y, bounds.x
				+ bounds.width, bounds.y + bounds.height);
	}
	// Show the start/end cursor or the 'rubberband' of a zoom operation?
	if (armed && end != null && start != null) {
		switch (zoomType) {
		case RUBBERBAND_ZOOM:
		case HORIZONTAL_ZOOM:
		case VERTICAL_ZOOM:
			graphics.setLineStyle(SWTConstants.LINE_DOT);
			graphics.setLineWidth(1);
			graphics.setForegroundColor(revertBackColor);
			graphics.drawRectangle(start.x, start.y, end.x - start.x, end.y
					- start.y);
			break;

		default:
			break;
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:29,代码来源:PlotArea.java


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