本文整理汇总了Java中org.eclipse.draw2d.Graphics.drawRoundRectangle方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.drawRoundRectangle方法的具体用法?Java Graphics.drawRoundRectangle怎么用?Java Graphics.drawRoundRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Graphics
的用法示例。
在下文中一共展示了Graphics.drawRoundRectangle方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintCancel
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintCancel(Graphics graphics){
Rectangle barBounds = getBounds().getCopy();
barBounds.crop(new Insets(getMargin()));
if (barBounds.height > getMaxHeight()){
int dy = (barBounds.height - getMaxHeight())/2;
barBounds.crop(new Insets(dy,0,dy,0));
}
Rectangle cancelBounds = barBounds.getCopy();
cancelBounds.x = cancelBounds.right() - getCancelButtonWidth();
cancelBounds.width = getCancelButtonWidth();
Color cancelColor = new Color(null,
ColorUtils.darker(
ColorUtils.darker(
graphics.getBackgroundColor().getRGB())));
graphics.setBackgroundColor(cancelColor);
int radius = Math.min(15, cancelBounds.height);
graphics.fillRoundRectangle(cancelBounds, radius, radius);
graphics.drawRoundRectangle(cancelBounds, radius, radius);
graphics.setForegroundColor(ColorConstants.white);
paintString(graphics, "Cancel", cancelBounds);
cancelColor.dispose();
}
示例2: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
//this will draw main border
getBorder().paintBackground(this, graphics, borderInsets);
//now we need to draw border with another color
//to imitate value
Rectangle bounds = getBounds().getCopy().crop(borderInsets);
bounds.width *= this.value;
//bounds.shrink(0, borderInsets.top);
int radius = Math.min(Math.min(bounds.height, bounds.width), (int)getBorder().getBorderRadius()*2);
graphics.setBackgroundColor(valueColor);
graphics.fillRoundRectangle(bounds, radius, radius);
graphics.drawRoundRectangle(bounds, radius, radius);
graphics.setBackgroundColor(getBorder().getBackgroundColor());
drawCircle(graphics, bounds);
}
示例3: paintFigure
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
//this will draw main border
super.paintFigure(graphics);
//now we need to draw border with another color
//to imitate value
Rectangle bounds = getBounds().getCopy();
bounds.width *= this.value;
if (bounds.width > 0){
int radius = Math.min(Math.min(bounds.height, bounds.width), (int)getBorder().getBorderRadius()*2);
graphics.setBackgroundColor(valueColor);
graphics.setForegroundColor(valueColor);
graphics.fillRoundRectangle(bounds, radius, radius);
graphics.drawRoundRectangle(bounds, radius, radius);
}
}
示例4: outlineShape
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void outlineShape(final Graphics graphics) {
final Rectangle f = Rectangle.SINGLETON.setBounds(getBounds());
final Insets shadowInset = new Insets(getLineWidth() / 2, getLineWidth() / 2, getLineWidth() + SHADOW_INSET, getLineWidth() + SHADOW_INSET);
shrink(f, shadowInset);
final Dimension cornerDimensions = getCornerDimensions();
graphics.drawRoundRectangle(f, cornerDimensions.width, cornerDimensions.height);
}
示例5: outlineShape
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void outlineShape(Graphics graphics) {
Rectangle f = Rectangle.SINGLETON.setBounds(getBounds());
Insets shadowInset = new Insets(getLineWidth() / 2, getLineWidth() / 2,
getLineWidth() + SHADOW_INSET, getLineWidth() + SHADOW_INSET);
shrink(f, shadowInset);
Dimension cornerDimensions = getCornerDimensions();
graphics.drawRoundRectangle(f, cornerDimensions.width, cornerDimensions.height);
}
示例6: paintBody
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintBody(Graphics graphics) {
graphics.setBackgroundColor(background);
boolean drawCC = true;//(cc != null || bcc != null);
int fieldsCount = drawCC ? 4 : 2;
int compositeHeight = 1 + (fieldsCount * 35);
Rectangle rect = new Rectangle(2, 34, resolution.width - 4, compositeHeight);
graphics.fillRectangle(rect);
Dimension fieldSize = new Dimension(resolution.width - 16, 30);
graphics.setBackgroundColor(background2);
graphics.setForegroundColor(border);
rect = new Rectangle(new Point(8, 36), fieldSize);
//to, cc, bcc, subject
for (int i = 0; i < fieldsCount; i++) {
graphics.fillRoundRectangle(rect, radius, radius);
graphics.drawRoundRectangle(rect, radius, radius);
rect.performTranslate(0, 35);
}
//message
rect = new Rectangle(2, rect.y , resolution.width - 4, resolution.height - 160);
graphics.fillRoundRectangle(rect, radius, radius);
graphics.drawRoundRectangle(rect, radius, radius);
graphics.setForegroundColor(text);
String[] titles = getTitles(drawCC);
fieldSize.width -= 8;
for (int i = 0; i < fieldsCount; i++) {
Rectangle textRect = new Rectangle(new Point(12, 5 + (i + 1)*35), fieldSize);
Drawer.drawString(graphics, titles[i], textRect, Alignments.left, Alignments.center);
}
paintMessage(graphics, rect);
}
示例7: paindButtonsBar
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @param graphics
*/
private void paindButtonsBar(Graphics graphics) {
int panelHeight = 42;
graphics.setBackgroundColor(defaultBarColor);
Rectangle rect = new Rectangle(2, resolution.height - 2 - panelHeight,
resolution.width - 4, panelHeight);
graphics.fillRectangle(rect);
int buttonWidth = (resolution.width - 20) / 7 ;
int space = (resolution.width - buttonWidth * 7) / 7;
graphics.setBackgroundColor(background2);
graphics.setForegroundColor(border);
rect = new Rectangle(5 + space, resolution.height - panelHeight + 2, buttonWidth*2, panelHeight - 10);
graphics.fillRoundRectangle(rect, radius, radius);
graphics.drawRoundRectangle(rect, radius, radius);
rect.translate(buttonWidth*5 + space*2, 0);
graphics.fillRoundRectangle(rect, radius, radius);
graphics.drawRoundRectangle(rect, radius, radius);
rect.translate(-buttonWidth*3 - space, 0);
rect.width = buttonWidth*3;
graphics.fillRoundRectangle(rect, radius, radius);
graphics.drawRoundRectangle(rect, radius, radius);
graphics.setForegroundColor(ColorConstants.black);
graphics.drawText("Send", new Point(22 + space, resolution.height - panelHeight + 7));
graphics.drawText("Save as Draft", new Point(12 + space*2 + buttonWidth*2, resolution.height - panelHeight + 7));
graphics.drawText("Discard", new Point(14 + space*3 + buttonWidth*5, resolution.height - panelHeight + 7));
}
示例8: 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);
}
示例9: drawCircle
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void drawCircle(Graphics graphics, Rectangle bounds) {
//draw circle
int x = Math.min(Math.max(bounds.right() - sliderWidth / 4, 0), getBounds().right() - sliderWidth/2);
graphics.fillRoundRectangle(new Rectangle(x, getBounds().y, sliderWidth / 2 + 1,
getBounds().height), 5, 5);
graphics.drawRoundRectangle(new Rectangle(x, getBounds().y, sliderWidth / 2,
getBounds().height - 1), 5, 5);
}
示例10: outlineShape
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
* @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics)
*/
protected void outlineShape(Graphics graphics) {
Rectangle r = getBounds().getCopy();
r.x = r.x + lineWidth / 2;
r.y = r.y + lineWidth / 2;
r.width = r.width - Math.max(1, lineWidth);
r.height = r.height - Math.max(1, lineWidth);
graphics.drawRoundRectangle(r, 30, 30);
}
示例11: 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);
}
}
示例12: outlineShape
import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void outlineShape(Graphics graphics) {
final Rectangle f = Rectangle.SINGLETON.setBounds(getBounds());
final Insets shadowInset =
new Insets(getLineWidth() / 2, getLineWidth() / 2, getLineWidth() + SHADOW_INSET, getLineWidth() + SHADOW_INSET);
shrink(f, shadowInset);
graphics.drawRoundRectangle(f, corner.width, corner.height);
}