Java Tutorial

/*  Write a program to draw Polygon Graph with given data  */

/* <applet code=\"polyGraph\" height=400 width=500>  
   </applet>  */

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

public class polyGraph extends Applet
       public void paint(Graphics g){
           Dimension d = getSize();
           int canvasheight = d.height;

           int x[] = {0,60,120,180,240,300,360,420};
           int y[] = {0,120,180,260,340,340,300,180};

           //In order to converting java coordinate system to 
           //normal coordinate system, we transform the Y values
           //to N - Y where N is the height of the display area (canvas).

           for (int i=0;i<y.length ;i++ )
                   y[i] = canvasheight - y[i];

           int totPoints = x.length;   //To find total points in Array



    Related Post:
  1. Program to show the use of some Math Methods

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

  3. Program to show an example of creating a String object from a StringBuffer Object

  4. Program to show the use of Logical AND Operator (&) in If Statements

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

  6. Program to show an example of searching Strings for characters

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

  8. An application that combines several classes and interface

  9. Program to show an example of creating Character Arrays from String objects

  10. Program to read input from the Standard Input Device

  11. An applet program to perform quick sort

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

  13. CORBA based application for addition of two mathematical expressions of the form (ax + by) and displaying the result on client side

  14. Program to show an example of using Abstract Class and Abstract Method

  15. Program to print some text on the same line using multiple print statements

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

  17. Program to show some properties of StringBuffer object

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

  19. Program to show an example of Polymorphism

  20. An applet program of passing parameters

Didn't find what you were looking for? Find more on An applet program to draw Polygon Graph with given data