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. File handling program to copy characters from one file to another

  2. An applet program to display alternate filled and empty circle that to in row and column format

  3. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

  4. Program of UDP datagram

  5. Program to show the use of Nested If-Else Statements

  6. Program to display Floyds Triangle of a numbers

  7. Word list program that reads a text file and makes an alphabetical list of all the words in that file. The list of words is output to another file

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

  9. Program to show the use of If Statement

  10. File handling program to count number of characters in a file

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

  12. Develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side, executed on server

  13. Add,delete,Update in LISTS

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

  15. Program to declare, initialize and print a 2D array of integers

  16. An applet program to display sum of two number of textField

  17. Program to show an example of using a Static Nested Class

  18. Program that enabled applet calculator

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

  20. Program of telnet server - client

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