Example usage for java.awt Graphics drawOval

List of usage examples for java.awt Graphics drawOval

Introduction

In this page you can find the example usage for java.awt Graphics drawOval.

Prototype

public abstract void drawOval(int x, int y, int width, int height);

Source Link

Document

Draws the outline of an oval.

Usage

From source file:edu.ku.brc.ui.GraphicsUtils.java

/**
 * Draws a circle using the given graphics context, centered at <code>(x,y)</code>,
 * having the given diameter./*from w  w w . ja  v a  2s .c om*/
 * 
 * @see #fillCircle(Graphics, int, int, int)
 * @param g the graphics context to draw in
 * @param x the x coordinate for the center of the circle
 * @param y the y coordinate for the center of the circle
 * @param diameter the diameter of the circle
 */
public static void drawCircle(Graphics g, int x, int y, int diameter) {
    ((Graphics2D) g).addRenderingHints(hints);
    g.drawOval(x - diameter / 2, y - diameter / 2, diameter, diameter);
}

From source file:Main.java

public void paint(Graphics g) {
    g.drawOval(25, 25, 120, 120);
}

From source file:MyCanvas.java

public void paint(Graphics g) {
    g.drawOval(10, 10, 200, 200);
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.drawOval(25, 25, 120, 120);

}

From source file:MainClass.java

public void paint(Graphics g) {
    g.setColor(Color.yellow);
    g.drawOval(5, 15, 50, 75);
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.drawOval(10, 10, 50, 50);
    g.fillOval(100, 10, 75, 50);
    g.drawOval(190, 10, 90, 30);
    g.fillOval(70, 90, 140, 100);
}

From source file:TestOval.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    g.drawOval(x, y, width - 1, height - 1);
}

From source file:Main.java

public void actionPerformed(ActionEvent evt) {
    Graphics g = getGraphics();
    Point p = getClick();//  w  w w .j a v a 2s . com
    g.drawOval(p.x - 2, p.y - 2, 4, 4);
    Point q = getClick();
    g.drawOval(q.x - 2, q.y - 2, 4, 4);
    g.drawLine(p.x, p.y, q.x, q.y);
    g.dispose();
}

From source file:Main.java

public void paintComponent(Graphics g) {
    int width = getWidth();
    int height = getHeight();
    g.setColor(Color.black);//ww  w . jav a2 s .c o m
    g.drawOval(0, 0, width, height);
}

From source file:OvalPanel.java

License:asdf

public void paintComponent(Graphics g) {
    int width = getWidth();
    int height = getHeight();
    g.setColor(color);/*from w w w  . j  a v  a2s  .  c  o m*/
    g.drawOval(0, 0, width, height);
}