我想知道是否有人知道为什么sun.swing.AccessibleMethod从JDK 8开始,如果JDK 8中有这个类的替代品?我无法在任何地方找到任何相关信息.我在自己的实现中使用这个类DropHandler.我使用的代码片段sun.swing.AccessibleMethod如下所示:
private DropLocation getDropLocation(DropTargetEvent e)
{
DropLocation dropLocation = null;
if (this.component != null)
{
try
{
Point p = e instanceof DropTargetDragEvent ? ((DropTargetDragEvent)e).getLocation() : ((DropTargetDropEvent) e).getLocation();
AccessibleMethod method = new AccessibleMethod(JComponent.class,
"dropLocationForPoint",
Point.class);
dropLocation = (DropLocation) method.invokeNoChecked(this.component, p);
}
catch (NoSuchMethodException ex)
{
LOGGER.info(ex.getMessage());
}
}
return dropLocation;
}
Run Code Online (Sandbox Code Playgroud)