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 that takes a long sentence and a character from the client and count the occurrence of the character in the sentence at the server side

  2. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

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

  4. Program to show the use of Bitwise Operator (^) XOR (Exclusive OR)

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

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

  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. Program to find a factorial of a given number

  9. Program to display attributes of a specified file

  10. Program to show an example of searching Strings for subStrings

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

  12. Program to show the use of Do-While Loop

  13. GUI application in java, which enter the details of a student and on the submit display the details of the student

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

  15. Program to show the use of operator (&gt;&gt;&gt;) Shift Right, filling with zeros from the left

  16. An applet program showing Clicked Event on canvas

  17. Program to show the use of For Loop

  18. Corba program to encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time.

  19. Program that enabled applet calculator

  20. Program to show the use of some Math Methods

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