本文整理汇总了Java中java.awt.Graphics.fillArc方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.fillArc方法的具体用法?Java Graphics.fillArc怎么用?Java Graphics.fillArc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Graphics
的用法示例。
在下文中一共展示了Graphics.fillArc方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStationIcon
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public Image getStationIcon(String type, Rectangle bounds) {
int qLength = 60, height = 40, width = 100;
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics g = bi.getGraphics();
for (int i = 0, monoChannel = 0; i < 10; i++, monoChannel = (int) ((1 - Math.exp(-i)) * 50)) {
g.setColor(new Color(230 - monoChannel, 230 - monoChannel, 230 - monoChannel));
g.drawPolyline(new int[] { i, i, qLength - i }, new int[] { height - i, i, i }, 3);
g.fillArc(width - height + i, i, height - 2 * i, height - 2 * i, 45, 180);
g.setColor(new Color(130 + monoChannel, 130 + monoChannel, 130 + monoChannel));
g.drawPolyline(new int[] { i, qLength - i, qLength - i }, new int[] { height - i, height - i, i }, 3);
g.fillArc(width - height + i, i, height - 2 * i, height - 2 * i, 225, 180);
}
g.fillRect(5, 5, qLength - 9, height - 9);
g.fillOval(width - height + 5, 5, height - 10, height - 10);
return bi.getScaledInstance(bounds.width, bounds.height, Image.SCALE_SMOOTH);
}
示例2: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
/** This method is called by Swing to draw this component. */
@Override
public void paintComponent(final Graphics gr) {
super.paintComponent(gr);
Graphics2D g2 = (Graphics2D) gr;
AffineTransform oldAF = (AffineTransform) (g2.getTransform().clone());
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.scale(scale, scale);
Object sel = (selected != null ? selected : highlight);
GraphNode c = null;
if (sel instanceof GraphNode && ((GraphNode) sel).shape() == null) {
c = (GraphNode) sel;
sel = c.ins.get(0);
}
graph.draw(new Artist(g2), scale, sel, true);
if (c != null) {
gr.setColor(((GraphEdge) sel).color());
gr.fillArc(c.x() - 5 - graph.getLeft(), c.y() - 5 - graph.getTop(), 10, 10, 0, 360);
}
g2.setTransform(oldAF);
}
示例3: paint
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
int rx = (int) Math.round(x);
int ry = (int) Math.round(y);
try {
// Draw portal sprite
g.drawImage(ImageIO.read(this.getClass().getResourceAsStream("/img/portalTexture.png")), rx-sprite_width/2, ry-sprite_height/2, sprite_width, sprite_height, null);
// Draw shields
int alpha = Math.min((int)Math.round(this.shieldMitigation()*2.55), 255);
g.setColor(new Color(255, 142, 247, alpha));
g.fillArc(rx-sprite_width/2, ry-sprite_height/2, sprite_width, sprite_height, 0, 360);
// Draw links
g.setColor(Color.GREEN);
for(Portal p: links){
g.drawLine(rx, ry, (int) Math.round(p.getX()), (int) Math.round(p.getY()));
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例4: getStationIcon
import java.awt.Graphics; //导入方法依赖的package包/类
public static Image getStationIcon(String type, Rectangle bounds) {
BufferedImage bi = new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics g = bi.getGraphics();
int qLength = bounds.width * 3 / 5, height = bounds.height, width = bounds.width;
for (int i = 0, monoChannel = 0; i < 5; i++, monoChannel = (int) ((1 - Math.exp(-i)) * 50)) {
g.setColor(new Color(230 - monoChannel, 230 - monoChannel, 230 - monoChannel, 255));
g.drawPolyline(new int[] { i, i, qLength - i }, new int[] { height - i, i, i }, 3);
g.fillArc(width - height + i, i, height - 2 * i, height - 2 * i, 45, 180);
g.setColor(new Color(130 + monoChannel, 130 + monoChannel, 130 + monoChannel, 255));
g.drawPolyline(new int[] { i, qLength - i, qLength - i }, new int[] { height - i, height - i, i }, 3);
g.fillArc(width - height + i, i, height - 2 * i, height - 2 * i, 225, 180);
}
g.fillRect(5, 5, qLength - 9, height - 9);
g.fillOval(width - height + 5, 5, height - 10, height - 10);
return bi;
}
示例5: paint
import java.awt.Graphics; //导入方法依赖的package包/类
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.blue);
g.setFont(new Font("宋体", Font.BOLD, 20));
g.drawRect(100, 300, 150, 100);
g.drawRoundRect(300, 200, 200, 200, 200, 200);
/*
* x - 要绘制矩形的 x 坐标。 y - 要绘制矩形的 y 坐标。 width - 要绘制矩形的宽度。 height -
* 要绘制矩形的高度。 arcWidth - 4 个角弧度的水平直径。 arcHeight - 4 个角弧度的垂直直径。
*/
g.setColor(Color.red);
g.fillRect(100, 100, 100, 100);
g.setColor(Color.green);
g.fillOval(200, 100, 150, 150);
// 填充夜色 圆形填充
g.fill3DRect(150, 450, 50, 50, false);
g.fillArc(200, 450, 50, 50, 50, 50);
g.fillRect(250, 450, 50, 50);
g.fillRoundRect(300, 450, 50, 50, 50, 50);
g.drawString("如果", 400, 150);
}
示例6: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
public void paintComponent(Graphics g)
{
super.paintComponent(g);
int radius = 20; // radius of an arc
// draw the rainbow near the bottom-center
int centerX = getWidth() / 2;
int centerY = getHeight() - 10;
// draws filled arcs starting with the outermost
for (int counter = colors.length; counter > 0; counter--)
{
// set the color for the current arc
g.setColor(colors[counter - 1]);
// fill the arc from 0 to 180 degrees
g.fillArc(centerX - counter * radius,
centerY - counter * radius,
counter * radius * 2, counter * radius * 2, 0, 180);
}
}
示例7: paintIcon
import java.awt.Graphics; //导入方法依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y) {
float len = angle.length;
centreX = x + (DIAMETRO / 2);
centreY = y + (DIAMETRO / 2);
for (int i = 0; i < len - 1; i++) {
g.setColor(JavaWatColor.getColor(i));
g.fillArc(x, y, DIAMETRO, DIAMETRO, angle[i], angle[i + 1] - angle[i]);
g.setColor(Color.BLACK);
g.drawArc(x, y, DIAMETRO, DIAMETRO, angle[i], angle[i + 1] - angle[i]);
}
}
示例8: createCPU
import java.awt.Graphics; //导入方法依赖的package包/类
private void createCPU(Graphics g) {
cpuPhase = (cpuPhase - 6) % 360;
int width = getBounds().width, height = getBounds().height, x = getBounds().x, y = getBounds().y, turn = colors.length;
g.setColor(Color.WHITE);
g.fillOval(width - height + x + 1, y + 1, height - 2, height - 2);
for (int i = 0; i < turn; i++) {
g.setColor(colors[i % colors.length]);
g.fillArc(width - height + x, y, height, height, (int) cpuPhase + (i * 360) / turn, 360 / turn);
}
}
示例9: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
// start at 0 and sweep 360 degrees
g.setColor(Color.RED);
g.drawRect(15, 35, 80, 80);
g.setColor(Color.BLACK);
g.drawArc(15, 35, 80, 80, 0, 360);
// start at 0 and sweep 110 degrees
g.setColor(Color.RED);
g.drawRect(100, 35, 80, 80);
g.setColor(Color.BLACK);
g.drawArc(100, 35, 80, 80, 0, 110);
// start at 0 and sweep -270 degrees
g.setColor(Color.RED);
g.drawRect(185, 35, 80, 80);
g.setColor(Color.BLACK);
g.drawArc(185, 35, 80, 80, 0, -270);
// start at 0 and sweep 360 degrees
g.fillArc(15, 120, 80, 40, 0, 360);
// start at 270 and sweep -90 degrees
g.fillArc(100, 120, 80, 40, 270, -90);
// start at 0 and sweep -270 degrees
g.fillArc(185, 120, 80, 40, 0, -270);
}
示例10: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
/** This method is called by Swing to draw this component. */
@Override public void paintComponent(final Graphics gr) {
super.paintComponent(gr);
Graphics2D g2 = (Graphics2D)gr;
AffineTransform oldAF = (AffineTransform) (g2.getTransform().clone());
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.scale(scale, scale);
Object sel=(selected!=null ? selected : highlight);
GraphNode c=null;
if (sel instanceof GraphNode && ((GraphNode)sel).shape()==null) { c = (GraphNode)sel; sel = c.ins.get(0); }
graph.draw(new Artist(g2), scale, sel, true);
if (c!=null) { gr.setColor(((GraphEdge)sel).color()); gr.fillArc(c.x()-5-graph.getLeft(), c.y()-5-graph.getTop(), 10, 10, 0, 360); }
g2.setTransform(oldAF);
}
示例11: updateIcon
import java.awt.Graphics; //导入方法依赖的package包/类
private void updateIcon() {
//if (true==true) return;
if (piChart == null)
piChart = createImage(32, 32);
if (piChart == null)
return; //How does this happen??
double percent = 0;
percent = (getValue() < getMin() || getValue() > getMax() ? 0
: ((double) (getValue() - getMin())) / ((double) (getMax() - getMin())));
int int_temp = (int) (percent * 100);
if (int_temp == lastPercent)
return;
lastPercent = int_temp;
Graphics gp = piChart.getGraphics();
gp.setColor(Color.white);
gp.fillRect(0, 0, 32, 32);
gp.setColor(new Color(240, 240, 240));
gp.fillArc(1, 1, 30, 30, 90, 360);
gp.setColor(getBarColor());
gp.fillArc(1, 1, 30, 30, 90, -(int) (percent * 360));
//gp.setColor(Color.black);
//gp.drawString(""+((int)(percent/100-1))+"%", 1, 16);
setIconImage(piChart);
}
示例12: RenderEllipse
import java.awt.Graphics; //导入方法依赖的package包/类
public static void RenderEllipse(Graphics g, Vector2 position, Vector2 size, int angle, Color c)
{
g.setColor(c);
g.fillArc((int)position.x, (int)position.y, (int)size.x, (int)size.y, 0, angle);
}
示例13: renderEdge
import java.awt.Graphics; //导入方法依赖的package包/类
public void renderEdge(Graphics g, VisEdge ec) {
try {
CircleEdge cve = (CircleEdge) ec;
// g.setColor( Color.green );
// plainDraw( g, ec );
double r = cve.getRadius();
Coordinates tl = cve.getCenter();
// g.setColor( Color.lightGray );
// g.drawArc(
// (int) (tl.getX() - r),
// (int) (tl.getY() - r),
// (int) (2 * r),
// (int) (2 * r),
// 0,
// 360);
if (selected(ec.getEdge())) {
g.setColor(Color.red);
} else {
g.setColor(Color.black);
}
double theta = cve.getStartAngle();
int angle = (int) ( theta * 180 / Math.PI ) ;
Color c = new Color( 247,210,130, 50 );
g.setColor( c );
g.fillArc(
(int) (tl.getX() - r),
(int) (tl.getY() - r),
(int) (2 * r),
(int) (2 * r),
- angle,
180);
g.setColor(new Color(247,210,130));
g.drawArc(
(int) (tl.getX() - r),
(int) (tl.getY() - r),
(int) (2 * r),
(int) (2 * r),
- angle,
180);
} catch (ClassCastException cce) {
g.setColor(Color.lightGray);
plainDraw( g, ec );
}
}