Return focus back to top-most dialog after showNotification() dialog is closed #PL-4960

This commit is contained in:
Yuriy Artamonov 2015-03-18 08:19:53 +00:00
parent 33f33700e5
commit 73a4c6082b
2 changed files with 9 additions and 3 deletions

View File

@ -1046,10 +1046,10 @@ public class DesktopWindow implements Window, Component.Disposable,
if (errors.isEmpty())
return true;
showValidationErrors(errors);
focusProblemComponent(errors);
showValidationErrors(errors);
return false;
}

View File

@ -1345,7 +1345,8 @@ public class DesktopWindowManager extends WindowManager {
if (icon != null) {
panel.add(new JLabel(" "));
}
panel.add(createButtonsPanel(actions, dialog), "alignx right");
final JPanel buttonsPanel = createButtonsPanel(actions, dialog);
panel.add(buttonsPanel, "alignx right");
dialog.setLayout(new MigLayout(new LC().insets("0").width(width + "px")));
dialog.setFixedWidth(width);
@ -1368,6 +1369,11 @@ public class DesktopWindowManager extends WindowManager {
}
dialog.requestFocus();
dialog.requestFocusInWindow();
if (buttonsPanel.getComponentCount() == 1) {
buttonsPanel.getComponent(0).requestFocus();
}
}
});
dialog.setVisible(true);