Java Tutorial

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

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

 public class centerCircle extends Applet
 {
      public void paint(Graphics g){
           Dimension d = getSize();
           int x = d.width/2;
           int y = d.height/2;
           int radius = (int) ((d.width < d.height) ? 0.4 * d.width : 0.4 * d.height);
           g.setColor(Color.cyan);
           g.fillOval(x-radius, y-radius, 2*radius, 2*radius);
           g.setColor(Color.red);
           g.drawString(\"Width   = \"+d.width,10,10);
           g.drawString(\"Height = \"+d.height,10,20);
        }
 }

    Related Post:
  1. Program to declare, initialize and print a 2D array of integers

  2. Simple Applet which will show life cycle of an Applet

  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. Program to find the number of and sum of all integers greater than 100 and less than 200 that are divisible by 7

  5. Program to declare and initialize Integer variables and print them on the Standard Output Device

  6. Program to show the use of Conditional (Ternary) Operator

  7. Program to read bytes from a file

  8. Program of Floyds Triangle

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

  10. program which takes a long sentence from the client passes to the server,server separates out each word and sends them back to client in reverse order

  11. An applet program to draw Polygon Graph with given data

  12. Program to compute the sum of the digits of a given integer number. eg: I/o=4 then O/p=4+3+2+1=10

  13. Program which simulate the dictionary in java

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

  15. An applet program to draw circle in center of the canvas

  16. Program which calls the method sort(int []a) which throws the Exception ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException

  17. Write a class whose objects holds a current value and have a method to add that value, printing the new value

  18. RMI application for getting the final total price of the shopping list with some of the following items and quantities chosen by the user

  19. Socket program of multi client chat server

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

 
 
Didn't find what you were looking for? Find more on An applet program to draw circle in center of the canvas