From 4adcff39ec3ca45daa9152d755751346b9dc8719 Mon Sep 17 00:00:00 2001 From: slapshot5 Date: Thu, 6 Oct 2011 00:42:05 +0000 Subject: [PATCH] add an "Exit" option under the Menu menu from the main screen. --- res/lang/de.properties | 1 + res/lang/en.properties | 1 + .../java/forge/properties/NewConstants.java | 1 + .../java/forge/view/swing/OldGuiNewGame.java | 29 +++++++++++++++++-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/res/lang/de.properties b/res/lang/de.properties index b608075b1a4..a677d689291 100644 --- a/res/lang/de.properties +++ b/res/lang/de.properties @@ -113,6 +113,7 @@ NewGame/menu/cardSizes=Kartengr NewGame/menu/cardStack="Stack" größe einstellen NewGame/menu/cardStackOffset="Stack Offset" einstellen NewGame/menu/about=Über +NewGame/menu/exit=Aufgang NewGame/options/title=Optionen NewGame/options/font=Benutze LAF Schriften NewGame/options/cardOverlay=Benutze Mana und Text diff --git a/res/lang/en.properties b/res/lang/en.properties index fd57b252c27..28e58de5937 100644 --- a/res/lang/en.properties +++ b/res/lang/en.properties @@ -150,6 +150,7 @@ NewGame/menu/cardSizes=Specify Max Card Size NewGame/menu/cardStack=Specify Max Stack Size NewGame/menu/cardStackOffset=Specify Stack Offset NewGame/menu/about=About +NewGame/menu/exit=Exit NewGame/options/title=Options NewGame/options/font=Use LAF Fonts NewGame/options/cardOverlay=Use mana and text card overlay diff --git a/src/main/java/forge/properties/NewConstants.java b/src/main/java/forge/properties/NewConstants.java index b13e951d78e..dcd3393b7cc 100644 --- a/src/main/java/forge/properties/NewConstants.java +++ b/src/main/java/forge/properties/NewConstants.java @@ -436,6 +436,7 @@ public interface NewConstants { String CARD_STACK = "%s/NewGame/menu/cardStack"; String CARD_STACK_OFFSET = "%s/NewGame/menu/cardStackOffset"; String ABOUT = "%s/NewGame/menu/about"; + String EXIT = "%s/NewGame/menu/exit"; } public static interface OPTIONS { diff --git a/src/main/java/forge/view/swing/OldGuiNewGame.java b/src/main/java/forge/view/swing/OldGuiNewGame.java index 098cdd3c56d..768b402ec72 100644 --- a/src/main/java/forge/view/swing/OldGuiNewGame.java +++ b/src/main/java/forge/view/swing/OldGuiNewGame.java @@ -1,7 +1,5 @@ package forge.view.swing; -import arcane.ui.CardPanel; - import com.esotericsoftware.minlog.Log; import forge.*; import forge.deck.Deck; @@ -125,6 +123,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. private final Action HOW_TO_PLAY_ACTION = new HowToPlayAction(); private final Action DNLD_PRICES_ACTION = new DownloadPriceAction(); private final Action BUGZ_REPORTER_ACTION = new BugzReporterAction(); + private final Action EXIT_ACTION = new ExitAction(); /** *

@@ -200,7 +199,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. // CARD_SIZES_ACTION, LOOK_AND_FEEL_ACTION, DNLD_PRICES_ACTION, DOWNLOAD_ACTION_LQ, DOWNLOAD_ACTION_SETLQ, IMPORT_PICTURE, CARD_SIZES_ACTION, CARD_STACK_ACTION, CARD_STACK_OFFSET_ACTION, BUGZ_REPORTER_ACTION, - ErrorViewer.ALL_THREADS_ACTION, ABOUT_ACTION }; + ErrorViewer.ALL_THREADS_ACTION, ABOUT_ACTION, EXIT_ACTION }; JMenu menu = new JMenu(ForgeProps.getLocalized(MENU.TITLE)); for (Action a : actions) { menu.add(a); @@ -284,6 +283,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent ev) { + dispose(); System.exit(0); } }); @@ -1405,6 +1405,29 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. JOptionPane.showMessageDialog(null, area, "About", JOptionPane.INFORMATION_MESSAGE); } } + + /** + * + * @author slapshot5 + * + */ + public static class ExitAction extends AbstractAction { + private static final long serialVersionUID = -319036939657136034L; + + /** + * + */ + public ExitAction() { + super(ForgeProps.getLocalized(MENU_BAR.MENU.EXIT)); + } + + /** + * + */ + public final void actionPerformed(final ActionEvent e) { + System.exit(0); + } + } /** *