62,628
社区成员
发帖
与我相关
我的任务
分享
public void paint(Graphics g)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawLine(iter*100, 610, 215, 800);
g2d.setColor(Color.black);
g2d.fillRect(99, 100, 2, 600);
g2d.fillRect(99, 700, 600, 2);
g2d.fillRect(100, 685, 15, 15);
……
为了传入参数,我自己写了一个方法如下:
public static void getP(int iter){
test8888.iter = iter;
JFrame jf = new JFrame();
jf.setSize(900, 900);
jf.setVisible(true);
jf.setDefaultCloseOperation(3);
jf.getContentPane().add(new test8888());
}
主函数:(这个可以正确运行)
public static void main(String[] args)
{
JFrame jf = new JFrame();
jf.setSize(900, 900);
jf.setVisible(true);
jf.setDefaultCloseOperation(3);
jf.getContentPane().add(new test8888());
}