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.fillOval(x-radius, y-radius, 2*radius, 2*radius);
           g.drawString(\"Width   = \"+d.width,10,10);
           g.drawString(\"Height = \"+d.height,10,20);

    Related Post:
  1. Program to show the use of Conditional AND Operator (&&) in If Statements

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

  3. Program to show the use of If Statement

  4. Program to show the comparing of Strings for equality

  5. Program to read command line arguments

  6. Program for calculating area of a circle on server side,when a client sends request along with given radius and then displaying result on client side

  7. Program of concatenating and Buffering files

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

  9. Program to show an example of using a Non-Static Nested Class

  10. Program to declare and initialize Boolean variables and print them on the Standard Output Device

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

  12. RMI servlet program to display message

  13. An applet program that creates string dynamically and displays it

  14. Corba program of game

  15. Socket program of HTTP Server

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

  17. Program of an applet to display alternate filled and empty circle

  18. Program which creates an Array of character. Make one function with one argument as a character and that function throw a user defined exception

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

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

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