本文整理汇总了Java中org.eclipse.draw2d.Graphics.setLineWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.setLineWidth方法的具体用法?Java Graphics.setLineWidth怎么用?Java Graphics.setLineWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Graphics
的用法示例。
在下文中一共展示了Graphics.setLineWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
graphics.pushState();
if(axis.isShowMajorGrid()){
graphics.setLineStyle(axis.isDashGridLine()? SWTConstants.LINE_DASH : SWTConstants.LINE_SOLID);
graphics.setForegroundColor(axis.getMajorGridColor());
graphics.setLineWidth(1);
for(int pos: axis.getScaleTickLabels().getTickLabelPositions()){
if(axis.isHorizontal())
graphics.drawLine(axis.getBounds().x + pos, bounds.y + bounds.height,
axis.getBounds().x + pos, bounds.y);
else
graphics.drawLine(bounds.x, axis.getBounds().y + axis.getBounds().height - pos, bounds.x + bounds.width,
axis.getBounds().y + axis.getBounds().height - pos);
}
}
graphics.popState();
}
示例2: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics g) {
super.paintFigure(g);
final int LEG = 5;
Rectangle r = getBounds();
g.setLineWidth(1);
g.setForegroundColor(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR);
g.drawLine(r.x, r.y, r.x, r.y+r.height-1);
g.drawLine(r.x, r.y, r.x+LEG, r.y);
g.drawLine(r.x, r.y+r.height-1, r.x+LEG, r.y+r.height-1);
g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1, r.y+r.height);
g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1-LEG, r.y);
g.drawLine(r.x+r.width-1, r.y+r.height-1, r.x+r.width-1-LEG, r.y+r.height-1);
if(!valid) {
g.setForegroundColor(PandionJConstants.Colors.ERROR);
String text = "Invalid matrix";
int textWidth = FigureUtilities.getTextWidth(text, g.getFont());
Point p = r.getLocation().translate(r.width/2 - textWidth/2, 5);
g.drawText(text, p);
}
}
示例3: paint
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void paint(final IFigure figure, final Graphics graphics, final Insets insets) {
if (getColor() != null) {
graphics.setForegroundColor(getColor());
}
tempRect.setBounds(getPaintRectangle(figure, insets));
if (getWidth() % 2 == 1) {
tempRect.width--;
tempRect.height--;
}
tempRect.shrink(getWidth() / 2, getWidth() / 2);
graphics.setLineWidth(1);
int g = 9 * DELTA;
int b = 9 * DELTA;
for (int i = 0; i <= 5; i++) {
final Color color = Resources.getColor(new int[] {b, g, 255});
paint1(i, color, tempRect, graphics);
g -= DELTA;
b -= DELTA;
}
}
示例4: paint
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
if (getColor() != null) {
graphics.setForegroundColor(getColor());
}
tempRect.setBounds(getPaintRectangle(figure, insets));
if (getWidth() % 2 == 1) {
tempRect.width--;
tempRect.height--;
}
tempRect.shrink(getWidth() / 2, getWidth() / 2);
graphics.setLineWidth(1);
int g = 9 * DELTA;
int b = 9 * DELTA;
for (int i = 0; i <= 5; i++) {
Color color = Resources.getColor(new int[] { b, g, 255 });
this.paint1(i, color, tempRect, graphics);
g -= DELTA;
b -= DELTA;
}
}
示例5: drawShadowLayer
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void drawShadowLayer(Rectangle rectangle, Graphics graphics,
int offset, Color color) {
// Save the state of the graphics object
graphics.pushState();
graphics.setLineWidth(0);
graphics.setBackgroundColor(color);
Rectangle shadowLayer = new Rectangle(rectangle);
shadowLayer.x += offset;
shadowLayer.y += offset;
Dimension cornerDimensions = getCornerDimensions();
graphics.fillRoundRectangle(shadowLayer, cornerDimensions.width,
cornerDimensions.height);
// Restore the start of the graphics object
graphics.popState();
}
示例6: drawDeviceButton
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void drawDeviceButton(Graphics graphics, int deviceHeight,
int deviceWidth) {
int beginBlackButtonX = (deviceWidth / 2) - 25;
int beginBlackButtonY = deviceHeight - 35 - 25;
int beginCremeButtonX = (deviceWidth / 2) - 20;
int beginCremeButtonY = deviceHeight - 35 - 20;
int beginWhiteButtonX = (deviceWidth / 2) - 18;
int beginWhiteButtonY = deviceHeight - 35 - 18;
graphics.setForegroundColor(black);
graphics.setLineWidth(6);
graphics.drawArc(beginBlackButtonX, beginBlackButtonY, 50, 50, 0, 360);
graphics.setForegroundColor(creameColor);
graphics.setLineWidth(6);
graphics.drawArc(beginCremeButtonX, beginCremeButtonY, 40, 40, 0, 360);
graphics.setBackgroundColor(whiteColor);
graphics.fillArc(beginWhiteButtonX, beginWhiteButtonY, 36, 36, 0, 360);
}
示例7: drawHomeIcon
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void drawHomeIcon(Graphics graphics, int homeX, int homeY) {
graphics.setForegroundColor(speakerExtGray);
graphics.setLineWidth(2);
// Floor
graphics.drawLine(homeX + 4, homeY + 18, homeX + 14, homeY + 18);
// Walls
graphics.drawLine(homeX + 4, homeY + 18, homeX + 4, homeY + 13);
graphics.drawLine(homeX + 14, homeY + 18, homeX + 14, homeY + 13);
// Shimney
graphics.drawLine(homeX + 14, homeY + 9, homeX + 14, homeY + 4);
// House roof
graphics.drawLine(homeX + 9, homeY + 4, homeX + 18, homeY + 14);
graphics.drawLine(homeX + 9, homeY + 4, homeX, homeY + 14);
}
示例8: drawPolyline
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* Draw polyline with the line style and line width of the trace.
*
* @param graphics
* @param pl
*/
private void drawPolyline(Graphics graphics, PointList pl) {
graphics.pushState();
graphics.setLineWidth(lineWidth);
switch(traceType) {
case SOLID_LINE:
case STEP_HORIZONTALLY:
case STEP_VERTICALLY:
graphics.setLineStyle(SWTConstants.LINE_SOLID);
graphics.drawPolyline(pl);
break;
case DASH_LINE:
graphics.setLineStyle(SWTConstants.LINE_DASH);
graphics.drawPolyline(pl);
break;
default:
break;
}
graphics.popState();
}
示例9: paint
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
Rectangle r = getPaintRectangle(figure, insets);
graphics.setLineWidth(getWidth());
graphics.setLineStyle(getStyle());
if (getColor() != null)
graphics.setForegroundColor(getColor());
int y1 = r.y + getWidth() / 2;
int x2 = r.x + r.width;
graphics.drawLine(r.x, y1, x2, y1);
y1 = r.y + r.height - getWidth() / 2;
graphics.drawLine(r.x, y1, x2, y1);
graphics.setLineWidth(1);
graphics.drawLine(r.x - 10, r.y, r.x - 10, r.y + r.height);
graphics.drawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
}
示例10: 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);
}
示例11: paintConnection
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintConnection(Graphics graphics, HyVersion superseded) {
Date date = ((DwGraphicalFeatureModelViewer)editor).getCurrentSelectedDate();
HyFeature feature = superseded.getFeature();
DwVersionTreeLayouter versionTreeLayouter = DwVersionLayouterManager.getLayouter(feature, date);
for(HyVersion superseding : HyEvolutionUtil.getValidTemporalElements(superseded.getSupersedingVersions(), date)){
Rectangle sb = versionTreeLayouter.getBounds(superseded);
Rectangle ss = versionTreeLayouter.getBounds(superseding);
Point supersedeedLocation = sb.getCenter();
Point supersedingLocation = ss.getCenter();
supersedeedLocation.x += sb.width / 2;
supersedingLocation.x -= sb.width / 2;
DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
graphics.setForegroundColor(theme.getLineColor());
graphics.setLineWidth(theme.getLineWidth());
graphics.setLineWidth(2);
Point start = new Point(supersedeedLocation.x + getLocation().x, supersedeedLocation.y + getLocation().y);
Point end = new Point(supersedingLocation.x + this.getLocation().x, supersedingLocation.y + getLocation().y);
graphics.drawLine(start, end);
paintConnection(graphics, superseding);
}
}
示例12: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* Override to render the circle without background and with dotted outline
*/
@Override
protected void paintFigure(Graphics graphics) {
Rectangle bounds = getBounds().getCopy();
Rectangle realBounds = bounds.getCopy();
int offset = (int)(HIDDEN_CHILDREN_INDICATOR_SIZE * 0.5);
bounds.setY(bounds.y + offset);
bounds.setHeight(bounds.width);
//Compensate for line width
int lineWidth = outlineWidth / 2;
bounds.expand(-lineWidth, -lineWidth);
DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
graphics.setLineStyle(SWT.LINE_CUSTOM);
graphics.setLineDash(new int[] {4});
graphics.setLineWidth(theme.getLineWidth());
graphics.setForegroundColor(theme.getLineColor());
Point topLeft = realBounds.getTopLeft();
Point bottomLeft = realBounds.getBottomLeft();
graphics.drawLine(new Point(topLeft.x+offset-theme.getLineWidth() / 2, topLeft.y),
new Point(bottomLeft.x+offset-theme.getLineWidth() / 2, bottomLeft.y-HIDDEN_CHILDREN_INDICATOR_SIZE));
DEDrawingUtil.outlineEllipsis(graphics, bounds, outlineColor);
}
示例13: outlineShape
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @see Shape#outlineShape(Graphics)
*/
protected void outlineShape(Graphics graphics) {
DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
graphics.setAntialias(SWT.ON);
graphics.setForegroundColor(color);
graphics.setLineWidth(theme.getLineWidth());
graphics.drawPolyline(getPoints());
}
示例14: drawShadowLayer
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void drawShadowLayer(final Rectangle rectangle, final Graphics graphics, final int offset, final Color color) {
// Save the state of the graphics object
graphics.pushState();
graphics.setLineWidth(0);
graphics.setBackgroundColor(color);
final Rectangle shadowLayer = new Rectangle(rectangle);
shadowLayer.x += offset;
shadowLayer.y += offset;
final Dimension cornerDimensions = getCornerDimensions();
graphics.fillRoundRectangle(shadowLayer, cornerDimensions.width, cornerDimensions.height);
// Restore the start of the graphics object
graphics.popState();
}
示例15: drawDeviceSpeaker
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void drawDeviceSpeaker(Graphics graphics, int deviceWidth) {
int widthSpeacker = Math.min(180, deviceWidth / 2);
int xSpeaker = (deviceWidth - widthSpeacker) / 2;
int ySpeaker = 15;
graphics.setForegroundColor(black);
graphics.setLineWidth(2);
graphics.drawRoundRectangle(new Rectangle(xSpeaker, ySpeaker, widthSpeacker, 10),
10, 10);
graphics.setBackgroundColor(speakerGray);
graphics.fillRoundRectangle(new Rectangle(xSpeaker, ySpeaker, widthSpeacker, 10),
10, 10);
}