Java provides different functions by which we can control the translucency of the window or the frame. To control the opacity of the frame must not be decorated. Opacity of a frame is the measure of the translucency of the frame or component. In Java, we can create shaped windows by two ways first by using the AWTUtilities which is a part of com.sum.awt package AWTUtilities class have a function – setWindowShape(Window w, Shape s) which sets the shape of the window and second by using setShape(Shape s) which sets the shape of the window to the specified shape. In this article we will discuss about uniform translucency of window. Methods used :
setWindowShape(Window w, Shape s) : sets the shape of the window w to the specified shape s
setShape(Shape s) : sets the shape of the window to the specified shape s
setOpacity(float f) : sets the value of opacity of the frame
1. Program to create a translucent frame and control its translucency with the help of a JSlider
Note : The above programs might not run in an online compiler please use an offline IDE. It is recommended to use latest version of java to run the above programs, user might face problems if older versions of java are used.
Please Login to comment...