Java examples for 2D Graphics:Text
Using Colors
Syntax
Color(int R, int G, int B) Color(int rgb) Color(float r, float g, float b)
Color Constants
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; public class Main { //from w w w. j ava2 s .co m public void paint(Graphics g){ g.setColor(Color.blue); g.drawString("Hello World...",30,180); } }