UI: fixed rare error with wrong dialog position after multiple popups (#4318);

This commit is contained in:
Oleg Agafonov 2019-03-28 09:19:16 +04:00
parent 14f90bfc77
commit c58b28f94f
12 changed files with 185 additions and 173 deletions

View file

@ -114,14 +114,15 @@ public class AddLandDialog extends MageDialog {
}
getRootPane().setDefaultButton(btnOK);
this.makeWindowCentered();
// windows settings
MageFrame.getDesktop().remove(this);
if (this.isModal()) {
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
} else {
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
}
this.makeWindowCentered();
// Close on "ESC"
registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);