欢迎来到天天文库
浏览记录
ID:38676742
大小:56.50 KB
页数:10页
时间:2019-06-17
《池塘夜降彩色雨》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、//MyApplet.javaimportsun.audio.*;importjava.applet.*;importjava.io.*;publicclassMyAppletextendsApplet{publicvoidinit(){try{InputStreamin=new FileInputStream("D:\Audio\gao.wav");InputStreamin2=new FileInputStream("D:\Audio\feng.wav");AudioStreamas=newAudioStream
2、(in);AudioStreamas2=new AudioStream(in2);AudioPlayer.player.start(as);AudioPlayer.player.start(as2);}catch(IOExceptione){e.printStackTrace();}}@Overridepublicvoidstart(){try{InputStreamin1=new FileInputStream("D:\Audio\sheji.wav");AudioStreamas1=new AudioStream(in
3、1);AudioPlayer.player.start(as1);}catch(IOExceptione){e.printStackTrace();}}}//MyJFrame.javaimportjava.awt.*;importjavax.swing.*;publicclassMyJFrameextendsJFrameimplementsRunnable{MyJPanelpanel;MyAppletapplet;Imageimage;publicMyJFrame(Strings){super(s);Threadt=newTh
4、read(this);t.start();applet=newMyApplet();this.add(applet);this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);this.setBounds(100,50,900,600);panel=newMyJPanel(900,600);this.add(panel,BorderLayout.CENTER);this.setVisible(true);}publicstaticvoidmain(String[]args){ne
5、wMyJFrame("池塘夜降彩色雨");}privatevoidlaunch(){applet.init();}privatevoidlaunch1(){applet.start();}@Overridepublicvoidrun(){while(true){try{Thread.sleep(6000);this.launch();newMyJPanel().flag=true ;Thread.sleep(4000);this.launch1();}catch(InterruptedExceptione){e.printSt
6、ackTrace();}}}}importjava.awt.*;importjava.awt.image.AreaAveragingScaleFilter;importjava.awt.image.FilteredImageSource;importjavax.swing.*;importjava.util.*;publicclassMyJPanelextendsJPanelimplementsRunnable{publicstaticbooleanflag=false;publicintheight;publicintwei
7、ght;Rainsrains;Imageimage;Imageimg[]=newImage[5];Image[]image1=newImage[5];publicMyJPanel(intheight,intweight){this.height=height;this.weight=weight;rains=newRains();Threadt=newThread(this);t.start();MediaTrackertracker=newMediaTracker(this);img[0]=Toolkit.getDefaul
8、tToolkit().createImage("D:\image\12.jpg");img[1]=Toolkit.getDefaultToolkit().createImage("D:\image\13.jpg");img[2]=Toolkit.getDefaultT
此文档下载收益归作者所有