开发者

java jbutton image png clickable area

开发者 https://www.devze.com 2023-03-31 07:31 出处:网络
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 cs

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

精彩评论

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

关注公众号