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.
我的代码是用java编写的。我有 2 个类,首先绘制 3 个在程序运行时移动的矩形,第二个有一个可以拖放的面板,现在我想创建一个方法来检查矩形和拖放面板是否相交,但是我不能将坐标从一个类调用到另一个类。我如何检查它们是否相交???
你用什么库?摆动,Java2d,awt,swt,javaFx?对于不同的库 - 不同的解决方案:)但大多数情况下,像 Rectangle 这样的类有这样的方法intersects(Shape shape)
intersects(Shape shape)