Colored Hello World Applet Example
- /*
- Colored Hello World Applet Example
- This Java example shows how to create an applet which shows "Hello World" text in
- different color using Java Applet and Color classes.
- */
- /* Using Colors */
- /* Syntax
- Color(int R, int G, int B)
- Color(int rgb)
- Color(float r, float g, float b)
- */
- /* Color Cosntants { black, blue, cyan, darkGray, gray, green, ligntGray,
- magenta, orange, pink, red, white, yellow}
- */
- import java.applet.Applet;
- import java.awt.Graphics;
- import java.awt.Color;
- /*
- <applet code = "ColoredHelloWorldExample" width = 300 height = 300>
- </applet>
- */
- public class ColoredHelloWorldExample extends Applet{
- public void paint(Graphics g){
- //set color to blue
- g.setColor(Color.blue);
- //print hello world
- g.drawString("Hello World...",30,180);
- }
- }



