文件名称:javafirework
介绍说明--下载内容来自于网络,使用问题请自行百度
Java烟花特效代码,用鼠标点击浏览器中的面板,将出现五彩缤纷的烟花效果。要用到的Java知识点有:鼠标事件的监听,Graphics类和Thread类的应用。使用Graphics类:绘制烟花,使用Thread类:管理线程,使用Math类:产生随机数,使用Color类:设置颜色。
实现思路:Java模拟烟花效果,首先定义主线程的函数run()对一个烟花进行绘制。在函数run()中定义Graphics类的对象,通过程序中的算法来绘制烟花。然后实现烟花的缤纷闪烁效果,通过Thread类的Thread.currentThread().sleep()方法使当前线程睡眠,让用户欣赏到当前的绘制效果。最后实现人机交互,通过mousePressed(MouseEvent e)函数来实现对鼠标事件的监听,当按下鼠标时,产生一个新线程就可以看到一个新的烟花效果。-Java fireworks effects code, use the mouse to click on the browser panel, colorful fireworks effect will appear. To use the Java knowledge points are: listening, Graphics class and the Thread class application mouse events. Use the Graphics class: Draw fireworks, use the Thread class: Managing threads, use the Math class: generate random numbers, use the Color class: set the color. Realization of ideas: Java simulation fireworks effects, first define the function of the main thread run () on a fireworks draw. (As defined in the Graphics class object in the function run), to draw fireworks through the program algorithm. Then realize fireworks shimmering effect, (). Sleep () method makes the current thread to sleep through the Thread class Thread.currentThread, allowing users to enjoy the effects of the current drawing. Finally, to achieve human-computer interaction, through mousePressed (MouseEvent e) function to achieve the mouse event listener, when you press the mouse button to creat
实现思路:Java模拟烟花效果,首先定义主线程的函数run()对一个烟花进行绘制。在函数run()中定义Graphics类的对象,通过程序中的算法来绘制烟花。然后实现烟花的缤纷闪烁效果,通过Thread类的Thread.currentThread().sleep()方法使当前线程睡眠,让用户欣赏到当前的绘制效果。最后实现人机交互,通过mousePressed(MouseEvent e)函数来实现对鼠标事件的监听,当按下鼠标时,产生一个新线程就可以看到一个新的烟花效果。-Java fireworks effects code, use the mouse to click on the browser panel, colorful fireworks effect will appear. To use the Java knowledge points are: listening, Graphics class and the Thread class application mouse events. Use the Graphics class: Draw fireworks, use the Thread class: Managing threads, use the Math class: generate random numbers, use the Color class: set the color. Realization of ideas: Java simulation fireworks effects, first define the function of the main thread run () on a fireworks draw. (As defined in the Graphics class object in the function run), to draw fireworks through the program algorithm. Then realize fireworks shimmering effect, (). Sleep () method makes the current thread to sleep through the Thread class Thread.currentThread, allowing users to enjoy the effects of the current drawing. Finally, to achieve human-computer interaction, through mousePressed (MouseEvent e) function to achieve the mouse event listener, when you press the mouse button to creat
(系统自动生成,下载前可以参看下载内容)
下载文件列表
烟花/Fireworks.class
烟花/Fireworks.html
烟花/Fireworks.java
烟花/_desktop.ini
烟花/烟花.doc
烟花
烟花/Fireworks.html
烟花/Fireworks.java
烟花/_desktop.ini
烟花/烟花.doc
烟花
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.