// Atsuro Seto (C) 1998 // http://www.cc.rim.or.jp/~atsuro/ /**/ import java.applet.*; import java.awt.*; import java.awt.event.*; public class m extends Applet implements Runnable, MouseListener, MouseMotionListener{ Thread thread; Image image=null; Graphics gra,grai; int i, bw, prevx, prevy, oldx, oldy, x, y, newx, newy; boolean amI=false; public void start(){if (thread==null){thread=new Thread(this);thread.start();}} public void stop(){thread=null;} public void init() { setBackground(Color.black); image=createImage(getSize().width,getSize().height); grai=image.getGraphics(); gra=getGraphics(); grai.setColor(Color.black); grai.fillRect(0,0,getSize().width,getSize().height); addMouseMotionListener(this); addMouseListener(this); } public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) { amI=!amI; e.consume(); } public void mouseDragged(MouseEvent e) {} public void mouseMoved(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseClicked(MouseEvent e){} public void run() { prevx=(int)(getSize().width*Math.random()); prevy=(int)(getSize().height*Math.random()); while(true){ for(i=0; i<255; i++){ x=(int)(Math.abs((getSize().width*Math.random())/1)); y=(int)(Math.abs((getSize().height*Math.random())/1)); grai.setColor(new Color((int)(i*Math.random()),(int)(i*Math.random()), (int)(i*Math.random()))); if(i>=220){ grai.setXORMode(new Color((int)(i*Math.random()),(int)(i*Math.random()), (int)(i*Math.random()))); } else grai.setPaintMode(); if(!amI) draw(prevx,prevy,x,y); prevx=x;prevy=y; try {Thread.sleep(30);} catch (InterruptedException e){} } } } void draw(int prevx, int prevy, int x, int y) { oldx=prevx; oldy=prevy; newx=x; newy=y; grai.drawLine(oldx,oldy,newx,newy); grai.drawLine(getSize().width-oldx,oldy,getSize().width-newx,newy); grai.drawLine(oldx,getSize().height-oldy,newx,getSize().height-newy); grai.drawLine(getSize().width-oldx,getSize().height-oldy,getSize().width-newx,getSize().height-newy); grai.drawLine(oldy,oldx,newy,newx); grai.drawLine(getSize().width-oldy,oldx,getSize().width-newy,newx); grai.drawLine(oldy,getSize().height-oldx,newy,getSize().height-newx); grai.drawLine(getSize().width-oldy,getSize().height-oldx,getSize().width-newy,getSize().height-newx); gra.drawImage(image,0,0,this); } public void paint(Graphics gra) { gra.drawImage(image,0,0,this);} }