真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

java雨花特效代碼 java下雨特效

跨年特效代碼

package love;import java.applet.Applet;import java.awt.Color;import java.awt.Graphics;import java.net.URL;import java.util.Random;/*** 煙花* @author enjoy**/@SuppressWarnings("serial")public class Q extends Applet implements Runnable {public int speed, variability, Max_Number, Max_Energy, Max_Patch,Max_Length, G;public String sound;private int width, height;? ? ? ? ? ? ? ?private Thread thread = null;? ? ? ? ? ? ? ?private BeaClassDemo bcd[];? ? ? ? ? ? ? ?public void init() {? ? ? ? ? ? ? ? ? ? ? ?int i;this.setSize(1900, 900);? ? ? ? ? ? ? ??width = getSize().width - 1;height = getSize().height - 1;speed = 1;? ? ? ? ? ? ? ? ? ? ? ? // 煙花綻放的速度variability = 10;Max_Number = 980;? ? ? ? ? ? ? ? ? ? // 可發(fā)出煙花的最大數(shù)目Max_Energy = width + 50;Max_Patch = 90;? ? ? ? ? ? ? ? ? ? // 最大的斑點數(shù)Max_Length = 90;? ? ? ? ? ? ? ? ? ? // 斑點的最大距離G = 150;? ? ? ? ? ? ? ? ? ? ? ? ? ? // 向地面彎曲的力度bcd = new BeaClassDemo[Max_Number];? ? ? ? ? ?for (i = 0; i Max_Number; i++)bcd[i] = new BeaClassDemo(width, height, G);? ?}public void start() {? ? ? ?if (thread == null) {thread = new Thread(this);thread.start();}}@SuppressWarnings("deprecation")public void stop() {? ? ? ?if (thread != null) {thread.stop();thread = null;}}@SuppressWarnings({ "unused", "static-access" })public void run() {int i;int E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4 + 1;int P = (int) (Math.random() * Max_Patch * 3 / 4)? ? // 煙花的斑點數(shù)+ Max_Patch / 4 + 1;int L = (int) (Math.random() * Max_Length * 3 / 4)? ? // 煙花可發(fā)射出的距離+ Max_Length / 4 + 1;long S = (long) (Math.random() * 10000);? ? ? ? ? ?boolean sleep;? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Graphics g = getGraphics();URL u = null;while (true) {try {thread.sleep(1000 / speed);} catch (InterruptedException x) {}sleep = true;for (i = 0; i Max_Number; i++)sleep = sleep bcd[i].sleep;if (sleep Math.random() * 100 variability) {E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4+ 1;P = (int) (Math.random() * Max_Patch * 3 / 4) + Max_Patch / 4+ 1;L = (int) (Math.random() * Max_Length * 3 / 4) + Max_Length / 4+ 1;S = (long) (Math.random() * 10000);}for (i = 0; i Max_Number; i++) {if (bcd[i].sleep Math.random() * Max_Number * L 1) {bcd[i].init(E, P, L, S);bcd[i].start();}bcd[i].show(g);}}}public void paint(Graphics g) {? ? ? ? ? ? ? ? ? ?g.setColor(Color.black);? ? ? ? ? ? ? ? ? ?g.fillRect(0, 0, width + 1, height + 1);? ? ? ?}}class BeaClassDemo {public boolean sleep = true;private int energy, patch, length, width, height, G, Xx, Xy, Ex[], Ey[], x,y, Red, Blue, Green, t;private Random random;? ? ? ? ? ? ? ? ? ? ? ?public BeaClassDemo(int a, int b, int g) {? ? ? ? ? ?width = a;height = b;G = g;}public void init(int e, int p, int l, long seed) {int i;energy = e;patch = p;length = l;// 創(chuàng)建一個帶種子的隨機數(shù)生成器random = new Random(seed);Ex = new int[patch];? ? ? ? ? ? ? ? ? ? ? ?Ey = new int[patch];? ? ? ? ? ? ? ? ? ?Red = (int) (random.nextDouble() * 128) + 128;Blue = (int) (random.nextDouble() * 128) + 128;Green = (int) (random.nextDouble() * 128) + 128;Xx = (int) (Math.random() * width / 2) + width / 4;Xy = (int) (Math.random() * height / 2) + height / 4;for (i = 0; i patch; i++) {Ex[i] = (int) (Math.random() * energy) - energy / 2;Ey[i] = (int) (Math.random() * energy * 7 / 8) - energy / 8;

創(chuàng)新互聯(lián)網(wǎng)站建設(shè)提供從項目策劃、軟件開發(fā),軟件安全維護、網(wǎng)站優(yōu)化(SEO)、網(wǎng)站分析、效果評估等整套的建站服務(wù),主營業(yè)務(wù)為網(wǎng)站設(shè)計制作、成都做網(wǎng)站,重慶App定制開發(fā)以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。創(chuàng)新互聯(lián)深信只要達到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!

回答于?2023-02-22

向TA提問

官方服務(wù)

官方網(wǎng)站

官方網(wǎng)站

求java公告欄特效代碼

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

public class Test{

private JFrame frame;

private String scrolledText;

private String str ="滾動文字 Demo";

public static void main(String args[]) {

try{

Test window = new Test();

window.frame.setVisible(true);

}

catch(Exception e){

e.printStackTrace();

}

}

public Test(){

initialize();

}

private void initialize(){

frame.setBounds(100, 100, 500, 375);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JPanel panel = new JPanel();

panel.setBackground(Color.WHITE);

panel.setLayout(new BorderLayout());

frame.getContentPane().add(panel, BorderLayout.NORTH);

final JLabel label = new JLabel();

label.setText("New JLabel");

panel.add(label);

label_scrolledText(label);

frame.addComponentListener(

new ComponentAdapter(){

public void componentResized(ComponentEvent arg0){

label_scrolledText(label);

}

});

}

public void label_scrolledText(JLabel label) {

this.scrolledText = this.str;

label.setText(scrolledText);

FontMetrics metrics = label.getFontMetrics(label.getFont());

int textW = metrics.stringWidth(label.getText());

Dimension frameSize = frame.getSize();

for (int i = 1; i = (frameSize.width - textW) / 3 - 3; i++)

scrolledText += " ";

label.setText(scrolledText);

Thread thread = new Thread(new TextChanger(label));

thread.start();

}

}

java.lang.NullPointerException

at Test.initialize(Test.java:26)

at Test.init(Test.java:23)

at Test.main(Test.java:16)

java 能否實現(xiàn)桌面下雪花的效果?使用swing?

/*

*實現(xiàn)在窗體上隨機布滿300個雪花("*"),滾動

*在上次的課基礎(chǔ)上增加了for循環(huán)(一次要產(chǎn)生300個變量),隨機數(shù),數(shù)組 ;

*下面的序號為步驟

*/ import java.awt.* ; //(3)導(dǎo)入awt包

public class Star {

public static void main(String args[]) {

Frame w = new Frame() ; //(1)繪制窗體

w.setSize(1024,768) ; //(4)把窗體布滿全屏

w.setBackground(Color.BLACK) ; //(5)背景為黑顏色

MyPanel mp = new MyPanel() ; //(7)把MyPanel對象mp,添加到窗體w上

w.add(mp) ;

Thread t = new Thread(mp) ;

t.start() ; //(12)啟動線程

w.show(); //(2)顯示窗體

}

}

//(6)繼承Panel類

class MyPanel extends Panel implements Runnable { //(11)實現(xiàn)Runnable接口

int x[] = new int[300] ;

int y[] = new int[300] ; //(8)定義300個數(shù)組變量 MyPanel(){

for(int i = 0;i 300; i++) {

x[i] = (int)(Math.random()*1024) ;

y[i] = (int)(Math.random()*768) ; //(9)當(dāng)程序走到第6步的時候程序就會調(diào)用構(gòu)成函數(shù)

} //由于隨機數(shù)是從0-1之間的數(shù)任意產(chǎn)出所以x乘以1024,y乘以768再轉(zhuǎn)換為int類型

}

public void paint(Graphics g) {

for(int i = 0;i 300; i++) {

g.setColor(Color.WHITE) ;

g.drawString("*",x[i],y[i]) ;

//g.drawString("*",30,30) ;(7)繪制一個星星在屏幕的x=30,y=30的位置上

} //(10)繪制300個雪花,把坐標(biāo)30,30,改成x[i],y[i] ;

} //做到這步可以實現(xiàn)在黑色的天空布滿300個星星

public void run() {

while(true) { //(13)實現(xiàn)產(chǎn)生300個雪花往下落死循環(huán)

for(int i = 0 ; i 300; i++) {

y[i]++ ; //(14)y坐標(biāo)不斷的+1

if(y[i] 768){ //(18)如果y軸坐標(biāo)大于768時,則y = 0,回到窗體的頂部

y[i] = 0 ;

}

}

try{ //(16)用try,catch解決線程休眠的異常

Thread.sleep(20) ; //(15)在每次y軸坐標(biāo)+1后線程休眠20毫秒

}catch(Exception e) {}

repaint() ; //(17)雪花在新的位置重畫

}

}

}

頁面特效:下星星的代碼(JAVA代碼)

以下的代碼就可以,lz自己在*的地方填入星星的圖片就可以了

body bgcolor=#ee3300

style

.drop { position: absolute; width: 3; filter: flipV(), flipH(); font-size: 40; color: #ffffff }

/style

script language="javascript"

snow = false; // false-rain; true-snow

snowsym = " * " are the symbols for each

rainsym = " * " can put images here.

howmany = 20 many drops/snowflakes?

/**************Do not need to change anything below***********/

if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}

else{sym = rainsym; speed=30; drops=howmany; angle=6}

movex = -speed/angle; movey = speed; count = 0;

function moverain(){

for(move = 0; move drops; move++){

xx[move]+=movex; yy[move]+=mv[move];

hmm = Math.round(Math.random()*1);

if(xx[move] 0){xx[move] = maxx+10;}

if(yy[move] maxy){yy[move] = 10;}

drop[move].left = xx[move]

drop[move].top = yy[move]+document.body.scrollTop;

}setTimeout('moverain()','1')}

/script

script language="javascript"

if (document.all){

drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()

ly = "document.all[\'"; st = "\'].style"

for(make = 0; make drops; make++){

document.write('div id="drop'+make+'" class=drop'+sym+'/div');

drop[make] = eval(ly+'drop'+make+st);

maxx = document.body.clientWidth-40

maxy = document.body.clientHeight-40

xx[make] = Math.random()*maxx;

yy[make] = -100-Math.random()*maxy;

drop[make].left = xx[make]

drop[make].top = yy[make]

mv[make] = (Math.random()*5)+speed/16;

drop[make].fontSize = (Math.random()*10)+20;

if(snow){col = 'white'}else{col = 'white'}

drop[make].color = col;

}

window.onload=moverain

}

/script

/body


網(wǎng)站標(biāo)題:java雨花特效代碼 java下雨特效
文章路徑:http://weahome.cn/article/ddcegdh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部