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

📄 piechart1.java

📁 管理系统实现的源代码,
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package 学生成绩管理系统;import java.awt.*;import javax.swing.*;public class  PieChart1 extends JPanel {    private int A;    private int B;    private int C;    private int D;    private int E;    public void set(int aR,int bR,int cR,int dR,int eR)    {               A=aR;        B=bR;        C=cR;        D=dR;        E=eR;        }        public PieChart1(){   //     repaint();    }    @Override  protected void paintComponent(Graphics g) {    super.paintComponent(g);    int w = getWidth();    int h = getHeight();    int xCenter = w / 2;    int yCenter = h / 2;    int radius = (int)(Math.min(w, h) * 0.8 / 2);    int x = xCenter - radius;    int y = yCenter - radius;   g.setColor(new Color(255,153,153));   // g.setColor(Color.red);    g.fillArc(x, y, 2 * radius, 2 * radius, 0, (int)(360*A/(A+B+C+D+E)));    g.setColor(new Color(153,255,204));    g.fillArc(x, y, 2 * radius, 2 * radius, (int)(360*A/(A+B+C+D+E)),    (int)(360*B/(A+B+C+D+E)));    g.setColor(Color.black);    g.setColor(new Color(153,153,255));    g.fillArc(x, y, 2 * radius, 2 * radius,(int)(360*(A+B)/(A+B+C+D+E)),      (int)(360*C/(A+B+C+D+E)));    g.setColor(Color.black);       g.setColor(new Color(153,153,153));    g.fillArc(x, y, 2 * radius, 2 * radius, (360*(A+B+C)/(A+B+C+D+E)),     (360*D/(A+B+C+D+E)));    g.setColor(Color.black);    g.setColor(Color.yellow);    g.fillArc(x, y, 2 * radius, 2 * radius, (360*(A+B+C+D)/(A+B+C+D+E)),    (360*E/(A+B+C+D+E)));  }}

⌨️ 快捷键说明

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