烟花java程序详细解释_⼀个漂亮的java烟花程序
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;
public class ChatApplet extends Applet implements MouListener,Runnable
{ int x,y; int top,point;
保护鸟类的宣传语/***对⼩程序进⾏变量和颜⾊的初始化。*/
public void init() { x = 0; y = 0;
//设置背景⾊为⿊⾊
tBackground(Color.black);
addMouListener(this);
} public void paint(Graphics g) { }
/** *使该程序可以作为应⽤程序运⾏。 */事迹材料
红茶解药吗
public static void main(String args[])
{ ChatApplet applet = new ChatApplet();
JFrame frame = new JFrame("TextAreaNew");
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e){
} });
frame.tSize(800,400);
applet.init();
applet.start();
frame.tVisible(true);
} /***程序主线程,对⼀个烟花进⾏绘制。*/
public void run()
{
//变量初始化
Graphics g1;
g1 = getGraphics();
我的前半生简介int y_move,y_click,x_click;
int v;
x_click = x;
y_click = y;
y_move = 400;
v = 3; int r,g,b;
while(y_move > y_click)
{
g1.tColor(Color.black);
g1.fillOval(x_click,y_move,5,5);
狼王梦的读后感y_move -= 5;
r = (((und(Math.random()*4321))%200)+55;
g = (((und(Math.random()*4321))%200)+55;
b = (((und(Math.random()*4321))%200)+55; g1.tColor(new Color(r,g,b));
g1.fillOval(x_click,y_move,5,5);
for(int j = 0 ;j<=10;j++)
{
if(r>55) r -= 20;
if(g>55) g -= 20;
if(b>55) b -=20;
g1.tColor(new Color(r,g,b));
g1.fillOval(x_click,y_move+j*5,5,5);
g1.tColor(Color.black);
g1.fillOval(x_click,y_move+5*10,5,5);
try { Thread.currentThread().sleep(v++);
}
catch (InterruptedException e) {}
}
for(int j=12;j>=0;j--)
中国银行账户查询
{
g1.tColor(Color.black);
g1.fillOval(x_click,y_move+(j*5),5,5);
try {
Thread.currentThread().sleep((v++)/3);
}
catch (InterruptedException e) {} }
实习面试自我介绍
y_move = 400; g1.tColor(Color.black);
while(y_move > y_click)
{ g1.fillOval(x_click-2,y_move,9,5);
y_move -= 5;
} v = 15;
for(int i=0;i<=25;i++) { r = (((und(Math.random()*4321))%200)+55;
蓝球赛
g = (((und(Math.random()*4321))%200)+55;
b = (((und(Math.random()*4321))%200)+55;
g1.tColor(new Color(r,g,b));
g1.drawOval(x_click-3*i,y_click-3*i,6*i,6*i);
if(i<23)
{ g1.drawOval(x_click-3*(i+1),y_click-3*(i+1),6*(i+1),6*(i+1));
g1.drawOval(x_click-3*(i+2),y_click-3*(i+2),6*(i+2),6*(i+2));
}
try
{ Thread.currentThread().sleep(v++);
} catch (InterruptedException e) {}
g1.tColor(Color.black);
g1.drawOval(x_click-3*i,y_click-3*i,6*i,6*i);
/***对⿏标事件进⾏监听。*临听其⿏标按下事件。*当按下⿏标时,产⽣⼀个新线程。*/ public void mouPresd(MouEvent e)
{
x = e.getX();
y = e.getY();
Thread one;
one = new Thread(this);
one.start(); one = null;
}
/** *实现MouListener接中的⽅法。为⼀个空⽅法。 */
public void mouRelead(MouEvent e) {
}
/** *实现MouListener接中的⽅法。为⼀个空⽅法。 */
public void mouEntered(MouEvent e) { }
/** *实现MouListener接中的⽅法。为⼀个空⽅法。 */
public void mouExited(MouEvent e) { }
/** *实现MouListener接中的⽅法。为⼀个空⽅法。 */
public void mouClicked(MouEvent e) { }
}