Java Blog

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

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

public class ColorBar extends Applet
{
    Color colors[]={ Color.blue, Color.cyan, Color.yellow, Color.red, Color.darkGray,
                               Color.gray, Color.lightGray, Color.magenta, Color.orange, Color.pink,
                               Color.white, Color.black};

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

    Related Post:
  1. Even number ,Prime no. ,Factorial of a number

  2. Program of an applet to illustrate BarChart

  3. Biological Sequence Allignment Using Dynamic Programing

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

  5. An applet program to display moving banner

  6. Program to evaluate following investment equation V=P(1+R)^N

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

  8. corba program of client and a DNS server where given a URL the server sends back an IP address

  9. Program to determine the sum of the following harmonic series for a given value of n

  10. Program to append a StringBuffer by StringBuffer, String objects and other Basic Data Types

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

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

  13. An applet program to display barchart of given data

  14. Program to read the price of an item in decimal form (like 75.95) and print the output in paise (like 7595 paise).

  15. Program that maintains employee database of an education system

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

  17. An applet program to perform quick sort

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

  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 show the use of operator (&gt;&gt;&gt;) Shift Right, filling with zeros from the left

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