Java Tutorial

 
 
 
 
/* <applet code=\"Dots\" width=300 height=300> 
</applet> */

import java.awt.*;
import java.applet.*;

public class Dots extends Applet implements Runnable
{
     int x=0,y=0;
     Thread t;
     Dimension d;

     public void init(){
         t=new Thread(this);
         t.start();
    }

    public void run(){
        while(true){
         try{
           repaint();

           //Sleep before displaying next dots
            Thread.sleep(10);
           }
          catch(Exception e) {}
         }
    }

    public void update(Graphics g){
         paint(g);
    }

    public void paint(Graphics g){
            d=getSize();
           x = (int) (Math.random() * d.getWidth());
           y = (int) (Math.random() *  d.getHeight());         
              g.fillRect(x,y,10,10);
    }

}

    Related Post:
  1. Program of UDP datagram

  2. Program that takes a long sentence and a character from the client and count the occurrence of the character in the sentence at the server side

  3. Corba program of date operations

  4. Program to display triangle of numbers

  5. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

  6. Program that accepts a shopping list of five items from the command line and stores them in vector

  7. Program to show an example of using Abstract Class and Abstract Method

  8. Program using session tracking capability of Servlets, which displays information of current user session by HttpServletRequest object

  9. Program to show the use of Conditional OR Operator (||) in If Statements

  10. File Handling- JAVA

  11. Program of an applet to display alternate filled and empty circle

  12. Create an interface coversions. Which have the following functions Inchestomillimeters(), hptowatts(),wattstohp(),poundstogram(),gramtopounds()

  13. An applet program to take user input and display

  14. Program to read command line arguments

  15. Program to show an example of creating a class and using its object

  16. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  17. Program which simulate the dictionary in java

  18. Program to show an example of extracting subStrings from a String

  19. RMI servlet program to display message

  20. Program to display Floyds Triangle of a numbers

 
 
Didn't find what you were looking for? Find more on An applet program that displays random dot