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.height/colors.length;
             for (int i=0; i<colors.length ; i++ )
                   g.fillRect(0, i*x , d.width, (i+1) * x);

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

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

  3. Program to show the use of Do-While Loop

  4. RMI based application, which reads a file with list of marks of student from a client, send it to server and find how many students having distinct

  5. An applet program to take user input and display

  6. An applet program that concatenates two string entered in TextField

  7. Program to show the use of Nested If-Else Statements

  8. Program to show the use of Switch Statement

  9. Simple Applet which will show life cycle of an Applet

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

  11. Program to show the use of the Continue Statement

  12. Program to display reverse $ tree

  13. Program to declare, initialize and print a StringBuffer object

  14. Even no or Prime no?????

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

  16. Program which calls the method sort(int []a) which throws the Exception ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException

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

  18. Servlet which takes input from an HTML client page and calculates and outputs the premium amount

  19. Program to show the comparing of Strings for equality

  20. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

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