Texture refers to the roughness of the smoothness of a work of art. The way in which you paint involves texture.
Show Textured Paint
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
import java.awt.*;
|
Output will be displayed as: