用java画填充的圆弧

package 绘制图形;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class drawFillArc extends JFrame{
    public static void main(String args[]) {
        new drawFillArc();

}
    public drawFillArc() {
        // TODO Auto-generated constructor stub
        Toolkit kit = java.awt.Toolkit.getDefaultToolkit();
        Dimension screen = kit.getScreenSize();
        int width = screen.width;
        int hight = screen.height;
        this.setTitle("画填充弧");
        this.add(new DrawFillArcPanel());
        this.setVisible(true);
        this.setBounds(width/4, hight/4, 300,200);
        this.setDefaultCloseOperation(3);
    }

}
class DrawFillArcPanel extends JPanel{
    public void paint(Graphics g) {
        /****drawArc(int x,int y,int width 
         ,int height,int startAngle,int arcAngle)
         x,y代表坐标  width,height代表弧要画的宽度与高度
         startAngle代表开始以哪个角度画起,arcAngle以startAngle为基础,横跨的角度
         ****/
    
        g.fillArc(40, 20, 80, 80, 0, 120);
        g.fillArc(30, 25, 80, 80, 120,120);
        g.fillArc(40, 30, 80, 80, 0, -120);
        
        
        
    }
}
用java画填充的圆弧_第1张图片
填充圆弧.png

你可能感兴趣的:(用java画填充的圆弧)