Java Tutorial

 
 
 
 
/* <applet code=\"BarChart\" height=300 width=400>
   </applet> */

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

public class BarChart extends Applet
{
       TextField t1,t2,t3;
       public void init(){
             t1 = new TextField(8);
             t2 = new TextField(8);
             t3 = new TextField(8);
             add(t1);
             add(t2);
             add(t3);
             t1.setText(\"0\");
             t2.setText(\"0\");
             t3.setText(\"0\");
        }

        public void paint(Graphics g){
             try{
             g.drawString(\"Enter value in TextField to generate Barchart 

\",10,50);
             int value[] = new int[2];
             g.setColor(Color.red);
              value[0]= Integer.parseInt(t1.getText());
              value[1]=Integer.parseInt(t2.getText());
              value[2]=Integer.parseInt(t3.getText());

             for (int i=0;i<3;i++ )
             {
                    g.fillRect(100,i*50+70,value[i],40);
            }
            }catch(Exception e) {}
         }


      public boolean action(Event e, Object o){
          repaint();
          return true;
        }

}

    Related Post:
  1. 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

  2. Program of an applet to illustrate BarChart

  3. Program to display Floyds Triangle of a numbers

  4. Program of concatenating and Buffering files

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

  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. Add,delete,Update in LISTS

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

  9. Program to read input from the Standard Input Device

  10. An applet program of passing parameters

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

  12. Do the following for the Array Insert the element in the array,delete an element from the array,search for a particular element Create multiple thread

  13. Program to show an example of using a Static Nested Class

  14. Program to make directory

  15. Application which takes your marks of six subjects from the client side and displays the percentage that you have obtained

  16. File handling program to count number of characters in a file

  17. Corba program to develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side

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

  19. Program of date server and client

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

 
 
Didn't find what you were looking for? Find more on Program of an applet to illustrate BarChart