📄 stat.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */import javax.swing.*;import java.awt.event.*;import java.awt.*;/** * * @author Administrator */public class Stat extends JDialog{ public Stat(StuFrame sf){ super(sf,"成绩分布统计对话框",true); setSize(400,300); owner = sf; a = Math.round(owner.statArr[0]*3.6f); b = Math.round(owner.statArr[1]*3.6f); c = Math.round(owner.statArr[2]*3.6f); d = Math.round(owner.statArr[3]*3.6f); setContentPane(new StatPanel()); } class StatPanel extends JPanel{ public void paintComponent(Graphics g){ super.paintComponents(g); g.setColor(Color.YELLOW); g.fillArc(x, y, w, w, 0, a); g.fillRect(190, 40, 10, 10); g.setColor(Color.GREEN); g.fillArc(x, y, w, w, a, b); g.fillRect(190, 90, 10, 10); g.setColor(Color.BLUE); g.fillArc(x, y, w, w, a+b, c); g.fillRect(190, 140, 10, 10); g.setColor(Color.RED); g.fillArc(x, y, w, w, a+b+c, d); g.fillRect(190, 190, 10, 10); g.setColor(Color.BLACK); g.drawString("优秀占"+Math.round(owner.statArr[0]*100)/100.0+"%", 200,50); g.drawString("良好占"+Math.round(owner.statArr[1]*100)/100.0+"%", 200,100); g.drawString("中等占"+Math.round(owner.statArr[2]*100)/100.0+"%", 200,150); g.drawString("不及格占"+Math.round(owner.statArr[2]*100)/100.0+"%", 200,200); } } int a,b,c,d;int x = 20;int y = 50;int w = 160;StuFrame owner;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -