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. Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server

  2. Write a program for restaurant

  3. An applet program to display Horizontal Color Bar

  4. An applet program that displays random dot

  5. Program to show an example of Polymorphism

  6. Program to perform Merge Sort

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

  8. Program to extract a portion of a character string and print the extracted string

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

  10. program which takes a long sentence from the client passes to the server,server separates out each word and sends them back to client in reverse order

  11. Program, which creates a three thread. One thread display the numbers from 1 to 5, second thread display the square root of that number etc

  12. An applet of displaying simple moving banner

  13. Program to show the use of Bitwise Operator (|) OR

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

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

  16. Program to show an example of Calling a Base Class Method from a Derived Class

  17. Program to delete mth element from an input string

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

  19. Program to read the ballots and count the votes cast for each candidate using an array variable count

  20. Program of date server and client

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