mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Fix so JOptionPane dialogs always display at center of main window by default
This commit is contained in:
@@ -269,7 +269,7 @@ public class DeckgenUtil {
|
||||
msg.append("Copy Decklist to Clipboard?");
|
||||
|
||||
// Output
|
||||
final int rcMsg = JOptionPane.showConfirmDialog(null, msg, "Decklist", JOptionPane.OK_CANCEL_OPTION);
|
||||
final int rcMsg = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), msg, "Decklist", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (rcMsg == JOptionPane.OK_OPTION) {
|
||||
final StringSelection ss = new StringSelection(deckList.toString());
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||
@@ -287,14 +287,14 @@ public class DeckgenUtil {
|
||||
boolean result = true;
|
||||
|
||||
if (colors0.size() == 4) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Sorry, four color generated decks aren't supported yet."
|
||||
+ "\n\rPlease use 2, 3, or 5 colors for this deck.",
|
||||
"Generate deck: 4 colors", JOptionPane.ERROR_MESSAGE);
|
||||
result = false;
|
||||
}
|
||||
else if (colors0.size() > 5) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Generate deck: maximum five colors!",
|
||||
"Generate deck: too many colors", JOptionPane.ERROR_MESSAGE);
|
||||
result = false;
|
||||
|
||||
@@ -150,7 +150,7 @@ public class OldDeckParser {
|
||||
this.draft.add(d);
|
||||
} else {
|
||||
final String msg = String.format("Draft '%s' lacked some decks.%n%nShould it be deleted?");
|
||||
mayDelete = JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, msg, "Draft loading error",
|
||||
mayDelete = JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), msg, "Draft loading error",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class OldDeckParser {
|
||||
.format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
|
||||
name, ex.getMessage());
|
||||
allowDeleteUnsupportedConstructed = JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(
|
||||
null, msg, "Problem converting decks", JOptionPane.YES_NO_OPTION);
|
||||
JOptionPane.getRootFrame(), msg, "Problem converting decks", JOptionPane.YES_NO_OPTION);
|
||||
}
|
||||
}
|
||||
if (importedOk || allowDeleteUnsupportedConstructed) {
|
||||
|
||||
@@ -274,7 +274,7 @@ public class BugReporter {
|
||||
// browse to url
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Sorry, a problem occurred while opening the forum in your default browser.",
|
||||
"A problem occured", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@@ -138,11 +138,9 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
final List<CustomLimited> myDrafts = this.loadCustomDrafts("res/draft/", ".draft");
|
||||
|
||||
if (myDrafts.isEmpty()) {
|
||||
JOptionPane
|
||||
.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
final CustomLimited draft = GuiChoose.one("Choose Custom Draft",
|
||||
myDrafts);
|
||||
final CustomLimited draft = GuiChoose.one("Choose Custom Draft", myDrafts);
|
||||
this.setupCustomDraft(draft);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -152,7 +152,7 @@ public class SealedCardPoolGenerator {
|
||||
|
||||
// present list to user
|
||||
if (customs.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null, "No custom sealed files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "No custom sealed files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
final CustomLimited draft = GuiChoose.one("Choose Custom Sealed Pool", customs);
|
||||
|
||||
|
||||
@@ -146,10 +146,10 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
if (newMain != null) {
|
||||
if (newMain.size() < deckMinSize) {
|
||||
String errMsg = String.format("Too few cards in your main deck (minimum %d), please make modifications to your deck again.", deckMinSize);
|
||||
JOptionPane.showMessageDialog(null, errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
String errMsg = String.format("Too many cards in your sideboard (maximum %d), please make modifications to your deck again.", sbMax);
|
||||
JOptionPane.showMessageDialog(null, errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
// Sideboard rules have changed for M14, just need to consider min maindeck and max sideboard sizes
|
||||
@@ -218,7 +218,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
|
||||
String message = String.format("How much will you announce for %s?%s", announce, canChooseZero ? "" : " (X cannot be 0)");
|
||||
while(true){
|
||||
String str = JOptionPane.showInputDialog(null, message, ability.getSourceCard().getName(), JOptionPane.QUESTION_MESSAGE);
|
||||
String str = JOptionPane.showInputDialog(JOptionPane.getRootFrame(), message, ability.getSourceCard().getName(), JOptionPane.QUESTION_MESSAGE);
|
||||
if (null == str) return null; // that is 'cancel'
|
||||
|
||||
if(StringUtils.isNumeric(str)) {
|
||||
|
||||
@@ -138,7 +138,7 @@ public class CardListViewer {
|
||||
}
|
||||
this.jList.setSelectedIndex(0);
|
||||
|
||||
this.dialog = this.optionPane.createDialog(this.optionPane.getParent(), this.title);
|
||||
this.dialog = this.optionPane.createDialog(JOptionPane.getRootFrame(), this.title);
|
||||
this.dialog.setSize(720, 360);
|
||||
this.dialog.addWindowFocusListener(new CardListFocuser());
|
||||
this.dialog.setLocationRelativeTo(null);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GuiDialog {
|
||||
final String title = c == null ? "Question" : c.getName() + " - Ability";
|
||||
String questionToUse = StringUtils.isBlank(question) ? "Activate card's ability?" : question;
|
||||
String[] opts = options == null ? defaultConfirmOptions : options;
|
||||
int answer = JOptionPane.showOptionDialog(null, questionToUse, title,
|
||||
int answer = JOptionPane.showOptionDialog(JOptionPane.getRootFrame(), questionToUse, title,
|
||||
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
|
||||
opts, opts[defaultIsYes ? 0 : 1]);
|
||||
return answer == JOptionPane.YES_OPTION;
|
||||
@@ -72,7 +72,7 @@ public class GuiDialog {
|
||||
FThreads.invokeInEdtAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JOptionPane.showMessageDialog(null, message, title, JOptionPane.PLAIN_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), message, title, JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ public final class GuiDisplayUtil {
|
||||
|
||||
in.close();
|
||||
} catch (final FileNotFoundException fnfe) {
|
||||
JOptionPane.showMessageDialog(null, "File not found: " + fc.getSelectedFile().getAbsolutePath());
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "File not found: " + fc.getSelectedFile().getAbsolutePath());
|
||||
} catch (final Exception e) {
|
||||
JOptionPane.showMessageDialog(null, "Error loading battle setup file!");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Error loading battle setup file!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ListChooser<T> {
|
||||
}
|
||||
Integer value;
|
||||
do {
|
||||
this.dialog = this.optionPane.createDialog(this.optionPane.getParent(), this.title);
|
||||
this.dialog = this.optionPane.createDialog(JOptionPane.getRootFrame(), this.title);
|
||||
if (this.minChoices != 0) {
|
||||
this.dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SEditorIO {
|
||||
|
||||
// Warn if no name
|
||||
if (name == null || name.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Please name your deck using the 'Title' box.",
|
||||
"Save Error!",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
@@ -84,7 +84,7 @@ public class SEditorIO {
|
||||
public static boolean confirmSaveChanges() {
|
||||
if (!((DeckController<DeckBase>) CDeckEditorUI
|
||||
.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController()).isSaved()) {
|
||||
final int choice = JOptionPane.showConfirmDialog(null,
|
||||
final int choice = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
||||
"Save changes to current deck?",
|
||||
"Save Changes?",
|
||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
||||
|
||||
@@ -188,7 +188,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
* </p>
|
||||
*/
|
||||
private void saveDraft() {
|
||||
String s = JOptionPane.showInputDialog(null,
|
||||
String s = JOptionPane.showInputDialog(JOptionPane.getRootFrame(),
|
||||
"Save this draft as:",
|
||||
"Save draft",
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
@@ -357,7 +357,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
final int value = this.getCardValue(item);
|
||||
|
||||
if (value > this.questData.getAssets().getCredits()) {
|
||||
JOptionPane.showMessageDialog(null, "Not enough credits!");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Not enough credits!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
getDeckManager().addItems(newInventory);
|
||||
}
|
||||
boolean one = 1 == qty;
|
||||
JOptionPane.showMessageDialog(null, String.format(
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), String.format(
|
||||
"%s '%s' %s added to your decklist.%n%n%s cards were also added to your pool.",
|
||||
one ? "Deck" : String.format("%d copies of deck", qty),
|
||||
deck.getName(), one ? "was" : "were", one ? "Its" : "Their"),
|
||||
|
||||
@@ -175,7 +175,7 @@ public enum CSubmenuGauntletBuild implements ICDoc {
|
||||
|
||||
// Warn if no name
|
||||
if (name.equals(GauntletIO.TXF_PROMPT) || name.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Please name your gauntlet using the 'Gauntlet Name' box.",
|
||||
"Save Error!",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
@@ -185,7 +185,7 @@ public enum CSubmenuGauntletBuild implements ICDoc {
|
||||
final File f = new File(NewConstants.GAUNTLET_DIR.userPrefLoc + name + ".dat");
|
||||
// Confirm if overwrite
|
||||
if (f.exists()) {
|
||||
final int m = JOptionPane.showConfirmDialog(null,
|
||||
final int m = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
||||
"There is already a gauntlet named '" + name + "'.\n"
|
||||
+ "All progress and data will be overwritten. Continue?",
|
||||
"Overwrite Gauntlet?",
|
||||
@@ -197,7 +197,7 @@ public enum CSubmenuGauntletBuild implements ICDoc {
|
||||
}
|
||||
// Confirm if a new gauntlet will be created
|
||||
else {
|
||||
final int m = JOptionPane.showConfirmDialog(null,
|
||||
final int m = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
||||
"This will create a new gauntlet named '" + name + "'. Continue?",
|
||||
"Create Gauntlet?",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
|
||||
@@ -264,7 +264,7 @@ public class QuickGauntletLister extends JPanel {
|
||||
private void deleteFile(RowPanel r0) {
|
||||
final GauntletData gd = r0.getGauntletData();
|
||||
|
||||
final int n = JOptionPane.showConfirmDialog(null,
|
||||
final int n = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
||||
"Are you sure you want to delete \"" + gd.getName()
|
||||
+ "\" ?", "Delete Gauntlet", JOptionPane.YES_NO_OPTION);
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ public enum CSubmenuQuestData implements ICDoc {
|
||||
case CustomFormat:
|
||||
if (customFormatCodes.isEmpty()) {
|
||||
|
||||
int answer = JOptionPane.showConfirmDialog(null, "You have defined custom format as containing no sets.\nThis will start a game without restriction.\n\nContinue?");
|
||||
int answer = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), "You have defined custom format as containing no sets.\nThis will start a game without restriction.\n\nContinue?");
|
||||
if (JOptionPane.YES_OPTION != answer) {
|
||||
return;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public enum CSubmenuQuestData implements ICDoc {
|
||||
dckStartPool = view.getSelectedDeck();
|
||||
if (null == dckStartPool) {
|
||||
|
||||
JOptionPane.showMessageDialog(null, "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -250,13 +250,13 @@ public enum CSubmenuQuestData implements ICDoc {
|
||||
// }
|
||||
final StartingPoolPreferences userPrefs = new StartingPoolPreferences(false, MagicColor.ALL_COLORS); // To be changed later
|
||||
|
||||
final Object o = JOptionPane.showInputDialog(null, "Poets will remember your quest as:", "Quest Name", JOptionPane.OK_CANCEL_OPTION);
|
||||
final Object o = JOptionPane.showInputDialog(JOptionPane.getRootFrame(), "Poets will remember your quest as:", "Quest Name", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (o == null) { return; }
|
||||
|
||||
final String questName = SSubmenuQuestUtil.cleanString(o.toString());
|
||||
|
||||
if (getAllQuests().get(questName) != null || questName.equals("")) {
|
||||
JOptionPane.showMessageDialog(null, "Please pick another quest name, a quest already has that name.");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Please pick another quest name, a quest already has that name.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ public class QuestFileLister extends JPanel {
|
||||
}
|
||||
|
||||
private void editFileName(String s0) {
|
||||
final Object o = JOptionPane.showInputDialog(null,
|
||||
final Object o = JOptionPane.showInputDialog(JOptionPane.getRootFrame(),
|
||||
"Rename Quest to:", "Quest Rename", JOptionPane.OK_CANCEL_OPTION);
|
||||
|
||||
if (o == null) { return; }
|
||||
@@ -310,7 +310,7 @@ public class QuestFileLister extends JPanel {
|
||||
}
|
||||
|
||||
if (exists || questName.equals("")) {
|
||||
JOptionPane.showMessageDialog(null, "Please pick another quest name, a quest already has that name.");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Please pick another quest name, a quest already has that name.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -326,7 +326,7 @@ public class QuestFileLister extends JPanel {
|
||||
private void deleteFile(RowPanel r0) {
|
||||
final QuestData qd = r0.getQuestData();
|
||||
|
||||
final int n = JOptionPane.showConfirmDialog(null,
|
||||
final int n = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
||||
"Are you sure you want to delete \"" + qd.getName()
|
||||
+ "\" ?", "Delete Deck", JOptionPane.YES_NO_OPTION);
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ public class SSubmenuQuestUtil {
|
||||
QuestController qc = Singletons.getModel().getQuest();
|
||||
if (qc == null || qc.getAssets() == null) {
|
||||
String msg = "Please create a Quest before attempting to " + location;
|
||||
JOptionPane.showMessageDialog(null, msg, "No Quest", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg, "No Quest", JOptionPane.ERROR_MESSAGE);
|
||||
System.out.println(msg);
|
||||
return false;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ public class SSubmenuQuestUtil {
|
||||
|
||||
CardEdition unlocked = toUnlock.left;
|
||||
qData.getAssets().subtractCredits(toUnlock.right);
|
||||
JOptionPane.showMessageDialog(null, "You have successfully unlocked " + unlocked.getName() + "!",
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "You have successfully unlocked " + unlocked.getName() + "!",
|
||||
unlocked.getName() + " unlocked!",
|
||||
JOptionPane.PLAIN_MESSAGE);
|
||||
|
||||
@@ -301,7 +301,7 @@ public class SSubmenuQuestUtil {
|
||||
}
|
||||
|
||||
if (worlds.size() < 1) {
|
||||
JOptionPane.showMessageDialog(null, "There are currently no worlds you can travel to\nin this version of Forge.", "No worlds", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "There are currently no worlds you can travel to\nin this version of Forge.", "No worlds", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -368,14 +368,14 @@ public class SSubmenuQuestUtil {
|
||||
}
|
||||
if (deck == null) {
|
||||
String msg = "Please select a Quest Deck.";
|
||||
JOptionPane.showMessageDialog(null, msg, "No Deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg, "No Deck", JOptionPane.ERROR_MESSAGE);
|
||||
System.out.println(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
String errorMessage = GameType.Quest.getDecksFormat().getDeckConformanceProblem(deck);
|
||||
if (null != errorMessage) {
|
||||
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,19 +102,19 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
|
||||
RegisteredPlayer pscRight = view.getDcRight().getPlayer();
|
||||
|
||||
if (pscLeft == null || pscRight == null) {
|
||||
JOptionPane.showMessageDialog(null, "Please specify a Human and Computer deck first.");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Please specify a Human and Computer deck first.");
|
||||
return;
|
||||
}
|
||||
|
||||
String leftDeckErrorMessage = gameType.getDecksFormat().getDeckConformanceProblem(pscLeft.getOriginalDeck());
|
||||
if (null != leftDeckErrorMessage) {
|
||||
JOptionPane.showMessageDialog(null, "Left-side deck " + leftDeckErrorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Left-side deck " + leftDeckErrorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
String rightDeckErrorMessage = gameType.getDecksFormat().getDeckConformanceProblem(pscRight.getOriginalDeck());
|
||||
if (null != rightDeckErrorMessage) {
|
||||
JOptionPane.showMessageDialog(null, "Right-side deck " + rightDeckErrorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Right-side deck " + rightDeckErrorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,14 +98,14 @@ public enum CSubmenuDraft implements ICDoc {
|
||||
final int aiIndex = (int) Math.floor(Math.random() * 7);
|
||||
|
||||
if (humanDeck == null) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"No deck selected for human!\r\n(You may need to build a new deck.)",
|
||||
"No deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck);
|
||||
if (null != errorMessage) {
|
||||
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
final Deck human = VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
||||
|
||||
if (human == null) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Please build and/or select a deck for yourself.",
|
||||
"No deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
@@ -131,7 +131,7 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
|
||||
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(human);
|
||||
if (null != errorMessage) {
|
||||
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
if ( null == rounds ) return;
|
||||
|
||||
|
||||
final String sDeckName = JOptionPane.showInputDialog(null,
|
||||
final String sDeckName = JOptionPane.showInputDialog(JOptionPane.getRootFrame(),
|
||||
"Save this card pool as:",
|
||||
"Save Card Pool",
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
@@ -182,7 +182,7 @@ public enum CSubmenuSealed implements ICDoc {
|
||||
final IStorage<DeckGroup> sealedDecks = Singletons.getModel().getDecks().getSealed();
|
||||
|
||||
if (sealedDecks.contains(sDeckName)) {
|
||||
final int deleteDeck = JOptionPane.showConfirmDialog(null, "\"" + sDeckName
|
||||
final int deleteDeck = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), "\"" + sDeckName
|
||||
+ "\" already exists! Do you want to replace it?",
|
||||
"Sealed Deck Game Exists", JOptionPane.YES_NO_OPTION);
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
String userPrompt =
|
||||
"This will reset all preferences to their defaults and restart Forge.\n\n" +
|
||||
"Reset and restart Forge?";
|
||||
int reply = JOptionPane.showConfirmDialog(null, userPrompt, "Reset Settings", JOptionPane.YES_NO_OPTION);
|
||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Settings", JOptionPane.YES_NO_OPTION);
|
||||
if (reply == JOptionPane.YES_OPTION) {
|
||||
ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||
prefs.reset();
|
||||
@@ -178,10 +178,10 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
"This will reset the Deck Editor screen layout.\n" +
|
||||
"All tabbed views will be restored to their default positions.\n\n" +
|
||||
"Reset layout?";
|
||||
int reply = JOptionPane.showConfirmDialog(null, userPrompt, "Reset Deck Editor Layout", JOptionPane.YES_NO_OPTION);
|
||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Deck Editor Layout", JOptionPane.YES_NO_OPTION);
|
||||
if (reply == JOptionPane.YES_OPTION) {
|
||||
deleteScreenLayoutFile(Screens.DECK_EDITOR_CONSTRUCTED);
|
||||
JOptionPane.showMessageDialog(null, "Deck Editor layout has been reset.");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Deck Editor layout has been reset.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,10 +191,10 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
"If you want to save the current layout first, please use " +
|
||||
"the Dock tab -> Save Layout option in the Match screen.\n\n" +
|
||||
"Reset layout?";
|
||||
int reply = JOptionPane.showConfirmDialog(null, userPrompt, "Reset Match Screen Layout", JOptionPane.YES_NO_OPTION);
|
||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Match Screen Layout", JOptionPane.YES_NO_OPTION);
|
||||
if (reply == JOptionPane.YES_OPTION) {
|
||||
deleteScreenLayoutFile(Screens.MATCH_SCREEN);
|
||||
JOptionPane.showMessageDialog(null, "Match Screen layout has been reset.");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Match Screen layout has been reset.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public final class GamePlayerUtil {
|
||||
|
||||
if (StringUtils.isBlank(playerName)) {
|
||||
newName = (String)JOptionPane.showInputDialog(
|
||||
Singletons.getView().getFrame(),
|
||||
JOptionPane.getRootFrame(),
|
||||
"By default, Forge will refer to you as the \"Human\" during gameplay.\n" +
|
||||
"If you would prefer a different name please enter it now.\n",
|
||||
"Personalize Forge Gameplay",
|
||||
@@ -43,7 +43,7 @@ public final class GamePlayerUtil {
|
||||
|
||||
if (StringUtils.isBlank(playerName) && newName != "Human") {
|
||||
JOptionPane.showMessageDialog(
|
||||
Singletons.getView().getFrame(),
|
||||
JOptionPane.getRootFrame(),
|
||||
"Thank you, " + newName + ". " +
|
||||
"You will not be prompted again but you can change\nyour name at any time using the \"Player Name\" setting in Preferences.\n\n");
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public final class GamePlayerUtil {
|
||||
private static String getNewPlayerNameFromInputDialog(String playerName) {
|
||||
String newName =
|
||||
(String)JOptionPane.showInputDialog(
|
||||
Singletons.getView().getFrame(),
|
||||
JOptionPane.getRootFrame(),
|
||||
"Please enter a new name (alpha-numeric only)\n",
|
||||
"Personalize Forge Gameplay",
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
|
||||
@@ -130,7 +130,7 @@ public enum CSubmenuCommander implements ICDoc {
|
||||
if (null != errorMessage) {
|
||||
if(!problemDecks.contains(d))
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "The deck " + d.getName() + " " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "The deck " + d.getName() + " " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||
problemDecks.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public enum CDock implements ICDoc {
|
||||
|
||||
msg.append("Copy Decklist to Clipboard?");
|
||||
|
||||
int rcMsg = JOptionPane.showConfirmDialog(null, msg, ttl, JOptionPane.OK_CANCEL_OPTION);
|
||||
int rcMsg = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), msg, ttl, JOptionPane.OK_CANCEL_OPTION);
|
||||
|
||||
if (rcMsg == JOptionPane.OK_OPTION) {
|
||||
final StringSelection ss = new StringSelection(deckList.toString());
|
||||
|
||||
@@ -12,7 +12,6 @@ import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.model.BuildInfo;
|
||||
import forge.util.FileUtil;
|
||||
|
||||
@@ -44,7 +43,7 @@ public final class HelpMenu {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JOptionPane.showMessageDialog(
|
||||
Singletons.getView().getFrame(),
|
||||
JOptionPane.getRootFrame(),
|
||||
"Version : " + BuildInfo.getVersionString(),
|
||||
"About Forge",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class MenuUtil {
|
||||
public static boolean getUserConfirmation(String prompt, String dialogTitle) {
|
||||
Object[] options = {"Yes", "No"};
|
||||
int reply = JOptionPane.showOptionDialog(
|
||||
null,
|
||||
JOptionPane.getRootFrame(),
|
||||
prompt,
|
||||
dialogTitle,
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
|
||||
@@ -58,7 +58,7 @@ public class FHyperlink extends FLabel {
|
||||
try {
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||
} catch (IllegalStateException ex) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Sorry, a problem occurred while copying this link to your system clipboard.",
|
||||
"A problem occured", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
||||
private void deleteDeck(final RowPanel r0) {
|
||||
final Deck d0 = r0.getDeck();
|
||||
|
||||
final int n = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete \"" + d0.getName() + "\" ?",
|
||||
final int n = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), "Are you sure you want to delete \"" + d0.getName() + "\" ?",
|
||||
"Delete Deck", JOptionPane.YES_NO_OPTION);
|
||||
|
||||
if (n == JOptionPane.NO_OPTION) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class QuestUtilUnlockSets {
|
||||
CardEdition choosenEdition = toBuy.left;
|
||||
|
||||
if (qData.getAssets().getCredits() < price) {
|
||||
JOptionPane.showMessageDialog(null, "Unfortunately, you cannot afford that set yet.\n"
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Unfortunately, you cannot afford that set yet.\n"
|
||||
+ "To unlock " + choosenEdition.getName() + ", you need " + price + " credits.\n"
|
||||
+ "You have only " + qData.getAssets().getCredits() + " credits.",
|
||||
"Failed to unlock " + choosenEdition.getName(),
|
||||
@@ -102,7 +102,7 @@ public class QuestUtilUnlockSets {
|
||||
return null;
|
||||
}
|
||||
|
||||
final int unlockConfirm = JOptionPane.showConfirmDialog(null,
|
||||
final int unlockConfirm = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
||||
"Unlocking " + choosenEdition.getName() + " will cost you " + price + " credits.\n"
|
||||
+ "You have " + qData.getAssets().getCredits() + " credits.\n\n"
|
||||
+ "Are you sure you want to unlock " + choosenEdition.getName() + "?",
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class StorageReaderFile<T> extends StorageReaderBase<T> {
|
||||
if (null == item) {
|
||||
final String msg = "An object stored in " + this.file.getPath()
|
||||
+ " failed to load.\nPlease submit this as a bug with the mentioned file attached.";
|
||||
JOptionPane.showMessageDialog(null, msg);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public abstract class StorageReaderFileSections<T> extends StorageReaderBase<T>
|
||||
if (null != item) return item;
|
||||
|
||||
final String msg = "An object stored in " + this.file.getPath() + " failed to load.\nPlease submit this as a bug with the mentioned file attached.";
|
||||
JOptionPane.showMessageDialog(null, msg);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public abstract class StorageReaderFolder<T> extends StorageReaderBase<T> {
|
||||
final String msg = "An object stored in "
|
||||
+ file.getPath()
|
||||
+ " failed to load.\nPlease submit this as a bug with the mentioned file/directory attached.";
|
||||
JOptionPane.showMessageDialog(null, msg);
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg);
|
||||
continue;
|
||||
}
|
||||
String newKey = keySelector.apply(newDeck);
|
||||
@@ -110,10 +110,8 @@ public abstract class StorageReaderFolder<T> extends StorageReaderBase<T> {
|
||||
result.put(newKey, newDeck);
|
||||
} catch (final OldDeckFileFormatException ex) {
|
||||
if (!hasWarnedOfOldFormat) {
|
||||
JOptionPane
|
||||
.showMessageDialog(
|
||||
null,
|
||||
"Found a deck in old fileformat in the storage.\nMoving this file and all similiar ones to parent folder.\n\nForge will try to convert them in a second.");
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
"Found a deck in old fileformat in the storage.\nMoving this file and all similiar ones to parent folder.\n\nForge will try to convert them in a second.");
|
||||
hasWarnedOfOldFormat = true;
|
||||
}
|
||||
file.renameTo(new File(this.directory.getParentFile(), file.getName()));
|
||||
@@ -125,7 +123,7 @@ public abstract class StorageReaderFolder<T> extends StorageReaderBase<T> {
|
||||
}
|
||||
|
||||
if (!decksThatFailedToLoad.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
||||
StringUtils.join(decksThatFailedToLoad, System.getProperty("line.separator")),
|
||||
"Some of your objects were not loaded.", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
@@ -94,6 +95,7 @@ public enum FView {
|
||||
private FView() {
|
||||
frmSplash = new SplashFrame();
|
||||
frmDocument.setTitle("Forge: " + BuildInfo.getVersionString());
|
||||
JOptionPane.setRootFrame(frmDocument);
|
||||
}
|
||||
|
||||
/** */
|
||||
|
||||
Reference in New Issue
Block a user