发新话题
打印

[推荐] 颜色和线条变化 -- JAVA程序

颜色和线条变化 -- JAVA程序

用TEXTPAD运行下看看效果~~

import java.awt.*;
import javax.swing.*;
public class ColorAndLine extends JFrame{
static int i=0;
public ColorAndLine(){
  super("using color and line");
  setSize(800,400);
  setVisible(true);
}
public void paint(Graphics g){
  
// Gui gui=new Gui();
  super.paint(g);
  
  while(i<999999999)
{//System.out.print((int)(Math.random()*100));
     g.setColor(new Color((int)(Math.random()*250),(int)(Math.random()*250),(int)(Math.random()*250)));
  g.drawLine((int)(Math.random()*1000),(int)(Math.random()*1000),(int)(Math.random()*1000),(int)(Math.random()*1000));
repaint();
Gui gui=new Gui();
gui.start();
i++;
}
}
public static void main(String args[]){
  
  ColorAndLine application=new ColorAndLine();
  application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class Gui extends Thread{
public Gui(){
}
public void run(){
  try{Thread.sleep(999999999);
  
  }
  catch(Exception e){
  }
}
}
本人吵架挨吵骂人挨骂支持断点续传!

TOP

发新话题