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.
有没有办法简单地检查鼠标点击是否在形状的边框上?
我实际上正在使用该contains方法,但如果单击 Shape 边框,则它不起作用。
contains
使用BasicStroke. 定义厚度(比如说 5 个像素)并使用yourShape.getStrokedShape().contains(yourPoint)
BasicStroke
yourShape.getStrokedShape().contains(yourPoint)