Java examples for 2D Graphics:Color
Set Graphics Color
import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class Main { public void paint(Graphics g) { Color customColor = new Color(10,10,255); //w w w.j a va 2 s . c o m g.setColor(customColor); g.drawLine(10,10,30,30); g.setColor(Color.red); g.fillRect(40,40,40,40); g.setColor(Color.green); g.fillRect(80,80,40,40); g.draw3DRect(80,1,40,40,true); } }