* Saved position and size of choice window during a game session.

This commit is contained in:
LevelX2 2015-05-06 16:58:14 +02:00
parent bc990ad24a
commit 4cf21739c4
4 changed files with 76 additions and 27 deletions

View file

@ -42,6 +42,7 @@ import mage.choices.Choice;
import mage.client.MageFrame;
import mage.client.util.SettingsManager;
import mage.client.util.gui.GuiDisplayUtil;
import mage.client.util.gui.MageDialogState;
/**
*
@ -57,7 +58,7 @@ public class PickChoiceDialog extends MageDialog {
Choice choice;
boolean autoSelect;
public void showDialog(Choice choice, UUID objectId) {
public void showDialog(Choice choice, UUID objectId, MageDialogState mageDialogState) {
this.lblMessage.setText("<html>" + choice.getMessage());
this.choice = choice;
this.autoSelect = false;
@ -77,10 +78,15 @@ public class PickChoiceDialog extends MageDialog {
}
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight());
this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
if (mageDialogState != null) {
mageDialogState.setStateToDialog(this);
} else {
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight());
this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
}
this.setVisible(true);
}