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 show the use of Switch Statement for the same statement for several different case labels

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

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

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

  5. Program which will read a string and rewrite it in the alphabetical order

  6. An applet program to display Horizontal Color Bar

  7. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

  8. An applet program showing Clicked Event on canvas

  9. Program in CORBA which takes a long sentence from the client (at least 7 words), passes to the server, server separates out each word

  10. An applet program that displays Text at the center of the string which is passed as parameter

  11. Program to show the comparing of Strings for equality

  12. Program of UDP news server

  13. Program to show an example of modifying String objects

  14. An application that combines several classes and interface

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

  16. Program to ask question and accept answer up to 3 attempt and display right answer if it is wrong

  17. File Handling- JAVA

  18. Write a program for restaurant

  19. Program to show an example of using user-defined package in a program

  20. Program to display text

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