mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Prevent glitchy dialog on Linux
Transition more message/confirm dialogs to skinned look
This commit is contained in:
@@ -8,6 +8,10 @@ Forge Beta: 12-##-2013 ver 1.5.8
|
|||||||
Release Notes
|
Release Notes
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
- Improved dialog appearance -
|
||||||
|
Many message and confirmation dialogs now use skinned look with rounded border dialog on top of overlay
|
||||||
|
|
||||||
|
|
||||||
- Deck Editor usability improvements -
|
- Deck Editor usability improvements -
|
||||||
You can now mark a card as a favorite in the Catalog by clicking the star icon in the first column. This will default the card to sort ahead of non-favorite cards if you sort on that first column (which is now the Forge default).
|
You can now mark a card as a favorite in the Catalog by clicking the star icon in the first column. This will default the card to sort ahead of non-favorite cards if you sort on that first column (which is now the Forge default).
|
||||||
You can now add or remove cards from a deck using +/- buttons that appear on either side of the quantity for each card.
|
You can now add or remove cards from a deck using +/- buttons that appear on either side of the quantity for each card.
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLayeredPane;
|
import javax.swing.JLayeredPane;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.WindowConstants;
|
import javax.swing.WindowConstants;
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ import forge.gui.match.controllers.CStack;
|
|||||||
import forge.gui.match.views.VAntes;
|
import forge.gui.match.views.VAntes;
|
||||||
import forge.gui.match.views.VField;
|
import forge.gui.match.views.VField;
|
||||||
import forge.gui.menus.ForgeMenu;
|
import forge.gui.menus.ForgeMenu;
|
||||||
import forge.gui.menus.MenuUtil;
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
@@ -122,20 +121,17 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
public void windowClosing(final WindowEvent e) {
|
public void windowClosing(final WindowEvent e) {
|
||||||
switch (closeAction) {
|
switch (closeAction) {
|
||||||
case NONE: //prompt user for close action if not previously specified
|
case NONE: //prompt user for close action if not previously specified
|
||||||
Object[] options = {"Close Screen", "Exit Forge", "Cancel"};
|
String[] options = {"Close Screen", "Exit Forge", "Cancel"};
|
||||||
int reply = JOptionPane.showOptionDialog(
|
int reply = FOptionPane.showOptionDialog(
|
||||||
JOptionPane.getRootFrame(),
|
"Forge now supports navigation tabs which allow closing and switching between different screens with ease. "
|
||||||
"Forge now supports navigation tabs which allow closing and switching between different screens with ease.\n"
|
+ "As a result, you no longer need to use the X button in the upper right to close the current screen and go back."
|
||||||
+ "As a result, you no longer need to use the X button in the upper right to close the current screen and go back.\n"
|
+ "\n\n"
|
||||||
+ "\n"
|
+ "Please select what you want to happen when clicking the X button in the upper right. This choice will be used "
|
||||||
+ "Please select what you want to happen when clicking the X button in the upper right. This choice will be used\n"
|
|
||||||
+ "going forward and you will not see this message again. You can change this behavior at any time in Preferences.",
|
+ "going forward and you will not see this message again. You can change this behavior at any time in Preferences.",
|
||||||
"Select Your Close Action",
|
"Select Your Close Action",
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
FOptionPane.INFORMATION_ICON,
|
||||||
JOptionPane.INFORMATION_MESSAGE,
|
|
||||||
null,
|
|
||||||
options,
|
options,
|
||||||
options[2]);
|
2);
|
||||||
switch (reply) {
|
switch (reply) {
|
||||||
case 0: //Close Screen
|
case 0: //Close Screen
|
||||||
setCloseAction(CloseAction.CLOSE_SCREEN);
|
setCloseAction(CloseAction.CLOSE_SCREEN);
|
||||||
@@ -181,7 +177,7 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
if (this.game != null) {
|
if (this.game != null) {
|
||||||
userPrompt = "A game is currently active. " + userPrompt;
|
userPrompt = "A game is currently active. " + userPrompt;
|
||||||
}
|
}
|
||||||
if (!MenuUtil.getUserConfirmation(userPrompt, "Exit Forge", this.game == null)) { //default Yes if no game active
|
if (!FOptionPane.showConfirmDialog(userPrompt, "Exit Forge", this.game == null)) { //default Yes if no game active
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!CDeckEditorUI.SINGLETON_INSTANCE.canSwitchAway(true)) {
|
if (!CDeckEditorUI.SINGLETON_INSTANCE.canSwitchAway(true)) {
|
||||||
@@ -429,7 +425,7 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
if (this.game != null) {
|
if (this.game != null) {
|
||||||
this.setCurrentScreen(FScreen.MATCH_SCREEN);
|
this.setCurrentScreen(FScreen.MATCH_SCREEN);
|
||||||
SOverlayUtils.hideOverlay();
|
SOverlayUtils.hideOverlay();
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Cannot start a new game while another game is already in progress.");
|
FOptionPane.showMessageDialog("Cannot start a new game while another game is already in progress.");
|
||||||
return; //TODO: See if it's possible to run multiple games at once without crashing
|
return; //TODO: See if it's possible to run multiple games at once without crashing
|
||||||
}
|
}
|
||||||
setPlayerName(match.getPlayers());
|
setPlayerName(match.getPlayers());
|
||||||
|
|||||||
@@ -24,14 +24,13 @@ import java.util.Map;
|
|||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.MutablePair;
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.util.FileSection;
|
import forge.util.FileSection;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
@@ -149,8 +148,7 @@ public class OldDeckParser {
|
|||||||
this.draft.add(d);
|
this.draft.add(d);
|
||||||
} else {
|
} else {
|
||||||
final String msg = String.format("Draft '%s' lacked some decks.%n%nShould it be deleted?");
|
final String msg = String.format("Draft '%s' lacked some decks.%n%nShould it be deleted?");
|
||||||
mayDelete = JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), msg, "Draft loading error",
|
mayDelete = FOptionPane.showConfirmDialog(msg, "Draft loading error");
|
||||||
JOptionPane.YES_NO_OPTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mayDelete) {
|
if (mayDelete) {
|
||||||
@@ -180,13 +178,13 @@ public class OldDeckParser {
|
|||||||
try {
|
try {
|
||||||
this.cube.add(Deck.fromSections(sections));
|
this.cube.add(Deck.fromSections(sections));
|
||||||
importedOk = true;
|
importedOk = true;
|
||||||
} catch (final NoSuchElementException ex) {
|
}
|
||||||
|
catch (final NoSuchElementException ex) {
|
||||||
if (!allowDeleteUnsupportedConstructed) {
|
if (!allowDeleteUnsupportedConstructed) {
|
||||||
final String msg = String
|
final String msg = String
|
||||||
.format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
|
.format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
|
||||||
name, ex.getMessage());
|
name, ex.getMessage());
|
||||||
allowDeleteUnsupportedConstructed = JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(
|
allowDeleteUnsupportedConstructed = FOptionPane.showConfirmDialog(msg, "Problem converting decks");
|
||||||
JOptionPane.getRootFrame(), msg, "Problem converting decks", JOptionPane.YES_NO_OPTION);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (importedOk || allowDeleteUnsupportedConstructed) {
|
if (importedOk || allowDeleteUnsupportedConstructed) {
|
||||||
@@ -205,8 +203,7 @@ public class OldDeckParser {
|
|||||||
final String msg = String
|
final String msg = String
|
||||||
.format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
|
.format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
|
||||||
name, ex.getMessage());
|
name, ex.getMessage());
|
||||||
allowDeleteUnsupportedConstructed = JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(
|
allowDeleteUnsupportedConstructed = FOptionPane.showConfirmDialog(msg, "Problem converting decks");
|
||||||
null, msg, "Problem converting decks", JOptionPane.YES_NO_OPTION);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (importedOk || allowDeleteUnsupportedConstructed) {
|
if (importedOk || allowDeleteUnsupportedConstructed) {
|
||||||
@@ -258,9 +255,7 @@ public class OldDeckParser {
|
|||||||
}
|
}
|
||||||
sb.append(System.getProperty("line.separator"));
|
sb.append(System.getProperty("line.separator"));
|
||||||
sb.append("May Forge delete these decks?");
|
sb.append("May Forge delete these decks?");
|
||||||
final int response = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), sb.toString(),
|
if (FOptionPane.showConfirmDialog(sb.toString(), "Some of your sealed decks are orphaned")) {
|
||||||
"Some of your sealed decks are orphaned", JOptionPane.YES_NO_OPTION);
|
|
||||||
if (response == JOptionPane.YES_OPTION) {
|
|
||||||
for (final Pair<DeckGroup, MutablePair<File, File>> s : sealedDecks.values()) {
|
for (final Pair<DeckGroup, MutablePair<File, File>> s : sealedDecks.values()) {
|
||||||
if (s.getRight().getLeft() != null) {
|
if (s.getRight().getLeft() != null) {
|
||||||
s.getRight().getLeft().delete();
|
s.getRight().getLeft().delete();
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import forge.FThreads;
|
|||||||
import forge.gui.WrapLayout;
|
import forge.gui.WrapLayout;
|
||||||
import forge.gui.toolbox.FHyperlink;
|
import forge.gui.toolbox.FHyperlink;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.model.BuildInfo;
|
import forge.model.BuildInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -272,14 +273,14 @@ public class BugReporter {
|
|||||||
|
|
||||||
// browse to url
|
// browse to url
|
||||||
Desktop.getDesktop().browse(new URI(url));
|
Desktop.getDesktop().browse(new URI(url));
|
||||||
} catch (Exception ex) {
|
}
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
catch (Exception ex) {
|
||||||
"Sorry, a problem occurred while opening the forum in your default browser.",
|
FOptionPane.showMessageDialog("Sorry, a problem occurred while opening the forum in your default browser.",
|
||||||
"A problem occured", JOptionPane.ERROR_MESSAGE);
|
"A problem occurred", FOptionPane.ERROR_ICON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
private static class _SaveAction extends AbstractAction {
|
private static class _SaveAction extends AbstractAction {
|
||||||
private static JFileChooser c;
|
private static JFileChooser c;
|
||||||
@@ -306,7 +307,7 @@ public class BugReporter {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.setSelectedFile(f);
|
c.setSelectedFile(f);
|
||||||
c.showSaveDialog(null);
|
c.showSaveDialog(null);
|
||||||
f = c.getSelectedFile();
|
f = c.getSelectedFile();
|
||||||
@@ -315,10 +316,10 @@ public class BugReporter {
|
|||||||
final BufferedWriter bw = new BufferedWriter(new FileWriter(f));
|
final BufferedWriter bw = new BufferedWriter(new FileWriter(f));
|
||||||
bw.write(this.area.getText());
|
bw.write(this.area.getText());
|
||||||
bw.close();
|
bw.close();
|
||||||
} catch (final IOException ex) {
|
}
|
||||||
JOptionPane.showMessageDialog(area.getTopLevelAncestor(),
|
catch (final IOException ex) {
|
||||||
"There was an error during saving. Sorry!\n" + ex,
|
FOptionPane.showMessageDialog("There was an error during saving. Sorry!\n" + ex,
|
||||||
"Error saving file", JOptionPane.ERROR_MESSAGE);
|
"Error saving file", FOptionPane.ERROR_ICON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package forge.gui;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.FutureTask;
|
import java.util.concurrent.FutureTask;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -11,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds player interactions using standard windows
|
* Holds player interactions using standard windows
|
||||||
@@ -39,17 +39,16 @@ public class GuiDialog {
|
|||||||
final String title = c == null ? "Question" : c.getName() + " - Ability";
|
final String title = c == null ? "Question" : c.getName() + " - Ability";
|
||||||
String questionToUse = StringUtils.isBlank(question) ? "Activate card's ability?" : question;
|
String questionToUse = StringUtils.isBlank(question) ? "Activate card's ability?" : question;
|
||||||
String[] opts = options == null ? defaultConfirmOptions : options;
|
String[] opts = options == null ? defaultConfirmOptions : options;
|
||||||
int answer = JOptionPane.showOptionDialog(JOptionPane.getRootFrame(), questionToUse, title,
|
int answer = FOptionPane.showOptionDialog(questionToUse, title, FOptionPane.QUESTION_ICON, opts, defaultIsYes ? 0 : 1);
|
||||||
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
|
return answer == 0;
|
||||||
opts, opts[defaultIsYes ? 0 : 1]);
|
|
||||||
return answer == JOptionPane.YES_OPTION;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
FutureTask<Boolean> future = new FutureTask<Boolean>(confirmTask);
|
FutureTask<Boolean> future = new FutureTask<Boolean>(confirmTask);
|
||||||
FThreads.invokeInEdtAndWait(future);
|
FThreads.invokeInEdtAndWait(future);
|
||||||
try {
|
try {
|
||||||
return future.get().booleanValue();
|
return future.get().booleanValue();
|
||||||
} catch (Exception e) { // should be no exception here
|
}
|
||||||
|
catch (Exception e) { // should be no exception here
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -64,15 +63,14 @@ public class GuiDialog {
|
|||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public static void message(final String message) {
|
public static void message(final String message) {
|
||||||
|
message(message, UIManager.getString("OptionPane.messageDialogTitle"));
|
||||||
message(message, UIManager.getString("OptionPane.messageDialogTitle"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void message(final String message, final String title) {
|
public static void message(final String message, final String title) {
|
||||||
FThreads.invokeInEdtAndWait(new Runnable() {
|
FThreads.invokeInEdtAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), message, title, JOptionPane.PLAIN_MESSAGE);
|
FOptionPane.showMessageDialog(message, title, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
@@ -47,6 +45,7 @@ import forge.game.card.CardPredicates;
|
|||||||
import forge.game.card.CounterType;
|
import forge.game.card.CounterType;
|
||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
import forge.gui.player.HumanPlay;
|
import forge.gui.player.HumanPlay;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.AbilityManaPart;
|
import forge.game.spellability.AbilityManaPart;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -127,10 +126,12 @@ public final class GuiDisplayUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
} catch (final FileNotFoundException fnfe) {
|
}
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "File not found: " + fc.getSelectedFile().getAbsolutePath());
|
catch (final FileNotFoundException fnfe) {
|
||||||
} catch (final Exception e) {
|
FOptionPane.showErrorMessageDialog("File not found: " + fc.getSelectedFile().getAbsolutePath());
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Error loading battle setup file!");
|
}
|
||||||
|
catch (final Exception e) {
|
||||||
|
FOptionPane.showErrorMessageDialog("Error loading battle setup file!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import forge.gui.toolbox.FButton;
|
|||||||
import forge.gui.toolbox.FCheckBox;
|
import forge.gui.toolbox.FCheckBox;
|
||||||
import forge.gui.toolbox.FComboBoxWrapper;
|
import forge.gui.toolbox.FComboBoxWrapper;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FOverlay;
|
import forge.gui.toolbox.FOverlay;
|
||||||
import forge.gui.toolbox.FPanel;
|
import forge.gui.toolbox.FPanel;
|
||||||
import forge.gui.toolbox.FScrollPane;
|
import forge.gui.toolbox.FScrollPane;
|
||||||
@@ -149,8 +150,9 @@ public class ImportDialog {
|
|||||||
if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(JOptionPane.getRootFrame())) {
|
if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(JOptionPane.getRootFrame())) {
|
||||||
File f = _fileChooser.getSelectedFile();
|
File f = _fileChooser.getSelectedFile();
|
||||||
if (!f.canRead()) {
|
if (!f.canRead()) {
|
||||||
JOptionPane.showMessageDialog(txfSrc, "Cannot access selected directory (Permission denied).");
|
FOptionPane.showErrorMessageDialog("Cannot access selected directory (Permission denied).");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
txfSrc.setText(f.getAbsolutePath());
|
txfSrc.setText(f.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -620,17 +622,17 @@ public class ImportDialog {
|
|||||||
sb.append("will come up again the next time you start Forge in order to migrate the remaining files<br>");
|
sb.append("will come up again the next time you start Forge in order to migrate the remaining files<br>");
|
||||||
sb.append("unless you move or delete them manually.</html>");
|
sb.append("unless you move or delete them manually.</html>");
|
||||||
|
|
||||||
Object[] options = { "Whoops, let me fix that!", "Continue with the import, I know what I'm doing." };
|
String[] options = { "Whoops, let me fix that!", "Continue with the import, I know what I'm doing." };
|
||||||
int chosen = JOptionPane.showOptionDialog(_operationLog, sb.toString(), "Migration warning",
|
int chosen = FOptionPane.showOptionDialog(sb.toString(), "Migration warning",
|
||||||
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
FOptionPane.WARNING_ICON, options, 0);
|
||||||
|
|
||||||
if (1 != chosen) {
|
if (chosen != 1) {
|
||||||
// i.e. option 0 was chosen or the dialog was otherwise closed
|
// i.e. option 0 was chosen or the dialog was otherwise closed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure no other actions (except for cancel) can be taken while the import is in progress
|
// ensure no other actions (except for cancel) can be taken while the import is in progress
|
||||||
_btnStart.setEnabled(false);
|
_btnStart.setEnabled(false);
|
||||||
_btnChooseDir.setEnabled(false);
|
_btnChooseDir.setEnabled(false);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import forge.deck.generation.DeckGenerator3Color;
|
|||||||
import forge.deck.generation.DeckGenerator5Color;
|
import forge.deck.generation.DeckGenerator5Color;
|
||||||
import forge.deck.generation.DeckGeneratorBase;
|
import forge.deck.generation.DeckGeneratorBase;
|
||||||
import forge.deck.generation.DeckGeneratorMonoColor;
|
import forge.deck.generation.DeckGeneratorMonoColor;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
@@ -267,8 +268,7 @@ public class DeckgenUtil {
|
|||||||
msg.append("Copy Decklist to Clipboard?");
|
msg.append("Copy Decklist to Clipboard?");
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
final int rcMsg = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), msg, "Decklist", JOptionPane.OK_CANCEL_OPTION);
|
if (FOptionPane.showConfirmDialog(msg.toString(), "Decklist", "OK", "Cancel")) {
|
||||||
if (rcMsg == JOptionPane.OK_OPTION) {
|
|
||||||
final StringSelection ss = new StringSelection(deckList.toString());
|
final StringSelection ss = new StringSelection(deckList.toString());
|
||||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||||
}
|
}
|
||||||
@@ -285,16 +285,16 @@ public class DeckgenUtil {
|
|||||||
boolean result = true;
|
boolean result = true;
|
||||||
|
|
||||||
if (colors0.size() == 4) {
|
if (colors0.size() == 4) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
FOptionPane.showMessageDialog(
|
||||||
"Sorry, four color generated decks aren't supported yet."
|
"Sorry, four color generated decks aren't supported yet."
|
||||||
+ "\n\rPlease use 2, 3, or 5 colors for this deck.",
|
+ "\n\rPlease use 2, 3, or 5 colors for this deck.",
|
||||||
"Generate deck: 4 colors", JOptionPane.ERROR_MESSAGE);
|
"Generate deck: 4 colors", FOptionPane.ERROR_ICON);
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
else if (colors0.size() > 5) {
|
else if (colors0.size() > 5) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
FOptionPane.showMessageDialog(
|
||||||
"Generate deck: maximum five colors!",
|
"Generate deck: maximum five colors!",
|
||||||
"Generate deck: too many colors", JOptionPane.ERROR_MESSAGE);
|
"Generate deck: too many colors", FOptionPane.ERROR_ICON);
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import java.util.Calendar;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
import javax.swing.text.BadLocationException;
|
import javax.swing.text.BadLocationException;
|
||||||
@@ -47,6 +46,7 @@ import forge.gui.toolbox.FCheckBox;
|
|||||||
import forge.gui.toolbox.FComboBoxWrapper;
|
import forge.gui.toolbox.FComboBoxWrapper;
|
||||||
import forge.gui.toolbox.FHtmlViewer;
|
import forge.gui.toolbox.FHtmlViewer;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FScrollPane;
|
import forge.gui.toolbox.FScrollPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.FTextArea;
|
import forge.gui.toolbox.FTextArea;
|
||||||
@@ -158,9 +158,7 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
final String warning = "This will replace contents of your currently open deck with whatever you are importing. Proceed?";
|
final String warning = "This will replace contents of your currently open deck with whatever you are importing. Proceed?";
|
||||||
final int answer = JOptionPane.showConfirmDialog(DeckImport.this, warning, "Replacing old deck",
|
if (!FOptionPane.showConfirmDialog(warning, "Replacing old deck")) {
|
||||||
JOptionPane.YES_NO_OPTION);
|
|
||||||
if (JOptionPane.NO_OPTION == answer) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Deck toSet = DeckImport.this.buildDeck();
|
final Deck toSet = DeckImport.this.buildDeck();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import forge.deck.DeckBase;
|
|||||||
import forge.gui.deckeditor.controllers.DeckController;
|
import forge.gui.deckeditor.controllers.DeckController;
|
||||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles editor preferences saving and loading.
|
* Handles editor preferences saving and loading.
|
||||||
@@ -43,10 +44,8 @@ public class SEditorIO {
|
|||||||
|
|
||||||
// Warn if no name
|
// Warn if no name
|
||||||
if (name == null || name.isEmpty()) {
|
if (name == null || name.isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
FOptionPane.showMessageDialog("Please name your deck using the 'Title' box.",
|
||||||
"Please name your deck using the 'Title' box.",
|
"Save Error!", FOptionPane.ERROR_ICON);
|
||||||
"Save Error!",
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Confirm if overwrite
|
// Confirm if overwrite
|
||||||
@@ -86,15 +85,12 @@ public class SEditorIO {
|
|||||||
public static boolean confirmSaveChanges(FScreen screen) {
|
public static boolean confirmSaveChanges(FScreen screen) {
|
||||||
if (!((DeckController<DeckBase>) CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController()).isSaved()) {
|
if (!((DeckController<DeckBase>) CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController()).isSaved()) {
|
||||||
Singletons.getControl().ensureScreenActive(screen); //ensure Deck Editor is active before showing dialog
|
Singletons.getControl().ensureScreenActive(screen); //ensure Deck Editor is active before showing dialog
|
||||||
final int choice = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
final int choice = FOptionPane.showOptionDialog("Save changes to current deck?", "Save Changes?",
|
||||||
"Save changes to current deck?",
|
FOptionPane.QUESTION_ICON, new String[] {"Save", "Don't Save", "Cancel"}, 0);
|
||||||
"Save Changes?",
|
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
|
||||||
JOptionPane.QUESTION_MESSAGE);
|
|
||||||
|
|
||||||
if (choice == JOptionPane.CANCEL_OPTION) { return false; }
|
if (choice == 2) { return false; }
|
||||||
|
|
||||||
if (choice == JOptionPane.YES_OPTION && !saveDeck()) { return false; }
|
if (choice == 0 && !saveDeck()) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import forge.gui.framework.DragCell;
|
|||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
import forge.gui.home.quest.CSubmenuQuestDecks;
|
import forge.gui.home.quest.CSubmenuQuestDecks;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.itemmanager.SpellShopManager;
|
import forge.gui.toolbox.itemmanager.SpellShopManager;
|
||||||
import forge.gui.toolbox.itemmanager.SItemManagerUtil;
|
import forge.gui.toolbox.itemmanager.SItemManagerUtil;
|
||||||
@@ -308,8 +309,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
final int value = this.getCardValue(item);
|
final int value = this.getCardValue(item);
|
||||||
|
|
||||||
if (value > this.questData.getAssets().getCredits()) {
|
if (value > this.questData.getAssets().getCredits()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
FOptionPane.showMessageDialog("Not enough credits to purchase " + (qty == 1 ? "" : qty + " copies of ") + item.getName() + ".");
|
||||||
"Not enough credits to purchase " + (qty == 1 ? "" : qty + " copies of ") + item.getName() + ".");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package forge.gui.framework;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.bazaar.CBazaarUI;
|
import forge.gui.bazaar.CBazaarUI;
|
||||||
import forge.gui.bazaar.VBazaarUI;
|
import forge.gui.bazaar.VBazaarUI;
|
||||||
@@ -13,6 +11,7 @@ import forge.gui.home.CHomeUI;
|
|||||||
import forge.gui.home.VHomeUI;
|
import forge.gui.home.VHomeUI;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.gui.match.VMatchUI;
|
import forge.gui.match.VMatchUI;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.FSkin.SkinImage;
|
import forge.gui.toolbox.FSkin.SkinImage;
|
||||||
import forge.gui.workshop.CWorkshopUI;
|
import forge.gui.workshop.CWorkshopUI;
|
||||||
@@ -202,7 +201,7 @@ public enum FScreen {
|
|||||||
}
|
}
|
||||||
catch (final Exception e) {
|
catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Failed to delete layout file.");
|
FOptionPane.showErrorMessageDialog("Failed to delete layout file.");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import forge.deck.Deck;
|
|||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
import forge.game.GameFormat;
|
import forge.game.GameFormat;
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
@@ -255,7 +256,7 @@ public enum CSubmenuQuestData implements ICDoc {
|
|||||||
final String questName = SSubmenuQuestUtil.cleanString(o.toString());
|
final String questName = SSubmenuQuestUtil.cleanString(o.toString());
|
||||||
|
|
||||||
if (getAllQuests().get(questName) != null || questName.equals("")) {
|
if (getAllQuests().get(questName) != null || questName.equals("")) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Please pick another quest name, a quest already has that name.");
|
FOptionPane.showMessageDialog("Please pick another quest name, a quest already has that name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.quest.data.QuestData;
|
import forge.quest.data.QuestData;
|
||||||
@@ -310,7 +312,7 @@ public class QuestFileLister extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (exists || questName.equals("")) {
|
if (exists || questName.equals("")) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Please pick another quest name, a quest already has that name.");
|
FOptionPane.showMessageDialog("Please pick another quest name, a quest already has that name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import forge.gui.deckchooser.DecksComboBox.DeckType;
|
|||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.menus.IMenuProvider;
|
import forge.gui.menus.IMenuProvider;
|
||||||
import forge.gui.menus.MenuUtil;
|
import forge.gui.menus.MenuUtil;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
import forge.net.Lobby;
|
import forge.net.Lobby;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -100,7 +101,7 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
|
|||||||
private void startGame(final GameType gameType) {
|
private void startGame(final GameType gameType) {
|
||||||
for(int i=0;i<view.getNumPlayers();i++) {
|
for(int i=0;i<view.getNumPlayers();i++) {
|
||||||
if (view.getDeckChooser(i).getPlayer() == null) {
|
if (view.getDeckChooser(i).getPlayer() == null) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Please specify a deck for each player first.");
|
FOptionPane.showMessageDialog("Please specify a deck for each player first.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import forge.gui.framework.ICDoc;
|
|||||||
import forge.gui.toolbox.FComboBox;
|
import forge.gui.toolbox.FComboBox;
|
||||||
import forge.gui.toolbox.FComboBoxPanel;
|
import forge.gui.toolbox.FComboBoxPanel;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
|
||||||
@@ -183,7 +184,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), 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) {
|
if (reply == JOptionPane.YES_OPTION) {
|
||||||
if (FScreen.DECK_EDITOR_CONSTRUCTED.deleteLayoutFile()) {
|
if (FScreen.DECK_EDITOR_CONSTRUCTED.deleteLayoutFile()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Deck Editor layout has been reset.");
|
FOptionPane.showMessageDialog("Deck Editor layout has been reset.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +197,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Workshop Layout", JOptionPane.YES_NO_OPTION);
|
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Workshop Layout", JOptionPane.YES_NO_OPTION);
|
||||||
if (reply == JOptionPane.YES_OPTION) {
|
if (reply == JOptionPane.YES_OPTION) {
|
||||||
if (FScreen.WORKSHOP_SCREEN.deleteLayoutFile()) {
|
if (FScreen.WORKSHOP_SCREEN.deleteLayoutFile()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Workshop layout has been reset.");
|
FOptionPane.showMessageDialog("Workshop layout has been reset.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), 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) {
|
if (reply == JOptionPane.YES_OPTION) {
|
||||||
if (FScreen.MATCH_SCREEN.deleteLayoutFile()) {
|
if (FScreen.MATCH_SCREEN.deleteLayoutFile()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Match Screen layout has been reset.");
|
FOptionPane.showMessageDialog("Match Screen layout has been reset.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import javax.swing.JOptionPane;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
|
||||||
@@ -34,9 +35,7 @@ public final class GamePlayerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void showThankYouPrompt(String playerName) {
|
private static void showThankYouPrompt(String playerName) {
|
||||||
JOptionPane.showMessageDialog(
|
FOptionPane.showMessageDialog("Thank you, " + playerName + ". " +
|
||||||
JOptionPane.getRootFrame(),
|
|
||||||
"Thank you, " + playerName + ". " +
|
|
||||||
"You will not be prompted again but you can change\nyour name at any time using the \"Player Name\" setting in Preferences.\n\n");
|
"You will not be prompted again but you can change\nyour name at any time using the \"Player Name\" setting in Preferences.\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ import forge.gui.match.views.VHand;
|
|||||||
import forge.gui.match.views.VPlayers;
|
import forge.gui.match.views.VPlayers;
|
||||||
import forge.gui.match.views.VStack;
|
import forge.gui.match.views.VStack;
|
||||||
import forge.gui.menus.IMenuProvider;
|
import forge.gui.menus.IMenuProvider;
|
||||||
import forge.gui.menus.MenuUtil;
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FOverlay;
|
import forge.gui.toolbox.FOverlay;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.FSkin.SkinImage;
|
import forge.gui.toolbox.FSkin.SkinImage;
|
||||||
@@ -497,7 +497,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
|||||||
String userPrompt =
|
String userPrompt =
|
||||||
"This will end the current game and you will not be able to resume.\n\n" +
|
"This will end the current game and you will not be able to resume.\n\n" +
|
||||||
"Concede anyway?";
|
"Concede anyway?";
|
||||||
if (MenuUtil.getUserConfirmation(userPrompt, "Concede Game?", false)) {
|
if (FOptionPane.showConfirmDialog(userPrompt, "Concede Game?", false)) {
|
||||||
Singletons.getControl().stopGame();
|
Singletons.getControl().stopGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import javax.swing.JMenuItem;
|
|||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.toolbox.FOptionPane;
|
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.FSkin.SkinProp;
|
import forge.gui.toolbox.FSkin.SkinProp;
|
||||||
import forge.gui.toolbox.imaging.ImageUtil;
|
import forge.gui.toolbox.imaging.ImageUtil;
|
||||||
@@ -21,7 +20,8 @@ public final class MenuUtil {
|
|||||||
public static void openUrlInBrowser(String url) {
|
public static void openUrlInBrowser(String url) {
|
||||||
try {
|
try {
|
||||||
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
|
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
catch (IOException e) {
|
||||||
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
|
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -35,15 +35,10 @@ public final class MenuUtil {
|
|||||||
return KeyStroke.getKeyStroke(key, DEFAULT_MenuShortcutKeyMask);
|
return KeyStroke.getKeyStroke(key, DEFAULT_MenuShortcutKeyMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getUserConfirmation(String prompt, String dialogTitle, boolean defaultYes) {
|
|
||||||
String[] options = {"Yes", "No"};
|
|
||||||
int reply = FOptionPane.showOptionDialog(prompt, dialogTitle, FSkin.getIcon(FSkin.InterfaceIcons.ICO_QUESTION), options, defaultYes ? 0 : 1);
|
|
||||||
return (reply == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMenuProvider(IMenuProvider provider) {
|
public static void setMenuProvider(IMenuProvider provider) {
|
||||||
Singletons.getControl().getForgeMenu().setProvider(provider);
|
Singletons.getControl().getForgeMenu().setProvider(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMenuHint(final JMenuItem menu, final String hint) {
|
public static void setMenuHint(final JMenuItem menu, final String hint) {
|
||||||
menu.setToolTipText(hint);
|
menu.setToolTipText(hint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,40 @@ import forge.view.FDialog;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class FOptionPane extends FDialog {
|
public class FOptionPane extends FDialog {
|
||||||
private int result;
|
public static final SkinImage QUESTION_ICON = FSkin.getIcon(FSkin.InterfaceIcons.ICO_QUESTION);
|
||||||
|
public static final SkinImage INFORMATION_ICON = FSkin.getIcon(FSkin.InterfaceIcons.ICO_INFORMATION);
|
||||||
|
public static final SkinImage WARNING_ICON = FSkin.getIcon(FSkin.InterfaceIcons.ICO_WARNING);
|
||||||
|
public static final SkinImage ERROR_ICON = FSkin.getIcon(FSkin.InterfaceIcons.ICO_ERROR);
|
||||||
|
|
||||||
|
public static void showMessageDialog(String message) {
|
||||||
|
showMessageDialog(message, "Forge", INFORMATION_ICON);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showErrorMessageDialog(String message) {
|
||||||
|
showMessageDialog(message, "Forge", ERROR_ICON);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showMessageDialog(String message, String title, SkinImage icon) {
|
||||||
|
showOptionDialog(message, title, icon, new String[] {"OK"}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showConfirmDialog(String message, String title) {
|
||||||
|
return showConfirmDialog(message, title, "Yes", "No", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showConfirmDialog(String message, String title, boolean defaultYes) {
|
||||||
|
return showConfirmDialog(message, title, "Yes", "No", defaultYes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showConfirmDialog(String message, String title, String yesButtonText, String noButtonText) {
|
||||||
|
return showConfirmDialog(message, title, yesButtonText, noButtonText, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean showConfirmDialog(String message, String title, String yesButtonText, String noButtonText, boolean defaultYes) {
|
||||||
|
String[] options = {yesButtonText, noButtonText};
|
||||||
|
int reply = FOptionPane.showOptionDialog(message, title, QUESTION_ICON, options, defaultYes ? 0 : 1);
|
||||||
|
return (reply == 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static int showOptionDialog(String message, String title, SkinImage icon, String[] options, int defaultOption) {
|
public static int showOptionDialog(String message, String title, SkinImage icon, String[] options, int defaultOption) {
|
||||||
FTextArea txtMessage = new FTextArea(message);
|
FTextArea txtMessage = new FTextArea(message);
|
||||||
@@ -30,13 +63,14 @@ public class FOptionPane extends FDialog {
|
|||||||
txtMessage.setMaximumSize(new Dimension(parentSize.width / 2, parentSize.height - 100));
|
txtMessage.setMaximumSize(new Dimension(parentSize.width / 2, parentSize.height - 100));
|
||||||
|
|
||||||
FOptionPane optionPane = new FOptionPane(title, icon, txtMessage, options, defaultOption);
|
FOptionPane optionPane = new FOptionPane(title, icon, txtMessage, options, defaultOption);
|
||||||
optionPane.result = options.length - 1; //default result to final option in case dialog closed
|
|
||||||
optionPane.setVisible(true);
|
optionPane.setVisible(true);
|
||||||
int dialogResult = optionPane.result;
|
int dialogResult = optionPane.result;
|
||||||
optionPane.dispose();
|
optionPane.dispose();
|
||||||
return dialogResult;
|
return dialogResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int result = -1; //default result to -1, indicating dialog closed without choosing option
|
||||||
|
|
||||||
private FOptionPane(String title, SkinImage icon, JComponent comp, String[] options, int defaultOption) {
|
private FOptionPane(String title, SkinImage icon, JComponent comp, String[] options, int defaultOption) {
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
|
|
||||||
|
|||||||
@@ -1487,7 +1487,7 @@ public enum FSkin {
|
|||||||
|
|
||||||
public enum InterfaceIcons implements SkinProp {
|
public enum InterfaceIcons implements SkinProp {
|
||||||
ICO_QUESTION (new int[] {560, 800, 32, 32}),
|
ICO_QUESTION (new int[] {560, 800, 32, 32}),
|
||||||
ICO_INFO (new int[] {592, 800, 32, 32}),
|
ICO_INFORMATION (new int[] {592, 800, 32, 32}),
|
||||||
ICO_WARNING (new int[] {560, 832, 32, 32}),
|
ICO_WARNING (new int[] {560, 832, 32, 32}),
|
||||||
ICO_ERROR (new int[] {592, 832, 32, 32}),
|
ICO_ERROR (new int[] {592, 832, 32, 32}),
|
||||||
ICO_DELETE (new int[] {640, 480, 20, 20}),
|
ICO_DELETE (new int[] {640, 480, 20, 20}),
|
||||||
|
|||||||
@@ -23,12 +23,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.CardStorageReader;
|
import forge.CardStorageReader;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
|
|
||||||
public final class CardScriptInfo {
|
public final class CardScriptInfo {
|
||||||
private String text;
|
private String text;
|
||||||
@@ -61,8 +60,9 @@ public final class CardScriptInfo {
|
|||||||
|
|
||||||
this.text = text0;
|
this.text = text0;
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception ex) {
|
}
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Problem writing file - " + this.file + " : " + ex);
|
catch (final Exception ex) {
|
||||||
|
FOptionPane.showErrorMessageDialog("Problem writing file - " + this.file + " : " + ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import java.awt.KeyEventDispatcher;
|
|||||||
import java.awt.KeyboardFocusManager;
|
import java.awt.KeyboardFocusManager;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.PopupMenu;
|
import java.awt.PopupMenu;
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.GraphicsDevice.WindowTranslucency;
|
import java.awt.GraphicsDevice.WindowTranslucency;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
@@ -100,7 +99,7 @@ public class FDialog extends JDialog implements ITitleBarOwner, KeyEventDispatch
|
|||||||
|
|
||||||
//draw rounded border
|
//draw rounded border
|
||||||
final Graphics2D g2d = (Graphics2D) g.create();
|
final Graphics2D g2d = (Graphics2D) g.create();
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
//g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //TODO: Re-enable anti-aliasing when it won't break on Linux
|
||||||
skin.setGraphicsColor(g2d, borderColor);
|
skin.setGraphicsColor(g2d, borderColor);
|
||||||
if (isSetShapeSupported) {
|
if (isSetShapeSupported) {
|
||||||
g2d.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, cornerDiameter, cornerDiameter);
|
g2d.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, cornerDiameter, cornerDiameter);
|
||||||
|
|||||||
Reference in New Issue
Block a user