Find us on Google+ Kill the code: Tare Zammen Par effect
Showing posts with label Tare Zammen Par effect. Show all posts
Showing posts with label Tare Zammen Par effect. Show all posts

Thursday, 12 July 2012

Tare Zammen Par effect in Java Applet




Code :

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication2;

import java.applet.Applet;
import java.awt.Dimension;
import java.awt.Graphics;
import java.lang.Math;


/*<applet code=NewApplet1' width='500' height='500'></applet>*/
/**
 *
 * @author zero
 */
public class NewApplet1 extends Applet implements Runnable {
    int a, b;
    Dimension d = getSize();
    /**
     * Initialization method that will be called after the applet is loaded into
     * the browser.
     */
    public void init() {
        Thread t = new Thread(this);
        t.start();
    }
   
    public void run() {
        while(true) {
           
                d = getSize();
                try {
                Thread.sleep(1);
                }
                catch(Exception e) {
                }
           
                a = (int)(d.width * Math.random());
                b = (int)(d.height * Math.random());
                showStatus(d.width + "," + d.height);
                repaint();
           
        }
    }
   
    public void paint(Graphics g) {
        g.drawOval(a, b, 1, 1);
    }
   
    public void update(Graphics g) {
        paint(g);
    }
    // TODO overwrite start(), stop() and destroy() methods
}