Java Tutorial

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

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

  public class altCircle extends Applet
  {
         public void paint(Graphics g){
             Dimension d = getSize();
             int circleHeight = 50;
             int circleWidth = 50;

             //To bring circle in the center of the canvas
             int x = (d.width/2) - (circleHeight/2);  

             for (int i=0;i<5;i++ )
             {
                     if (i%2 == 0)
                     {
                             g.setColor(Color.green);
                             g.drawOval(x,i*60 + 10, circleWidth,circleHeight);
                     }
                     else
                     {
                            g.setColor(Color.red);
                             g.fillOval(x,i*60 + 10, circleWidth,circleHeight);
                     }
             }
        }
  }[/Code]

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

  2. Corba program to encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time.

  3. RMI based application for login validation based on data saved in text file stored on the server and will display appropriate message to the client..

  4. File handling program to copy characters from one file to another

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

  6. An applet of displaying simple moving banner

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

  8. Program to change characters in a StringBuffer objects and to reverse its contents

  9. Game application in CORBA for which player will guess a number between 1 to 100, which will be compared to the random number generated by the class

  10. Program to show the use of Logical or Boolean Negation i.e. NOT (!)

  11. Program to show an example of Driving and using a Class

  12. Program to determine the sum of the following harmonic series for a given value of n

  13. Write a program for restaurant

  14. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

  15. RMI program of count server and client

  16. Dialog Boxes

  17. corba program of client and a DNS server where given a URL the server sends back an IP address

  18. Program to show the comparing of Strings for equality

  19. Program to show the use of some Math Methods

  20. Program to declare, initialize and print an array of characters

 
 
Didn't find what you were looking for? Find more on Program of an applet to display alternate filled and empty circle