📄 407334d5ed85001c137e8d39bfadea2c
字号:
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
public class Drawpicture extends Frame
{
public void paint(Graphics g)
{
int i=0;
Graphics2D g2=(Graphics2D)g;
Font f1=new Font("包",Font.BOLD,15);
Font f2=new Font("数",Font.BOLD,15);
Font f3=new Font("/",Font.BOLD,15);
Font f4=new Font("个",Font.BOLD,15);
Font f5=new Font("时间/秒",Font.BOLD,15);
Line2D.Double Line1=new Line2D.Double(40.0,40.0,40.0,300.0);
Line2D.Double Line2=new Line2D.Double(40.0,300.0,400.0,300.0);
Line2D.Double Line3=new Line2D.Double(40.0,40.0,37.0,43.0);
Line2D.Double Line4=new Line2D.Double(40.0,40.0,43.0,43.0);
Line2D.Double Line5=new Line2D.Double(298.0,198.0,300.0,200.0);
Line2D.Double Line6=new Line2D.Double(298.0,202.0,300.0,200.0);
g2.setPaint(Color.BLACK );
g2.draw(Line1);
g2.draw(Line2);
g2.draw(Line3);
g2.draw(Line4);
g2.draw(Line5);
g2.draw(Line6);
g2.setFont(f1);
g2.drawString("包", 20, 55);
g2.setFont(f2);
g2.drawString("数", 20, 70);
g2.setFont(f3);
g2.drawString(" /", 20, 85);
g2.setFont(f4);
g2.drawString("个", 20, 100);
g2.setFont(f5);
g2.drawString("时间/秒", 320,325);
double j=195.0;
do
{ Line2D.Double Line7=new Line2D.Double(40.0,j,290.0,j);
g2.setPaint(Color.BLUE);
g2.draw(Line7);
j-=5;
}while(j>=45.0);
while(i<=Catchpic.perpack_i)
{ g2.setPaint(Color.BLACK);
Rectangle2D.Double rec=new Rectangle2D.Double(40+(i+1)*10,200-Catchpic.perpack[i],5,Catchpic.perpack[i]);
g2.draw(rec);
g2.setStroke(new BasicStroke(2));
i++;
}
}
public Drawpicture()
{
this.addWindowListener
(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Drawpicture.this.windowClosed();
}
}
);
this.setTitle("数据包流量变化统计直观图");
this.setVisible(true);
this.pack();
}
protected void windowClosed() {
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -