Java Tutorial

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

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

public class ColorBar extends Applet
    Color colors[]={, Color.cyan, Color.yellow,, Color.darkGray,
                               Color.gray, Color.lightGray, Color.magenta,,,

        public void paint(Graphics g){
             Dimension d = getSize();
             int x = d.width/colors.length;
             for (int i=0; i<colors.length ; i++ )
                   g.fillRect(i*x, 0, (i+1) * x, d.height);

    Related Post:
  1. An applet program to draw Polygon Graph with given data

  2. Write a class whose objects holds a current value and have a method to add that value, printing the new value

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

  4. Program to read the ballots and count the votes cast for each candidate using an array variable count

  5. Program to show the use of Conditional (Ternary) Operator

  6. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

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

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

  9. Program to copy the elements of an array into another array in reverse order and print them

  10. Program that accepts a shopping list of five items from the command line and stores them in vector

  11. Program which simulate the dictionary in java

  12. Program to show an example of Multiple Levels of Inheritance

  13. Program to read command line arguments

  14. Program to show the use of Conditional OR Operator (||) in If Statements

  15. Program to delete mth element from an input string

  16. Program to show an example of extracting subStrings from a String

  17. Program to show an example of Arrays of String

  18. Even number ,Prime no. ,Factorial of a number

  19. Pass the marks of 10 students from the client side design a servlet, which takes these marks and returns the number of students who obtained first cls

  20. An applet program to find maximum of three numbers using textField

Didn't find what you were looking for? Find more on An applet program to display Vertical Color Bar