/** * Closes the given <code>{@link JInternalFrame}</code>. * * @param internalFrame the target <code>JInternalFrame</code>. * @throws IllegalStateException if the <code>JInternalFrame</code> is not showing on the screen. * @throws IllegalStateException if the <code>JInternalFrame</code> is not closable. */ @RunsInEDT public void close(JInternalFrame internalFrame) { Pair<Boolean, Point> closeInfo = validateAndFindCloseInfo(internalFrame); if (closeInfo.i) return; // internal frame is already closed moveMouseIgnoringAnyError(internalFrame, closeInfo.ii); JInternalFrameCloseTask.close(internalFrame); robot.waitForIdle(); }
/** * Closes the given {@code JInternalFrame}. * * @param internalFrame the target {@code JInternalFrame}. * @throws IllegalStateException if the {@code JInternalFrame} is not showing on the screen. * @throws IllegalStateException if the {@code JInternalFrame} is not closable. */ @RunsInEDT public void close(@Nonnull JInternalFrame internalFrame) { Point closeButtonLocation = findCloseButtonLocation(internalFrame); if (closeButtonLocation == null) { return; // internal frame is already closed } moveMouseIgnoringAnyError(internalFrame, closeButtonLocation); JInternalFrameCloseTask.close(internalFrame); robot.waitForIdle(); }