This section illustrates you how to show all the seven colors of colors.
The Rainbow consists of seven colors known as VIBGYOR i.e. violet, indigo, blue, green, yellow, orange and red color. We are providing you an example which shows all the seven colors of rainbow.
All the visible colors can be obtained by the primary colors red, green and blue. Therefore we have defined red, green and blue colors. The height and width of image is defined.
Following code draws the image of seven colors.
| g.drawImage(bufferedImage, 0, 0, this) |
Here is the code of ShowRainbowColors.java
import javax.swing.*;
|
Output will be displayed as:

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: How to show Rainbow Colors
Post your Comment