This section illustrates you how to show the clipping of Area.
A Clip is a portion of a graphics or video or any picture. We are providing you an example which shows the clipping of area.
In the given example, we have defined two buttons clip1 and clip2 to perform two actions. On clicking clip1, a Rectangle2D class shows the clip of rectangular area and on clicking clip2, Rectangle class (subclass of Rectangle2D) shows a rectangle inside the rectangular area. The method setClip() sets the clipping area to clip the shape.
Here is the code of ClipAreaExample.java
import java.awt.*;
|
Output will be displayed as:

On clicking clip2 button, a rectangle is shown inside the rectangular area:

|
Recommend the tutorial |
Ask Questions? Discuss: Clip Area
Post your Comment