void (JDialog dialog) { if (!canBeNormalized(dialog)) return; JRootPane rootPane = dialog.getRootPane(); Object value = rootPane.getClientProperty(NORMAL_BOUNDS); if (value instanceof Rectangle bounds) { ScreenUtil.fitToScreen(bounds); dialog.setBounds(bounds); rootPane.putClientProperty(NORMAL_BOUNDS, null); } }