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 concatenating and Buffering files

  2. An applet program to add two numbers where data is entered in TextField


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

  5. An applet program to draw different shapes

  6. An applet program showing Clicked Event on canvas

  7. Program to read the table elements into a two-dimensional array temperature

  8. GUI application in java, which enter the details of a student and on the submit display the details of the student

  9. Program to show an example of modifying String objects

  10. CORBA program for displaying the date and time of the server machine, client machine and the difference between these two date and time

  11. Program to show an example of Copying i.e. Clonning Objects

  12. An applet program to display alternate filled and empty circle that to in row and column format

  13. Program to show the use of Comparison operator (==) for comparing Strings

  14. An application that combines several classes and interface

  15. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  16. Program to convert the given temperature in faherenhiet to celsius using the following conversion formula C= F- 32/1.8

  17. RMI application for counting factorial of a given number.

  18. File Handling- JAVA

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

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

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