Fill an Arc with fillArc in Java
Description
The following code shows how to fill an Arc with fillArc.
Example
import java.awt.Color;
import java.awt.Graphics;
/*from w w w . ja v a 2s . co m*/
import javax.swing.JComponent;
import javax.swing.JFrame;
class MyCanvas extends JComponent {
public void paint(Graphics g) {
g.setColor(Color.RED);
g.fillArc(20, 20, 200, 200,200,200);
}
}
public class Main {
public static void main(String[] a) {
JFrame window = new JFrame();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setBounds(30, 30, 450, 450);
window.getContentPane().add(new MyCanvas());
window.setVisible(true);
}
}
The code above generates the following result.