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 an example of overloading constructors in a class to initialize its data members

  2. Program to Concat Strings

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

  4. Program to calculate the frequency for different values of C starting from 0.01 to 0.1 in steps of 0.01

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

  6. Program to display text

  7. Program to show an example of modifying String objects

  8. Program of creating a file using text fields in windows

  9. Given a list of marks ranging form 0 to 100, write a program to compute and print the number of students marks

  10. Program to show an example of Multiple Levels of Inheritance

  11. Program to declare, initialize and print an array of integers

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

  13. An applet program to perform selection sort

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

  15. Program to show the use of Labeled Break Statement

  16. Program to read input from the Standard Input Device

  17. Program to show the use of For Loop

  18. An applet program to take user input and display

  19. RMI based application, which reads a file with list of marks of student from a client, send it to server and find how many students having distinct

  20. Application which takes your marks of six subjects from the client side and displays the percentage that you have obtained

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