Take a picture first. The normal image is as follows:
After the buttons are disable, The comparison results are as follows:
The following normal is the effect after the normal button disable
The above is the blur effect.
Let's take a look at the principle. The idea is to rewrite paintcomponent, and then use paintcomponent (BUF. getgraphics) to obtain the image of the original control style.
Blur the image and draw it out to read the code.
Public void paintcomponent (Graphics g) {If (isenabled () {// the original style super is returned here. paintcomponent (g); return;} // definition matrix float [] my_kernel = {0.10f, 0.10f, 0.10f, 0.10f, 0.20f, 0.10f, 0.10f, 0.10f, 0.10f, 0.10f }; convolveop op = new convolveop (new kernel (3, 3, my_kernel); bufferedimage Buf = new bufferedimage (getwidth (), getheight (), bufferedimage. type_int_rgb); // draw the control to the Buf image first. paintcomponent (BUF. getgraphics (); // perform the fuzzy filtering algorithm image IMG = op. filter (BUF, null); // draw the processed button G. drawimage (IMG, 0, 0, null );}
This method can blur various controls, such as blurring the background after a button is clicked, and a time Wait window pops up.