I'm trying to improve one of my project by adding texture to a shape. The shape is oval, it basically the moon. I want it to have a realistic feel rather than gradient fill. So I look up some tutorial and this is what i got from http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Graphics.doc.html
// Create a buffered image texture patch of size 5 X 5.
BufferedImage bi = new BufferedImage(5, 5,
BufferedImage.TYPE_INT_RGB);
Graphics2D big bi.createGraphics();
// Render into the BufferedImage graphics to create the texture.
big.setColor(Color.green);
big.fillRect(0, 0, 5, 5);
big.setColor(Color.lightGray);
big.fillOval(0, 0, 5, 5);
// Create a texture paint from the buffered image.
Rectangle r = new Rectangle(0, 0, 5, 5);
TexturePaint tp = new
TexturePaint(bi, r, TexturePaint.NEAREST_NEIGHBOR);
// Add the texture paint to the graphics context.
g2.setPaint(tp);
// Create and render a rectangle filled with the texture.
g2.fillRect(0, 0, 200, 200);
I try to run it and it show an error. Can someone explain to me what part of that program can I change to choose my own texture and fillOval? or give a nice tutorial for beginner?