This section shows you the scales of image.
To show scales of Image, an image is defined inside the class folder and calls the ImageIcon class to return the image. The Insets class shows the border of a container which specifies the space leave at each of its edges.
The method getScaleInstance() of class Image allows to generate the scales of image. The method drawImage() must know that the scaling has been doing here. There are five hints for scaling the image. The SCALE_DEFAULT shows the default scale of image. The SCALE_FAST gives priority to speed over smoothness. The SCALE_SMOOTH gives smoothness to speed over speed. The SCALE_REPLICATE use ReplicateScaleFilter provided by the toolkit. The SCALE_AREA_AVERAGING use AreaAveragingScalingFilter provided by the toolkit.
Here is the code of ImageScale.java
Output will be displayed as:
We have defined the sleep(3000) method, therefore the scales which are defined in the code will get displayed with the image automatically after the specified interval of time.
Liked it! Share this Tutorial