Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想JButton用PNG图标做一个,但可点击区域必须是一个像素而不是透明像素,并将其定位JButton在其他JButtons上,例如css中的绝对位置。
JButton
提前致谢
使用 imge 创建一个 JLabel 并添加一个 MouseListener。在侦听器中检查 MouseEvent 的点。从图像中获取点的像素并检查图像点颜色的 alpha。如果它不透明,请执行您的操作。