Java Blog

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

   <param name =\"totcol\" value=\"4\">

   <param name = \"c1\"  value = \"110\">
   <param name = \"c2\"  value = \"150\">
   <param name = \"c3\"  value = \"100\">
   <param name = \"c4\"  value = \"170\">
   <param name = \"lbl1\"  value = \"1991\">
   <param name = \"lbl2\"  value = \"1992\">
   <param name = \"lbl3\"  value = \"1993\">
   <param name = \"lbl4\"  value = \"1994\">

   </applet> */

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

   public class exBarChart extends Applet
                  int n=0;
                  String label[];
                  int value[];

          public void init(){        
                        n = Integer.parseInt(getParameter(\"totcol\"));
                        label = new String[n];
                        value = new int[n];

                  label[0] = getParameter(\"lbl1\");
                  label[1] = getParameter(\"lbl2\");
                  label[2] = getParameter(\"lbl3\");
                  label[3] = getParameter(\"lbl4\");

                  value[0] = Integer.parseInt(getParameter(\"c1\"));
                  value[1] = Integer.parseInt(getParameter(\"c2\"));
                  value[2] = Integer.parseInt(getParameter(\"c3\"));
                  value[3] = Integer.parseInt(getParameter(\"c4\"));
                  }  catch(Exception e) {}

          public void paint(Graphics g){
                for (int i=0;i<n ;i++ )
                      g.drawString(\"    \" +value[i],value[i]+50,(i*50)+30);


    Related Post:
  1. Program to extract a portion of a character string and print the extracted string

  2. Program to show an example of Overriding a Base Class Method

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

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

  5. An applet program showing Clicked Event on canvas

  6. Program to show the use of Bitwise Operator (|) OR

  7. Program to read command line arguments

  8. Program to show the use of Conditional AND Operator (&&) in If Statements

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

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

  11. Program to find the number of and sum of all integers greater than 100 and less than 200 that are divisible by 7

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

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

  14. An applet program to give demo of getDocumentBase() and getCodeBase() methods

  15. Program to show insertion of StringBuffer, String objects and other Basic Data Types into a StringBuffer object

  16. Program of Floyds Triangle


  18. Define an array of ten String elements each containing an arbitrary string of the form “month/day/year”

  19. Program of writing Bytes to a File

  20. Program to show the use of Bitwise Operator (~) Complement

Didn't find what you were looking for? Find more on An applet program to display barchart of given data