开发者

java jbutton image png clickable area

I want to do a JButton with PNG icon but the clickable area have to be a pixel and not a transparency pixel, and position this JButton over oth开发者_开发知识库er JButtons like position absolute in css.

thanks in advance


Create a JLabel with the imge and add a MouseListener. In the listener check Point of the MouseEvent. Get pixel from the image for the point and check alpha of the image's point color. If it's not transparent do your action.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜