本文整理汇总了Java中java.awt.Graphics.fillOval方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.fillOval方法的具体用法?Java Graphics.fillOval怎么用?Java Graphics.fillOval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Graphics
的用法示例。
在下文中一共展示了Graphics.fillOval方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g){
// dibujar cara
g.setColor(Color.YELLOW);
g.fillOval(10,10,200,200);
// dibujar ojos
g.setColor(Color.BLACK);
g.fillOval(55, 65, 30, 30);
g.fillOval(135, 65, 30, 30);
// dibujar boca
g.fillOval(50, 110, 120, 60);
// hace la sonrisa
g.setColor(Color.YELLOW);
g.fillRect(50,110, 120, 30);
g.fillOval(50, 120, 120, 40);
}
示例2: paintInstance
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paintInstance(InstancePainter painter) {
InstanceDataSingleton data = (InstanceDataSingleton) painter.getData();
Value val = data == null ? Value.FALSE : (Value) data.getValue();
Bounds bds = painter.getBounds().expand(-1);
Graphics g = painter.getGraphics();
if (painter.getShowState()) {
Color onColor = painter.getAttributeValue(Io.ATTR_ON_COLOR);
Color offColor = painter.getAttributeValue(Io.ATTR_OFF_COLOR);
Boolean activ = painter.getAttributeValue(Io.ATTR_ACTIVE);
Object desired = activ.booleanValue() ? Value.TRUE : Value.FALSE;
g.setColor(val == desired ? onColor : offColor);
g.fillOval(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
}
g.setColor(Color.BLACK);
GraphicsUtil.switchToWidth(g, 2);
g.drawOval(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
GraphicsUtil.switchToWidth(g, 1);
painter.drawLabel();
painter.drawPorts();
}
示例3: 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);
}
示例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: draw
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, Graphics g) {
if (active) {
g.setColor(Color.GRAY);
int size = locations.size();
int[] xs = new int[size];
int[] ys = new int[size];
for (int i = 0; i < size; i++) {
Location loc = locations.get(i);
xs[i] = loc.getX();
ys[i] = loc.getY();
}
g.drawPolyline(xs, ys, size);
int lastX = xs[xs.length - 1];
int lastY = ys[ys.length - 1];
g.fillOval(lastX - 2, lastY - 2, 4, 4);
}
}
示例6: paint
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paint(InstancePainter painter) {
State state = (State) painter.getData();
if (state == null) {
state = new State(0, 0);
painter.setData(state);
}
Bounds bds = painter.getBounds();
int x = bds.getX() + 30;
int y = bds.getY() + 15;
Graphics g = painter.getGraphics();
g.setColor(Color.BLACK);
g.fillOval(x - 19, y - 4, 8, 8);
GraphicsUtil.switchToWidth(g, 3);
int dx = state.xPos;
int dy = state.yPos;
int x0 = x - 15 + (dx > 5 ? 1 : dx < -5 ? -1 : 0);
int y0 = y + (dy > 5 ? 1 : dy < 0 ? -1 : 0);
int x1 = x - 15 + dx;
int y1 = y + dy;
g.drawLine(x0, y0, x1, y1);
Color ballColor = painter.getAttributeValue(Io.ATTR_COLOR);
Joystick.drawBall(g, x1, y1, ballColor, true);
}
示例7: drawDots
import java.awt.Graphics; //导入方法依赖的package包/类
private void drawDots(Graphics g, int x, int y, int width, int ascent) {
int r = width / 10;
if (r < 1)
r = 1;
int d = 2 * r;
if (2 * r + 1 * d <= width)
g.fillOval(x + r, y - d, d, d);
if (3 * r + 2 * d <= width)
g.fillOval(x + 2 * r + d, y - d, d, d);
if (5 * r + 3 * d <= width)
g.fillOval(x + 3 * r + 2 * d, y - d, d, d);
}
示例8: createIcon
import java.awt.Graphics; //导入方法依赖的package包/类
protected static ImageIcon createIcon() {
BufferedImage bi = new BufferedImage(IMAGE_WIDTH_AND_HEIGHT,
IMAGE_WIDTH_AND_HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
g.setColor(Color.RED);
g.fillOval(0, 0, IMAGE_WIDTH_AND_HEIGHT, IMAGE_WIDTH_AND_HEIGHT);
return new ImageIcon(bi);
}
示例9: draw
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, ComponentDrawContext context) {
// draw wire's shadow after mouse move
Graphics g = context.getGraphics();
if (exists) {
Location e0 = start;
Location e1 = cur;
Wire shortenBefore = willShorten(start, cur);
if (shortenBefore != null) {
Wire shorten = getShortenResult(shortenBefore, start, cur);
if (shorten == null) {
return;
} else {
e0 = shorten.getEnd0();
e1 = shorten.getEnd1();
}
}
int x0 = e0.getX();
int y0 = e0.getY();
int x1 = e1.getX();
int y1 = e1.getY();
g.setColor(Color.BLACK);
GraphicsUtil.switchToWidth(g, 3);
if (direction == HORIZONTAL) {
if (x0 != x1)
g.drawLine(x0, y0, x1, y0);
if (y0 != y1)
g.drawLine(x1, y0, x1, y1);
} else if (direction == VERTICAL) {
if (y0 != y1)
g.drawLine(x0, y0, x0, y1);
if (x0 != x1)
g.drawLine(x0, y1, x1, y1);
}
} else if (AppPreferences.ADD_SHOW_GHOSTS.getBoolean() && inCanvas) {
g.setColor(Color.GRAY);
g.fillOval(cur.getX() - 2, cur.getY() - 2, 5, 5);
}
}
示例10: drawPoint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
* It draws the points contained in a vector. The coordinates of the point must be insered
* in a Point2D object
* @param g The graphic object
* @param points The Vector who contains the points
* @param c The color of the points
*/
public void drawPoint(Graphics g, Vector<Point2D> points, Color c, int size) {
for (int j = 0; j < points.size(); j++) {
Point2D p = points.get(j);
g.setColor(c);
g.fillOval((int) (p.getX() * scale) - ((size / 2)) + tran_x, tran_y - (int) (p.getY() * scale) - ((size / 2)), size, size);
}
}
示例11: getJobIcon
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public Image getJobIcon(Rectangle bounds) {
int width = 100, height = 100;
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics g = bi.getGraphics();
g.setColor(new Color(0, 0, 0, 50));
g.fillOval(0, 0, width, height);
for (int i = 0, monoChannel = 0; i < 10; i++, monoChannel = (int) ((1 - Math.exp(-i * 0.5)) * 255)) {
g.setColor(new Color(monoChannel, monoChannel, monoChannel, 255));
int r = (int) Math.pow(i, 1.5), s = (int) (r * 2.9);
g.fillOval(r, r, width - s, height - s);
}
return bi.getScaledInstance(bounds.width, bounds.height, Image.SCALE_SMOOTH);
}
示例12: 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);
}
}
示例13: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
g.setColor(new Color(0, 0, 0, 120));
g.fillOval(16, 10, 105, 140);
g.drawImage(Img.getCirculo(Images.CARD_NEVOA, 0, 0, 110, 145).getImage(),
15, 7, null);
}
示例14: paintComponent
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
double[] x = model.getListObservations();
super.paintComponent(g);
g.setColor(Color.WHITE);
g.fillRect(0, 0, 202, 202);
//Draw Border
g.setColor(Color.BLACK);
g.drawRect(0, 0, 202, 202);
//Draw gray lines\
Graphics2D g1 = (Graphics2D) g;
g1.setColor(Color.LIGHT_GRAY);
for (int i = 1; i < 9; i++) {
g1.drawLine(1, 1 + (i * (202 / 9)), 201, 1 + (i * (202 / 9)));
g1.drawLine(1 + (i * (202 / 9)), 1, 1 + (i * (202 / 9)), 202);
}
g1.setColor(Color.BLACK);
for (int i = 1; i < 9; i++) {
g1.drawLine(1, 1 + (i * (202 / 9)), 6, 1 + (i * (202 / 9)));
g1.drawLine(1 + (i * (202 / 9)), 1, 1 + (i * (202 / 9)), 6);
g1.drawLine(197, 1 + (i * (202 / 9)), 202, 1 + (i * (202 / 9)));
g1.drawLine(1 + (i * (202 / 9)), 198, 1 + (i * (202 / 9)), 202);
}
//Draw graph
//Draw reference line
g.setColor(Color.BLUE);
for (int i = 0; i < x.length; i++) {
g.fillOval((int) Math.round((x[i] / x[x.length-1]) * 200),
200 - (int) Math.round((i*(1d/x.length)) * 200), 5, 5);
}
//g.fillOval(200,1, 5, 5);
}
示例15: createRVImage
import java.awt.Graphics; //导入方法依赖的package包/类
private static BufferedImage createRVImage(int size, Color color) {
BufferedImage image = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
Graphics g = image.createGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, size, size);
g.setColor(color);
g.fillOval(0, 0, size, size);
g.dispose();
return image;
}