Skip to main content

Blur a non opaque JXPanel

Please note these forums are being decommissioned and use the new and improved forums at
2 replies [Last post]
Joined: 2012-03-04
Points: 0

Hi Everyone,
First, it's a while i'm following your work and I thought you gave up any developement on SwingX...Anyway, I'm glad you're not, and still releasing! I would like to ask how to blur a JXPanel, I found a link (, but it's more than I want and more complicated than expected...Here is a first approach of what I've done in paintComponent method:

<br />
Image img = root.createImage(root.getWidth(), root.getHeight());<br />
BufferedImage buf = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);<br />
buf.getGraphics().drawImage(img, 0, 0, null);<br />
ImagePainter p = new ImagePainter(buf);<br />
p.setFilters(new GaussianBlurFilter(10));<br />
setBackgroundPainter(p);<br />

The "output" is that, the panel is display as it was non opaque, no sign of blur :'(
Thanks for your help!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-03-29
Points: 0


You can find the complete source code on the website of the book "filthy rich clients". Its part of the examples of the static effects.

Just google for it.

The main idea is to paint the content of the components you want to blur on a buffered image.

Then blur this image.

So you got to get all the content of all underlying components you want to get blurred. Better explained in the

book "filthy rich clients" which is the best book for every one who wants to learn about Java Image manipulation/ Animation /Java2D fundamentals / and much more.



Joined: 2012-03-04
Points: 0

I used a ImagePainter with a GaussianFilter, where the image is a snapshot of the background (I used Robot for this)

Thanks anyway!