Java Blog

 
 
 
/* <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. An applet program to draw concentric circle in center of the canvas

  2. Program to read rollno, marks of sub1,sub2 and sub3 and on basis of that display result

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

  4. Program to show some properties of StringBuffer object

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

  6. RMI application for counting factorial of a given number.

  7. An applet program to take user input and display

  8. Program to show an example of using initialization block to initialize the data members of a class

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

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

  11. File Handling- JAVA

  12. Program to ask question and accept answer up to 3 attempt and display right answer if it is wrong

  13. Dialog Boxes

  14. Program to show the use of Labeled Break Statement

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

  16. An applet program to display Horizontal Color Bar

  17. Program which will read a string and rewrite it in the alphabetical order

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

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

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

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