This section shows you the textured paint.
Texture refers to the roughness of the smoothness of a work of art. The way in which you paint involves texture. We are providing you an example that will show the textured paint.
The class TexturePaint provides an easy and impressive way to fill a shape with a repeating pattern. When you create a TexturePaint, you specify a BufferedImage to use as the pattern. The method createGraphics() creates a Graphics2D to draw into this BufferedImage.
To draw the oval we have used Ellipse2D class. To draw rectangle inside the oval, class Rectangle2D is used. The method g2d.fill(oval) fills the shape specified.
Here is the code of ShowTexturePaint.java
Output will be displayed as:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: October 16, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles