How can I create a drop shadow, inner glow and outer glow in Java Swing?

前端 未结 2 2041
温柔的废话
温柔的废话 2020-12-30 02:21

I am generating some images using the Graphics2D interface, and occasionally I\'d like to be able to draw some text on the image and apply to it effects like the ones in Ado

2条回答
  •  自闭症患者
    2020-12-30 02:52

    I would highly recommend the book Filthy Rich Clients. Chapter 16 talks about drop shadows. You also might be interested in the this blog post. Chapter 17 talks about the glowing effect. There is example code on the website for both. The rest of the book is well worth reading as well. I couldn't put the book down when I read it. There are many other fun effects explained and demonstrated in the book.

    The jhlabs site is also a good site, as mentioned.

    Edit:

    For a library, I would look at Painters in the SwingX library. Here are several tutorials:

    • http://weblogs.java.net/blog/2006/09/20/introducing-painters
    • http://www.curious-creature.org/2006/03/24/swingx-painters-demo/
    • http://www.jroller.com/gfx/entry/advanced_swingx_painters_demo

提交回复
热议问题