⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drawfilloval1.java

📁 学生成绩管理系统:能输入学科
💻 JAVA
字号:
import java.awt.*;import javax.swing.*;/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author HSM */public class DrawFillOval1 extends JPanel{  //画圆形图像类			private int[] shu=new int[5];	private int[] temp=new int[5];	private String[] string=new String[5];		 DrawFillOval1(int[] shu,int[] shu2){	this.shu=shu;		temp[0]=shu[0];	temp[1]=shu[0]+shu[1];	temp[2]=shu[0]+shu[1]+shu[2];	temp[3]=shu[0]+shu[1]+shu[2]+shu[3];	temp[4]=shu[0]+shu[1]+shu[2]+shu[3]+shu[4];    string[0]=String.valueOf((double)shu2[0]/10)+"%";    string[1]=String.valueOf((double)shu2[1]/10)+"%";    string[2]=String.valueOf((double)shu2[2]/10)+"%";    string[3]=String.valueOf((double)shu2[3]/10)+"%";    string[4]=String.valueOf((double)shu2[4]/10)+"%";	}    @Override	protected void paintComponent(Graphics g){	   	super.paintComponent(g);	    g.drawString("≥90分",50,45);	   	g.drawString(string[0],(int)(240+120*Math.cos((temp[0]-shu[0]/2)*Math.PI/180)),(int)(140-120*Math.sin((temp[0]-shu[0]/2)*Math.PI/180)));	    g.drawString("80-89分",50,75);		g.drawString(string[1],(int)(240+120*Math.cos((temp[1]-shu[1]/2)*Math.PI/180)),(int)(140-120*Math.sin((temp[1]-shu[1]/2)*Math.PI/180)));		g.drawString("70-79分",50 ,105);		g.drawString(string[2],(int)(240+120*Math.cos((temp[2]-shu[2]/2)*Math.PI/180)),(int)(140-120*Math.sin((temp[2]-shu[2]/2)*Math.PI/180)));		g.drawString("60-69分",50 ,135);		g.drawString(string[3],(int)(240+120*Math.cos((temp[3]-shu[3]/2)*Math.PI/180)),(int)(140-120*Math.sin((temp[3]-shu[3]/2)*Math.PI/180)));		g.drawString("<60分",50,165);		g.drawString(string[4],(int)(240+120*Math.cos((temp[4]-shu[4]/2)*Math.PI/180)),(int)(140-120*Math.sin((temp[4]-shu[4]/2)*Math.PI/180)));						g.setColor(Color.red);		g.fillRect(20, 30, 20, 20);		g.fillArc(160,35,200,200,0,shu[0]);		g.setColor(Color.black);		g.fillRect(20, 60, 20, 20);		g.fillArc(160,35,200,200,temp[0],shu[1]);		g.setColor(Color.yellow);		g.fillRect(20, 90, 20, 20);		g.fillArc(160,35,200,200,temp[1],shu[2]);		g.setColor(Color.blue);		g.fillRect(20, 120, 20, 20);		g.fillArc(160,35,200,200,temp[2],shu[3]);		g.setColor(Color.green);		g.fillRect(20, 150, 20, 20);		g.fillArc(160,35,200,200,temp[3],shu[4]);			}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -