Java Blog

 
 
 
/* <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 that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

  2. Servlet which takes input from an HTML client page and calculates and outputs the premium amount

  3. Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server

  4. Develop a CORBA based application for addition of two complex numbers and displaying the result on client side

  5. Program of date server and client

  6. Program to show the use of Bitwise Operator (~) Complement

  7. Program to show an example of extraction of characters from a StringBuffer objects

  8. Program to read bytes from a file

  9. Program in CORBA which takes a long sentence from the client (at least 7 words), passes to the server, server separates out each word

  10. Program to show the use of operator (&gt;&gt;) Shift Right, propagating the sign bit from the left

  11. Program to show the use of Comparison operator (==) for comparing Strings

  12. An applet of displaying simple moving banner

  13. Program to show the use of Do-While Loop

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

  15. Program in CORBA which takes a long sentence from client (at least 7 words), passes to the server, server separates out each word and sends back

  16. Program for Thread Priority

  17. Program to Concat Strings

  18. Program to evaluate following investment equation V=P(1+R)^N

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

  20. Program to extract a portion of a character string and print the extracted string

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