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. Program of reading and writing primitive data

  2. RMI based application for login validation based on data saved in text file stored on the server and will display appropriate message to the client..

  3. Program to show the use of If-Else Statement

  4. Program to compare Strings by compring successive corresponding characters, starting with the first character in each String

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

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

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

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

  9. Program of an applet to display alternate filled and empty circle

  10. Program using Switch case to compute the net amount to be paid by a customer

  11. Develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side, executed on server

  12. Program to sort the contents of an array using Bubble Sort

  13. An applet program to display text

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

  15. Program to declare and initialize Integer variables and print them on the Standard Output Device

  16. Program using session tracking capability of Servlets, which displays information of current user session by HttpServletRequest object

  17. An applet program of linear sort

  18. Program to show the comparing of Strings for equality

  19. Program to read bytes from a file

  20. Program to show the use of Bitwise Operator (&) AND

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