Java Tutorial

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

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

public class BlinkRect extends Applet 
{
       Color colors[] = { Color.cyan, Color.blue, Color.red, Color.green, Color.yellow,
                                  Color.white, Color.black, Color.orange, Color.pink, Color.magenta};
       Dimension d = getSize();

        public void paint(Graphics g){           
            g.fillRect(10,20,150,150);
            for(int i=0;i<colors.length;i++)
            {
                 g.setColor(colors[i]);
                if (i==colors.length-1)
                 {
                      i=0;
                 }
                 repaint();
            }
        }
}

    Related Post:
  1. Program to show the use of Break Statement

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

  3. An applet program to add two numbers where data is entered in TextField

  4. Program to show the use of Switch Statement for the same statement for several different case labels

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

  6. An applet program to give demo of getDocumentBase() and getCodeBase() methods

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

  8. Program to declare, initialize and print a StringBuffer object

  9. Program to show the use of Conditional AND Operator (&&) in If Statements

  10. Program to represent a bank account

  11. Program to show an example of using a Static Nested Class outside the Top-Level Class

  12. Program to show an example of searching Strings for subStrings

  13. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

  14. Develop a RMI based application for addition of two complex numbers

  15. 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

  16. An applet program to take user input and display

  17. An applet program to display moving banner

  18. Program to print some text on the same line using multiple print statements

  19. Corba program to Write a Echo server and client with UDP server and client

  20. Corba program of reverse string

 
 
Didn't find what you were looking for? Find more on An applet program that display blinking rectangle