mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Fixed Issue#99: The choices window should be positioned centered of the battlefield
This commit is contained in:
parent
5345e93c30
commit
5ed24f1488
2 changed files with 22 additions and 24 deletions
|
|
@ -34,8 +34,12 @@
|
|||
|
||||
package mage.client.dialog;
|
||||
|
||||
import javax.swing.JLayeredPane;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -53,6 +57,11 @@ public class PickChoiceDialog extends MageDialog {
|
|||
this.lblMessage.setText(message);
|
||||
this.lstChoices.setListData(choices);
|
||||
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);
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,21 +28,20 @@
|
|||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.CardArea;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -101,24 +100,14 @@ public class PickPileDialog extends MageDialog {
|
|||
}
|
||||
pack();
|
||||
|
||||
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight());
|
||||
this.setLocation(centered.x, centered.y);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
this.setModal(true);
|
||||
this.setVisible(true);
|
||||
|
||||
// SwingUtilities.invokeLater(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// int width = PickPileDialog.this.getWidth();
|
||||
// int height = PickPileDialog.this.getWidth();
|
||||
// if (width > 0 && height > 0) {
|
||||
// Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||
// PickPileDialog.this.setLocation(centered.x, centered.y);
|
||||
// GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, PickPileDialog.this);
|
||||
// }
|
||||
// PickPileDialog.this.setVisible(true);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
private void btnPile1ActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue