From d12136f71401dc53f8096ec9855287fdc95d55b6 Mon Sep 17 00:00:00 2001 From: jendave Date: Wed, 26 Oct 2011 19:54:07 +0000 Subject: [PATCH] checkstyle --- .../forge/view/swing/ApplicationView.java | 161 +- .../java/forge/view/swing/Gui_HomeScreen.java | 1599 ++++++++--------- src/main/java/forge/view/swing/Main.java | 21 +- .../java/forge/view/swing/OldGuiNewGame.java | 571 +++--- .../java/forge/view/swing/SplashFrame.java | 152 +- .../view/swing/SplashProgressComponent.java | 107 +- .../forge/view/swing/SplashProgressModel.java | 43 +- .../java/forge/view/swing/WinLoseFrame.java | 230 ++- .../forge/view/swing/WinLoseModeHandler.java | 91 +- 9 files changed, 1523 insertions(+), 1452 deletions(-) diff --git a/src/main/java/forge/view/swing/ApplicationView.java b/src/main/java/forge/view/swing/ApplicationView.java index 963e0e1f443..0cb7e4d5077 100644 --- a/src/main/java/forge/view/swing/ApplicationView.java +++ b/src/main/java/forge/view/swing/ApplicationView.java @@ -5,7 +5,6 @@ import javax.swing.UIManager; import net.slightlymagic.braids.util.UtilFunctions; import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; - import arcane.ui.util.ManaSymbols; import com.esotericsoftware.minlog.Log; @@ -26,59 +25,71 @@ import forge.view.swing.OldGuiNewGame.CardStackAction; import forge.view.swing.OldGuiNewGame.CardStackOffsetAction; /** - * The main view for Forge: a java swing application. - * All view class instances should be accessible from here. + * The main view for Forge: a java swing application. All view class instances + * should be accessible from here. */ public class ApplicationView implements FView { private transient SplashFrame splashFrame; /** - * The splashFrame field is guaranteed to exist when this constructor - * exits. + * The splashFrame field is guaranteed to exist when this constructor exits. + * + * @param skin + * the skin */ public ApplicationView(final FSkin skin) { // We must use invokeAndWait here to fulfill the constructor's // contract. - UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { // NOPMD by Braids on 8/18/11 11:37 PM - public void run() { - splashFrame = new SplashFrame(skin); - } - }); + UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { // NOPMD + // by + // Braids + // on + // 8/18/11 + // 11:37 + // PM + public void run() { + splashFrame = new SplashFrame(skin); + } + }); + + SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on + // 8/18/11 11:37 PM + public void run() { + splashFrame.setVisible(true); + } + }); - SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/18/11 11:37 PM - public void run() { - splashFrame.setVisible(true); - } - }); - } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see forge.view.FView#getCardLoadingProgressMonitor() */ - @Override + @Override public final BraidsProgressMonitor getCardLoadingProgressMonitor() { BraidsProgressMonitor result; if (splashFrame == null) { result = null; - } - else { + } else { result = splashFrame.getMonitorModel(); } - return result; + return result; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see forge.view.FView#setModel(forge.model.FModel) */ - + @Override - public final void setModel(final FModel model) { + public final void setModel(final FModel model) { try { final ForgePreferences preferences = model.getPreferences(); @@ -98,69 +109,75 @@ public class ApplicationView implements FView { CardSizesAction.set(preferences.cardSize); OldGuiNewGame.upldDrftCheckBox.setSelected(preferences.uploadDraftAI); OldGuiNewGame.foilRandomCheckBox.setSelected(preferences.randCFoil); - + AllZone.setSkin(new FSkin(preferences.skin)); } catch (Exception exn) { Log.error("Error loading preferences: " + exn); } - SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app - public void run() { - final ForgePreferences finalPreferences = model.getPreferences(); - - try { - if ("".equals(finalPreferences.laf)) { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } else { - UIManager.setLookAndFeel(finalPreferences.laf); - } - } catch (Exception ex) { - ErrorViewer.showError(ex); - } - } - }); - - // For the following two blocks, check if user has cancelled SplashFrame. - // Note: Error thrown sometimes because log file cannot be accessed - if(!splashFrame.getSplashHasBeenClosed()) { - AllZone.getCardFactory(); // forces preloading of all cards - } - - if(!splashFrame.getSplashHasBeenClosed()) { - try { - ManaSymbols.loadImages(); - - Constant.Runtime.gameType = GameType.Constructed; - SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app + SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 + // 1:07 PM: this isn't a web + // app public void run() { - AllZone.getInputControl().setComputer(new ComputerAI_Input(new ComputerAI_General())); - - // Enable only one of the following two lines. The second - // is useful for debugging. - - splashFrame.dispose(); - //splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - - splashFrame = null; - - if (System.getenv("NG2") != null) { - if (System.getenv("NG2").equalsIgnoreCase("true")) { - String argz[] = {}; - Gui_HomeScreen.main(argz); + final ForgePreferences finalPreferences = model.getPreferences(); + + try { + if ("".equals(finalPreferences.laf)) { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { - new OldGuiNewGame(); + UIManager.setLookAndFeel(finalPreferences.laf); } - } else { - new OldGuiNewGame(); + } catch (Exception ex) { + ErrorViewer.showError(ex); } } }); + + // For the following two blocks, check if user has cancelled + // SplashFrame. + // Note: Error thrown sometimes because log file cannot be accessed + if (!splashFrame.getSplashHasBeenClosed()) { + AllZone.getCardFactory(); // forces preloading of all cards + } + + if (!splashFrame.getSplashHasBeenClosed()) { + try { + ManaSymbols.loadImages(); + + Constant.Runtime.gameType = GameType.Constructed; + SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids + // on 8/7/11 1:07 + // PM: this isn't a + // web app + public void run() { + AllZone.getInputControl().setComputer(new ComputerAI_Input(new ComputerAI_General())); + + // Enable only one of the following two lines. + // The second + // is useful for debugging. + + splashFrame.dispose(); + // splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + splashFrame = null; + + if (System.getenv("NG2") != null) { + if (System.getenv("NG2").equalsIgnoreCase("true")) { + String[] argz = {}; + Gui_HomeScreen.main(argz); + } else { + new OldGuiNewGame(); + } + } else { + new OldGuiNewGame(); + } + } + }); } catch (Exception ex) { ErrorViewer.showError(ex); } - } // End if(splashHasBeenClosed) + } // End if(splashHasBeenClosed) } // End ApplicationView() } diff --git a/src/main/java/forge/view/swing/Gui_HomeScreen.java b/src/main/java/forge/view/swing/Gui_HomeScreen.java index 4b8e8aa4200..4dd550ee367 100644 --- a/src/main/java/forge/view/swing/Gui_HomeScreen.java +++ b/src/main/java/forge/view/swing/Gui_HomeScreen.java @@ -2,26 +2,40 @@ package forge.view.swing; import static net.slightlymagic.braids.util.UtilFunctions.safeToString; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; import java.awt.EventQueue; +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Random; import javax.swing.DefaultListModel; -import javax.swing.JFrame; -import javax.swing.JLabel; import javax.swing.ImageIcon; import javax.swing.JButton; -import javax.swing.JOptionPane; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JLabel; import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.JTextArea; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.BevelBorder; -import java.awt.Toolkit; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import javax.swing.SwingConstants; -import java.awt.Font; + import org.eclipse.wb.swing.FocusTraversalOnArray; import forge.AllZone; @@ -32,14 +46,8 @@ import forge.GUI_ImportPicture; import forge.GuiDisplay4; import forge.Gui_DownloadPrices; import forge.Gui_DownloadSetPictures_LQ; -import forge.game.GameType; -import forge.game.limited.BoosterDraft_1; -import forge.game.limited.CardPoolLimitation; -import forge.gui.deckeditor.DeckEditorCommon; -import forge.gui.deckeditor.DeckEditorDraft; import forge.MyRandom; import forge.PlayerType; -import forge.game.limited.SealedDeck; import forge.Singletons; import forge.deck.Deck; import forge.deck.DeckGeneration; @@ -50,47 +58,44 @@ import forge.deck.generate.GenerateConstructedMultiColorDeck; import forge.deck.generate.GenerateThemeDeck; import forge.error.BugzReporter; import forge.error.ErrorViewer; +import forge.game.GameType; +import forge.game.limited.BoosterDraft_1; +import forge.game.limited.CardPoolLimitation; +import forge.game.limited.SealedDeck; import forge.gui.GuiUtils; import forge.gui.ListChooser; +import forge.gui.deckeditor.DeckEditorCommon; +import forge.gui.deckeditor.DeckEditorDraft; import forge.item.CardPrinted; import forge.item.ItemPool; -import forge.properties.ForgeProps; import forge.properties.ForgePreferences.CardSizeType; import forge.properties.ForgePreferences.StackOffsetType; +import forge.properties.ForgeProps; import forge.properties.NewConstants.LANG; import forge.properties.NewConstants.LANG.OldGuiNewGame.NEW_GAME_TEXT; import forge.quest.gui.QuestOptions; -import java.awt.Component; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Random; -import java.awt.Color; -import javax.swing.JScrollPane; -import javax.swing.ScrollPaneConstants; -import javax.swing.JPanel; -import javax.swing.JCheckBox; -import java.awt.Dimension; -import java.awt.GridLayout; - +/** + * The Class Gui_HomeScreen. + */ public class Gui_HomeScreen { - // Hack... WindowBuilder can't deal with path relative to the project folder like "res/" + // Hack... WindowBuilder can't deal with path relative to the project folder + // like "res/" // So... use a full path when debugging or designing with WindowBuilder - //private String HomeScreenPath = "/home/rob/ForgeSVN/ForgeSVN/res/images/ui/HomeScreen/"; + // private String HomeScreenPath = + // "/home/rob/ForgeSVN/ForgeSVN/res/images/ui/HomeScreen/"; // And switch to relative path for distribution private String HomeScreenPath = "res/images/ui/HomeScreen/"; - + private JFrame gHS; - + private JLabel lblBackground = new JLabel(); private ImageIcon imgBackground = new ImageIcon(HomeScreenPath + "default_600/Main.jpg"); - + // Interactive Elements private JLabel lblGameMode = new JLabel(); private ImageIcon imgMode = new ImageIcon(HomeScreenPath + "default_600/btnMode_title.png"); - + private JButton cmdConstructed = new JButton(); private ImageIcon imgConstructedUp = new ImageIcon(HomeScreenPath + "default_600/btnMode_constrUp.png"); private ImageIcon imgConstructedOver = new ImageIcon(HomeScreenPath + "default_600/btnMode_constrOver.png"); @@ -117,7 +122,7 @@ public class Gui_HomeScreen { private JLabel lblLibrary = new JLabel(); private ImageIcon imgLibrary = new ImageIcon(HomeScreenPath + "default_600/btnLibr_title.png"); - + private JButton cmdHumanDeck; private ImageIcon imgHumanUp = new ImageIcon(HomeScreenPath + "default_600/btnLibr_humanUp.png"); private ImageIcon imgHumanOver = new ImageIcon(HomeScreenPath + "default_600/btnLibr_humanOver.png"); @@ -134,33 +139,33 @@ public class Gui_HomeScreen { private ImageIcon imgEditorUp = new ImageIcon(HomeScreenPath + "default_600/btnDeck_editorUp.png"); private ImageIcon imgEditorOver = new ImageIcon(HomeScreenPath + "default_600/btnDeck_editorOver.png"); private ImageIcon imgEditorDown = new ImageIcon(HomeScreenPath + "default_600/btnDeck_editorDown.png"); - + private JButton cmdStart = new JButton(); private ImageIcon imgStartUp = new ImageIcon(HomeScreenPath + "default_600/btnStart_Up.png"); private ImageIcon imgStartOver = new ImageIcon(HomeScreenPath + "default_600/btnStart_Over.png"); private ImageIcon imgStartDown = new ImageIcon(HomeScreenPath + "default_600/btnStart_Down.png"); - + private final JButton cmdSettings = new JButton(); private ImageIcon imgSettingsUp = new ImageIcon(HomeScreenPath + "default_600/btnSettings_unselected.png"); private ImageIcon imgSettingsOver = new ImageIcon(HomeScreenPath + "default_600/btnSettings_hover.png"); - private ImageIcon imgSettingsDown = new ImageIcon(HomeScreenPath + "default_600/btnSettings_selected.png"); - + private ImageIcon imgSettingsDown = new ImageIcon(HomeScreenPath + "default_600/btnSettings_selected.png"); + private final JButton cmdUtilities = new JButton(""); private ImageIcon imgUtilitiesUp = new ImageIcon(HomeScreenPath + "default_600/btnUtils_unselected.png"); private ImageIcon imgUtilitiesOver = new ImageIcon(HomeScreenPath + "default_600/btnUtils_hover.png"); - private ImageIcon imgUtilitiesDown = new ImageIcon(HomeScreenPath + "default_600/btnUtils_selected.png"); - + private ImageIcon imgUtilitiesDown = new ImageIcon(HomeScreenPath + "default_600/btnUtils_selected.png"); + // Intro Panel private final JPanel pnlIntro = new JPanel(); private JLabel lblIntro = new JLabel(); - + // Deck Panel private final JPanel pnlDecks = new JPanel(); private JLabel lblDecksHeader = new JLabel(); private JList lstDecks = new JList(); private final JScrollPane scrDecks = new JScrollPane(); private final JButton cmdDeckSelect = new JButton("Select Deck"); - + // Settings Panel private final JPanel pnlSettings = new JPanel(); private final JScrollPane scrSettings = new JScrollPane(); @@ -188,21 +193,23 @@ public class Gui_HomeScreen { // Local objects private Color clrScrollBackground = new Color(222, 184, 135); - + private final DeckManager deckManager = AllZone.getDeckManager(); private List allDecks; private static DeckEditorCommon editor; - + private String PlayerSelected = ""; private GameType GameTypeSelected = GameType.Constructed; private String HumanDeckSelected = ""; private String AIDeckSelected = ""; - /** * Launch the application. + * + * @param args + * the arguments */ - public static void main(String[] args) { + public static void main(final String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { @@ -226,815 +233,617 @@ public class Gui_HomeScreen { * Initialize the contents of the frame. */ private void initialize() { - { - gHS = new JFrame(); - gHS.setIconImage(Toolkit.getDefaultToolkit().getImage(HomeScreenPath + "../favicon.png")); - gHS.setTitle("Forge"); - gHS.setResizable(false); - gHS.setBounds(100, 100, 605, 627); - gHS.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - gHS.getContentPane().setLayout(null); - } + gHS = new JFrame(); + gHS.setIconImage(Toolkit.getDefaultToolkit().getImage(HomeScreenPath + "../favicon.png")); + gHS.setTitle("Forge"); + gHS.setResizable(false); + gHS.setBounds(100, 100, 605, 627); + gHS.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + gHS.getContentPane().setLayout(null); + lblGameMode.setFocusable(false); + lblGameMode.setOpaque(false); + lblGameMode.setBorder(null); + lblGameMode.setIcon(imgMode); + lblGameMode.setBounds(10, 187, 205, 30); + gHS.getContentPane().add(lblGameMode); + cmdConstructed.setSelectedIcon(imgConstructedSel); + cmdConstructed.setBorderPainted(false); + cmdConstructed.setBorder(null); + cmdConstructed.setPressedIcon(imgConstructedDown); + cmdConstructed.setRolloverEnabled(true); + cmdConstructed.setRolloverIcon(imgConstructedOver); + cmdConstructed.setOpaque(false); + cmdConstructed.setIcon(imgConstructedUp); + cmdConstructed.setAlignmentX(Component.CENTER_ALIGNMENT); + cmdConstructed.setContentAreaFilled(false); + cmdConstructed.setBounds(9, 217, 205, 26); + cmdConstructed.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + GameTypeSelected = GameType.Constructed; + showDecks(); + doGameModeSelect(); + } + }); + cmdConstructed.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdConstructed.setIcon(imgConstructedOver); + } - { - lblGameMode.setFocusable(false); - lblGameMode.setOpaque(false); - lblGameMode.setBorder(null); - lblGameMode.setIcon(imgMode); - lblGameMode.setBounds(10, 187, 205, 30); - - gHS.getContentPane().add(lblGameMode); - } + public void focusLost(final FocusEvent arg0) { + cmdConstructed.setIcon(imgConstructedUp); + } + }); + gHS.getContentPane().add(cmdConstructed); + cmdSealed.setRolloverIcon(imgSealedOver); + cmdSealed.setPressedIcon(imgSealedDown); + cmdSealed.setRolloverEnabled(true); + cmdSealed.setSelectedIcon(imgSealedSel); + cmdSealed.setOpaque(false); + cmdSealed.setBorder(null); + cmdSealed.setBorderPainted(false); + cmdSealed.setIcon(imgSealedUp); + cmdSealed.setFont(new Font("Dialog", Font.BOLD, 10)); + cmdSealed.setAlignmentX(Component.CENTER_ALIGNMENT); + cmdSealed.setContentAreaFilled(false); + cmdSealed.setBounds(9, 243, 205, 26); + cmdSealed.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + GameTypeSelected = GameType.Sealed; + showDecks(); + doGameModeSelect(); + } + }); + cmdSealed.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdSealed.setIcon(imgSealedOver); + } - { - cmdConstructed.setSelectedIcon(imgConstructedSel); - cmdConstructed.setBorderPainted(false); - cmdConstructed.setBorder(null); - cmdConstructed.setPressedIcon(imgConstructedDown); - cmdConstructed.setRolloverEnabled(true); - cmdConstructed.setRolloverIcon(imgConstructedOver); - cmdConstructed.setOpaque(false); - cmdConstructed.setIcon(imgConstructedUp); - cmdConstructed.setAlignmentX(Component.CENTER_ALIGNMENT); - cmdConstructed.setContentAreaFilled(false); - cmdConstructed.setBounds(9, 217, 205, 26); - - cmdConstructed.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - GameTypeSelected = GameType.Constructed; - showDecks(); - doGameModeSelect(); - } - }); - - cmdConstructed.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdConstructed.setIcon(imgConstructedOver); - } - - public void focusLost(FocusEvent arg0) { - cmdConstructed.setIcon(imgConstructedUp); - } - }); - - gHS.getContentPane().add(cmdConstructed); - } - - { - cmdSealed.setRolloverIcon(imgSealedOver); - cmdSealed.setPressedIcon(imgSealedDown); - cmdSealed.setRolloverEnabled(true); - cmdSealed.setSelectedIcon(imgSealedSel); - cmdSealed.setOpaque(false); - cmdSealed.setBorder(null); - cmdSealed.setBorderPainted(false); - cmdSealed.setIcon(imgSealedUp); - cmdSealed.setFont(new Font("Dialog", Font.BOLD, 10)); - cmdSealed.setAlignmentX(Component.CENTER_ALIGNMENT); - cmdSealed.setContentAreaFilled(false); - cmdSealed.setBounds(9, 243, 205, 26); - - cmdSealed.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - GameTypeSelected = GameType.Sealed; - showDecks(); - doGameModeSelect(); - } - }); - - cmdSealed.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdSealed.setIcon(imgSealedOver); - } - - public void focusLost(FocusEvent arg0) { - cmdSealed.setIcon(imgSealedUp); - } - }); - - gHS.getContentPane().add(cmdSealed); - } - - { - cmdDraft.setSelectedIcon(imgDraftSel); - cmdDraft.setRolloverIcon(imgDraftOver); - cmdDraft.setRolloverEnabled(true); - cmdDraft.setPressedIcon(imgDraftDown); - cmdDraft.setOpaque(false); - cmdDraft.setBorder(null); - cmdDraft.setBorderPainted(false); - cmdDraft.setIcon(imgDraftUp); - cmdDraft.setFont(new Font("Dialog", Font.BOLD, 10)); - cmdDraft.setAlignmentX(Component.CENTER_ALIGNMENT); - cmdDraft.setContentAreaFilled(false); - cmdDraft.setBounds(9, 269, 205, 26); - - cmdDraft.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - GameTypeSelected = GameType.Draft; - showDecks(); - doGameModeSelect(); - } - }); - - cmdDraft.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdDraft.setIcon(imgDraftOver); - } - - public void focusLost(FocusEvent arg0) { - cmdDraft.setIcon(imgDraftUp); - } - }); - - gHS.getContentPane().add(cmdDraft); - } - - { - cmdQuest.setRolloverIcon(imgQuestOver); - cmdQuest.setRolloverEnabled(true); - cmdQuest.setSelectedIcon(imgQuestSel); - cmdQuest.setPressedIcon(imgQuestDown); - cmdQuest.setOpaque(false); - cmdQuest.setBorder(null); - cmdQuest.setBorderPainted(false); - cmdQuest.setIcon(imgQuestUp); - cmdQuest.setFont(new Font("Dialog", Font.BOLD, 10)); - cmdQuest.setAlignmentX(Component.CENTER_ALIGNMENT); - cmdQuest.setContentAreaFilled(false); - cmdQuest.setBounds(9, 295, 205, 26); - - cmdQuest.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - GameTypeSelected = GameType.Quest; - showDecks(); - doGameModeSelect(); - } - }); - - cmdQuest.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdQuest.setIcon(imgQuestOver); - } - - public void focusLost(FocusEvent arg0) { - cmdQuest.setIcon(imgQuestUp); - } - }); - - gHS.getContentPane().add(cmdQuest); - } + public void focusLost(final FocusEvent arg0) { + cmdSealed.setIcon(imgSealedUp); + } + }); + gHS.getContentPane().add(cmdSealed); + cmdDraft.setSelectedIcon(imgDraftSel); + cmdDraft.setRolloverIcon(imgDraftOver); + cmdDraft.setRolloverEnabled(true); + cmdDraft.setPressedIcon(imgDraftDown); + cmdDraft.setOpaque(false); + cmdDraft.setBorder(null); + cmdDraft.setBorderPainted(false); + cmdDraft.setIcon(imgDraftUp); + cmdDraft.setFont(new Font("Dialog", Font.BOLD, 10)); + cmdDraft.setAlignmentX(Component.CENTER_ALIGNMENT); + cmdDraft.setContentAreaFilled(false); + cmdDraft.setBounds(9, 269, 205, 26); + cmdDraft.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + GameTypeSelected = GameType.Draft; + showDecks(); + doGameModeSelect(); + } + }); + cmdDraft.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdDraft.setIcon(imgDraftOver); + } - { - lblLibrary.setFocusable(false); - lblLibrary.setIcon(imgLibrary); - lblLibrary.setOpaque(false); - lblLibrary.setBounds(10, 338, 205, 30); - - gHS.getContentPane().add(lblLibrary); - } + public void focusLost(final FocusEvent arg0) { + cmdDraft.setIcon(imgDraftUp); + } + }); + gHS.getContentPane().add(cmdDraft); + cmdQuest.setRolloverIcon(imgQuestOver); + cmdQuest.setRolloverEnabled(true); + cmdQuest.setSelectedIcon(imgQuestSel); + cmdQuest.setPressedIcon(imgQuestDown); + cmdQuest.setOpaque(false); + cmdQuest.setBorder(null); + cmdQuest.setBorderPainted(false); + cmdQuest.setIcon(imgQuestUp); + cmdQuest.setFont(new Font("Dialog", Font.BOLD, 10)); + cmdQuest.setAlignmentX(Component.CENTER_ALIGNMENT); + cmdQuest.setContentAreaFilled(false); + cmdQuest.setBounds(9, 295, 205, 26); + cmdQuest.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + GameTypeSelected = GameType.Quest; + showDecks(); + doGameModeSelect(); + } + }); + cmdQuest.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdQuest.setIcon(imgQuestOver); + } - { - cmdHumanDeck = new JButton(""); - cmdHumanDeck.setSelectedIcon(imgHumanSel); - cmdHumanDeck.setRolloverIcon(imgHumanOver); - cmdHumanDeck.setPressedIcon(imgHumanDown); - cmdHumanDeck.setRolloverEnabled(true); - cmdHumanDeck.setIcon(imgHumanUp); - cmdHumanDeck.setOpaque(false); - cmdHumanDeck.setContentAreaFilled(false); - cmdHumanDeck.setBorder(null); - cmdHumanDeck.setBorderPainted(false); - cmdHumanDeck.setBounds(8, 368, 205, 26); - - cmdHumanDeck.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - PlayerSelected = "Human"; - showDecks(); - } - }); - - cmdHumanDeck.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdHumanDeck.setIcon(imgHumanOver); - } - - public void focusLost(FocusEvent arg0) { - cmdHumanDeck.setIcon(imgHumanUp); - } - }); - - gHS.getContentPane().add(cmdHumanDeck); - } - - { - cmdAIDeck = new JButton(""); - cmdAIDeck.setSelectedIcon(imgAISel); - cmdAIDeck.setPressedIcon(imgAIDown); - cmdAIDeck.setRolloverIcon(imgAIOver); - cmdAIDeck.setRolloverEnabled(true); - cmdAIDeck.setIcon(imgAIUp); - cmdAIDeck.setOpaque(false); - cmdAIDeck.setContentAreaFilled(false); - cmdAIDeck.setBorder(null); - cmdAIDeck.setBorderPainted(false); - cmdAIDeck.setBounds(8, 394, 205, 26); - - cmdAIDeck.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PlayerSelected = "AI"; - showDecks(); - - } - }); - - cmdAIDeck.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdAIDeck.setIcon(imgAIOver); - } - - public void focusLost(FocusEvent arg0) { - cmdAIDeck.setIcon(imgAIUp); - } - }); - - gHS.getContentPane().add(cmdAIDeck); - } - - { - cmdDeckEditor.setFocusPainted(false); - cmdDeckEditor.setPressedIcon(imgEditorDown); - cmdDeckEditor.setRolloverIcon(imgEditorOver); - cmdDeckEditor.setRolloverEnabled(true); - cmdDeckEditor.setContentAreaFilled(false); - cmdDeckEditor.setBorderPainted(false); - cmdDeckEditor.setBorder(null); - cmdDeckEditor.setOpaque(false); - cmdDeckEditor.setIcon(imgEditorUp); - cmdDeckEditor.setBounds(10, 436, 205, 30); - - cmdDeckEditor.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - doShowEditor(); - } - }); - - cmdDeckEditor.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdDeckEditor.setIcon(imgEditorOver); - } - - public void focusLost(FocusEvent arg0) { - cmdDeckEditor.setIcon(imgEditorUp); - } - }); - - gHS.getContentPane().add(cmdDeckEditor); - } + public void focusLost(final FocusEvent arg0) { + cmdQuest.setIcon(imgQuestUp); + } + }); + gHS.getContentPane().add(cmdQuest); + lblLibrary.setFocusable(false); + lblLibrary.setIcon(imgLibrary); + lblLibrary.setOpaque(false); + lblLibrary.setBounds(10, 338, 205, 30); + gHS.getContentPane().add(lblLibrary); + cmdHumanDeck = new JButton(""); + cmdHumanDeck.setSelectedIcon(imgHumanSel); + cmdHumanDeck.setRolloverIcon(imgHumanOver); + cmdHumanDeck.setPressedIcon(imgHumanDown); + cmdHumanDeck.setRolloverEnabled(true); + cmdHumanDeck.setIcon(imgHumanUp); + cmdHumanDeck.setOpaque(false); + cmdHumanDeck.setContentAreaFilled(false); + cmdHumanDeck.setBorder(null); + cmdHumanDeck.setBorderPainted(false); + cmdHumanDeck.setBounds(8, 368, 205, 26); + cmdHumanDeck.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + PlayerSelected = "Human"; + showDecks(); + } + }); + cmdHumanDeck.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdHumanDeck.setIcon(imgHumanOver); + } - { - cmdStart.setPressedIcon(imgStartDown); - cmdStart.setRolloverIcon(imgStartOver); - cmdStart.setRolloverEnabled(true); - cmdStart.setIcon(imgStartUp); - cmdStart.setOpaque(false); - cmdStart.setContentAreaFilled(false); - cmdStart.setBorder(null); - cmdStart.setBorderPainted(false); - cmdStart.setBounds(10, 476, 205, 84); - - cmdStart.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - doStartGame(); - } - }); - - cmdStart.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdStart.setIcon(imgStartDown); - } - - public void focusLost(FocusEvent arg0) { - cmdStart.setIcon(imgStartUp); - } - }); - - gHS.getContentPane().add(cmdStart); - } - - { - cmdSettings.setPressedIcon(imgSettingsDown); - cmdSettings.setRolloverIcon(imgSettingsOver); - cmdSettings.setRolloverEnabled(true); - cmdSettings.setIcon(imgSettingsUp); - cmdSettings.setOpaque(false); - cmdSettings.setContentAreaFilled(false); - cmdSettings.setBorder(null); - cmdSettings.setBorderPainted(false); - cmdSettings.setBounds(212, 10, 205, 50); - - cmdSettings.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdSettings.setIcon(imgSettingsOver); - } - - public void focusLost(FocusEvent arg0) { - cmdSettings.setIcon(imgSettingsUp); - } - }); + public void focusLost(final FocusEvent arg0) { + cmdHumanDeck.setIcon(imgHumanUp); + } + }); + gHS.getContentPane().add(cmdHumanDeck); + cmdAIDeck = new JButton(""); + cmdAIDeck.setSelectedIcon(imgAISel); + cmdAIDeck.setPressedIcon(imgAIDown); + cmdAIDeck.setRolloverIcon(imgAIOver); + cmdAIDeck.setRolloverEnabled(true); + cmdAIDeck.setIcon(imgAIUp); + cmdAIDeck.setOpaque(false); + cmdAIDeck.setContentAreaFilled(false); + cmdAIDeck.setBorder(null); + cmdAIDeck.setBorderPainted(false); + cmdAIDeck.setBounds(8, 394, 205, 26); + cmdAIDeck.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent e) { + PlayerSelected = "AI"; + showDecks(); - cmdSettings.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - pnlIntro.setVisible(false); - pnlDecks.setVisible(false); - pnlUtilities.setVisible(false); - - pnlSettings.setVisible(true); - } - }); - - gHS.getContentPane().add(cmdSettings); - } - - { - cmdUtilities.setIcon(imgUtilitiesUp); - cmdUtilities.setRolloverEnabled(true); - cmdUtilities.setRolloverIcon(imgUtilitiesOver); - cmdUtilities.setPressedIcon(imgUtilitiesDown); - cmdUtilities.setOpaque(false); - cmdUtilities.setContentAreaFilled(false); - cmdUtilities.setBorder(null); - cmdUtilities.setBorderPainted(false); - cmdUtilities.setBounds(395, 10, 205, 50); - - cmdUtilities.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent arg0) { - cmdUtilities.setIcon(imgUtilitiesOver); - } - - public void focusLost(FocusEvent arg0) { - cmdUtilities.setIcon(imgUtilitiesUp); - } - }); - - cmdUtilities.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - pnlIntro.setVisible(false); - pnlDecks.setVisible(false); - pnlSettings.setVisible(false); - - pnlUtilities.setVisible(true); - } - }); - - gHS.getContentPane().add(cmdUtilities); - } + } + }); + cmdAIDeck.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdAIDeck.setIcon(imgAIOver); + } - // Intro Panel - { - pnlIntro.setVisible(true); - pnlIntro.setOpaque(false); - pnlIntro.setBounds(245, 135, 325, 345); - gHS.getContentPane().add(pnlIntro); - pnlIntro.setLayout(null); - - { - lblIntro.setBounds(10, 10, 305, 300); - lblIntro.setFont(new Font("", Font.BOLD, 12)); - lblIntro.setHorizontalAlignment(SwingConstants.LEFT); - lblIntro.setOpaque(false); - lblIntro.setFocusable(false); - lblIntro.setText("Forge is an open source implementation of Magic: the Gathering written in the Java programming language.

" - + "
  • Select a Game Mode on the left
  • Select a Player
  • Choose a deck from the list
  • Click Select Deck
  • Press Start to begin the game
  • "); - - pnlIntro.add(lblIntro); + public void focusLost(final FocusEvent arg0) { + cmdAIDeck.setIcon(imgAIUp); } - } - - // Decks Panel - { - pnlDecks.setVisible(false); - pnlDecks.setOpaque(false); - pnlDecks.setBounds(245, 135, 325, 345); - gHS.getContentPane().add(pnlDecks); - pnlDecks.setLayout(null); - - { - lblDecksHeader.setBounds(10, 10, 305, 34); - pnlDecks.add(lblDecksHeader); - lblDecksHeader.setFont(new Font("", Font.BOLD | Font.ITALIC, 14)); - lblDecksHeader.setHorizontalAlignment(SwingConstants.CENTER); - lblDecksHeader.setOpaque(false); - lblDecksHeader.setFocusable(false); - } - { - scrDecks.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrDecks.setOpaque(false); - scrDecks.setBackground(clrScrollBackground); - scrDecks.setBounds(10, 45, 305, 260); - pnlDecks.add(scrDecks); - } - { - lstDecks.setVisible(true); - scrDecks.setViewportView(lstDecks); - lstDecks.setBackground(clrScrollBackground); - lstDecks.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + }); + gHS.getContentPane().add(cmdAIDeck); + cmdDeckEditor.setFocusPainted(false); + cmdDeckEditor.setPressedIcon(imgEditorDown); + cmdDeckEditor.setRolloverIcon(imgEditorOver); + cmdDeckEditor.setRolloverEnabled(true); + cmdDeckEditor.setContentAreaFilled(false); + cmdDeckEditor.setBorderPainted(false); + cmdDeckEditor.setBorder(null); + cmdDeckEditor.setOpaque(false); + cmdDeckEditor.setIcon(imgEditorUp); + cmdDeckEditor.setBounds(10, 436, 205, 30); + cmdDeckEditor.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + doShowEditor(); } - { - cmdDeckSelect.setBounds(112, 310, 100, 23); - pnlDecks.add(cmdDeckSelect); - cmdDeckSelect.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); - cmdDeckSelect.setBackground(new Color(255, 222, 173)); - - cmdDeckSelect.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - doDeckSelect(); - } - }); + }); + cmdDeckEditor.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdDeckEditor.setIcon(imgEditorOver); } - } - - { - pnlSettings.setVisible(false); - pnlSettings.setOpaque(false); - pnlSettings.setBounds(245, 135, 325, 345); - pnlSettings.setLayout(null); - gHS.getContentPane().add(pnlSettings); - - { - scrSettings.setPreferredSize(new Dimension(1, 3)); - scrSettings.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrSettings.setBackground(clrScrollBackground); - scrSettings.setOpaque(false); - scrSettings.setBounds(10, 12, 305, 320); - pnlSettings.add(scrSettings); - } - { - pnlSettingsA.setBackground(clrScrollBackground); - pnlSettingsA.setLayout(new GridLayout(15, 1, 0, 0)); - - scrSettings.setViewportView(pnlSettingsA); - } - { - JLabel lblBasic = new JLabel("Basic Settings"); - lblBasic.setHorizontalAlignment(SwingConstants.CENTER); - pnlSettingsA.add(lblBasic); - } - { - chkDeveloperMode.setOpaque(false); - chkDeveloperMode.setBackground(clrScrollBackground); - chkDeveloperMode.setSelected(Singletons.getModel().getPreferences().developerMode); - - chkDeveloperMode.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().developerMode = chkDeveloperMode.isSelected(); - } - }); - - pnlSettingsA.add(chkDeveloperMode); - } - { - chkStackAiLand.setOpaque(false); - chkStackAiLand.setBackground(clrScrollBackground); - chkStackAiLand.setSelected(Singletons.getModel().getPreferences().stackAiLand); - - chkStackAiLand.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().stackAiLand = chkStackAiLand.isSelected(); - } - }); - - pnlSettingsA.add(chkStackAiLand); - } - { - chkUploadDraftData.setBackground(clrScrollBackground); - chkUploadDraftData.setOpaque(false); - chkUploadDraftData.setSelected(Singletons.getModel().getPreferences().uploadDraftAI); - - chkUploadDraftData.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().uploadDraftAI = chkUploadDraftData.isSelected(); - } - }); - - pnlSettingsA.add(chkUploadDraftData); - } - { - JLabel lblGraphs = new JLabel("Graphical Settings"); - - lblGraphs.setHorizontalAlignment(SwingConstants.CENTER); - pnlSettingsA.add(lblGraphs); - } - { - chkMana.setOpaque(false); - chkMana.setBackground(clrScrollBackground); - chkMana.setSelected(Singletons.getModel().getPreferences().cardOverlay); - - chkMana.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().cardOverlay = chkMana.isSelected(); - } - }); - - pnlSettingsA.add(chkMana); - } - { - chkFoil.setOpaque(false); - chkFoil.setBackground(clrScrollBackground); - chkFoil.setSelected(Singletons.getModel().getPreferences().randCFoil); - - chkFoil.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().randCFoil = chkFoil.isSelected(); - } - }); - - pnlSettingsA.add(chkFoil); - } - { - //cmdLAF.setBorderPainted(false); - //cmdLAF.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); - cmdLAF.setOpaque(false); - cmdLAF.setBackground(clrScrollBackground); - - cmdLAF.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - doLAF(); - } - }); - - - pnlSettingsA.add(cmdLAF); - } - { - chkLAF.setOpaque(false); - chkLAF.setBackground(clrScrollBackground); - chkLAF.setSelected(Singletons.getModel().getPreferences().lafFonts); - - chkLAF.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().lafFonts = chkLAF.isSelected(); - } - }); - - pnlSettingsA.add(chkLAF); - } - { - cmdSize.setOpaque(false); - cmdSize.setBackground(clrScrollBackground); - - cmdSize.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - doCardSize(); - } - }); - - pnlSettingsA.add(cmdSize); - } - { - chkScale.setOpaque(false); - chkScale.setBackground(clrScrollBackground); - chkScale.setSelected(Singletons.getModel().getPreferences().scaleLargerThanOriginal); - - chkScale.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().scaleLargerThanOriginal = chkScale.isSelected(); - } - }); - - pnlSettingsA.add(chkScale); - } - { - cmdStack.setOpaque(false); - cmdStack.setBackground(clrScrollBackground); - - cmdStack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - doStackOffset(); - } - }); - - pnlSettingsA.add(cmdStack); - } - { - JLabel lblGraphs = new JLabel("Deck Generation Settings"); - - lblGraphs.setHorizontalAlignment(SwingConstants.CENTER); - pnlSettingsA.add(lblGraphs); - } - { - chkRemoveArtifacts.setOpaque(false); - chkRemoveArtifacts.setBackground(clrScrollBackground); - chkRemoveArtifacts.setSelected(Singletons.getModel().getPreferences().deckGenRmvArtifacts); - - chkRemoveArtifacts.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvArtifacts = chkRemoveArtifacts.isSelected(); - } - }); - - pnlSettingsA.add(chkRemoveArtifacts); - } - { - chkRemoveSmall.setOpaque(false); - chkRemoveSmall.setBackground(clrScrollBackground); - chkRemoveSmall.setSelected(Singletons.getModel().getPreferences().deckGenRmvSmall); - - chkRemoveSmall.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvSmall = chkRemoveSmall.isSelected(); - } - }); - - pnlSettingsA.add(chkRemoveSmall); - } - } - - // Utilities Panel - { - pnlUtilities.setOpaque(false); - pnlUtilities.setVisible(false); - pnlUtilities.setBounds(245, 135, 325, 345); - pnlUtilities.setLayout(new GridLayout(5, 1, 0, 0)); - - gHS.getContentPane().add(pnlUtilities); - - { - cmdDownloadLQSetPics.setOpaque(false); - cmdDownloadLQSetPics.setBackground(clrScrollBackground); - - cmdDownloadLQSetPics.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - new Gui_DownloadSetPictures_LQ(null); - } - }); - - pnlUtilities.add(cmdDownloadLQSetPics); - } - { - cmdDownloadPrices.setOpaque(false); - cmdDownloadPrices.setBackground(clrScrollBackground); - - cmdDownloadPrices.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - Gui_DownloadPrices gdp = new Gui_DownloadPrices(); - gdp.setVisible(true); - } - }); - - pnlUtilities.add(cmdDownloadPrices); - } - { - cmdImportPics.setOpaque(false); - cmdImportPics.setBackground(clrScrollBackground); - - cmdImportPics.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - GUI_ImportPicture ip = new GUI_ImportPicture(null); - ip.setVisible(true); - } - }); - - pnlUtilities.add(cmdImportPics); - } - { - cmdReportBug.setOpaque(false); - cmdReportBug.setBackground(clrScrollBackground); - - cmdReportBug.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - BugzReporter br = new BugzReporter(); - br.setVisible(true); - } - }); - - pnlUtilities.add(cmdReportBug); - } - { - cmdHowToPlay.setOpaque(false); - cmdHowToPlay.setBackground(clrScrollBackground); - - cmdHowToPlay.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - String text = ForgeProps.getLocalized(LANG.HowTo.MESSAGE); - JTextArea area = new JTextArea(text, 25, 40); - area.setWrapStyleWord(true); - area.setLineWrap(true); - area.setEditable(false); - area.setOpaque(false); - - JOptionPane.showMessageDialog(null, new JScrollPane(area), ForgeProps.getLocalized(LANG.HowTo.TITLE), - JOptionPane.INFORMATION_MESSAGE); - } - }); - - pnlUtilities.add(cmdHowToPlay); + public void focusLost(final FocusEvent arg0) { + cmdDeckEditor.setIcon(imgEditorUp); } - } - { - lblBackground.setIcon(imgBackground); - lblBackground.setBounds(0, 0, 600, 600); - - gHS.getContentPane().add(lblBackground); - } - - gHS.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{lblBackground, - cmdConstructed, - cmdSealed, - cmdDraft, - cmdQuest, - cmdHumanDeck, - cmdAIDeck, - cmdDeckEditor, - cmdSettings, - cmdStart, - lstDecks, - cmdDeckSelect})); - - - - - - + }); + gHS.getContentPane().add(cmdDeckEditor); + cmdStart.setPressedIcon(imgStartDown); + cmdStart.setRolloverIcon(imgStartOver); + cmdStart.setRolloverEnabled(true); + cmdStart.setIcon(imgStartUp); + cmdStart.setOpaque(false); + cmdStart.setContentAreaFilled(false); + cmdStart.setBorder(null); + cmdStart.setBorderPainted(false); + cmdStart.setBounds(10, 476, 205, 84); + cmdStart.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + doStartGame(); + } + }); + cmdStart.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdStart.setIcon(imgStartDown); + } + + public void focusLost(final FocusEvent arg0) { + cmdStart.setIcon(imgStartUp); + } + }); + gHS.getContentPane().add(cmdStart); + cmdSettings.setPressedIcon(imgSettingsDown); + cmdSettings.setRolloverIcon(imgSettingsOver); + cmdSettings.setRolloverEnabled(true); + cmdSettings.setIcon(imgSettingsUp); + cmdSettings.setOpaque(false); + cmdSettings.setContentAreaFilled(false); + cmdSettings.setBorder(null); + cmdSettings.setBorderPainted(false); + cmdSettings.setBounds(212, 10, 205, 50); + cmdSettings.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdSettings.setIcon(imgSettingsOver); + } + + public void focusLost(final FocusEvent arg0) { + cmdSettings.setIcon(imgSettingsUp); + } + }); + cmdSettings.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + pnlIntro.setVisible(false); + pnlDecks.setVisible(false); + pnlUtilities.setVisible(false); + + pnlSettings.setVisible(true); + } + }); + gHS.getContentPane().add(cmdSettings); + cmdUtilities.setIcon(imgUtilitiesUp); + cmdUtilities.setRolloverEnabled(true); + cmdUtilities.setRolloverIcon(imgUtilitiesOver); + cmdUtilities.setPressedIcon(imgUtilitiesDown); + cmdUtilities.setOpaque(false); + cmdUtilities.setContentAreaFilled(false); + cmdUtilities.setBorder(null); + cmdUtilities.setBorderPainted(false); + cmdUtilities.setBounds(395, 10, 205, 50); + cmdUtilities.addFocusListener(new FocusListener() { + public void focusGained(final FocusEvent arg0) { + cmdUtilities.setIcon(imgUtilitiesOver); + } + + public void focusLost(final FocusEvent arg0) { + cmdUtilities.setIcon(imgUtilitiesUp); + } + }); + cmdUtilities.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + pnlIntro.setVisible(false); + pnlDecks.setVisible(false); + pnlSettings.setVisible(false); + + pnlUtilities.setVisible(true); + } + }); + gHS.getContentPane().add(cmdUtilities); + pnlIntro.setVisible(true); + pnlIntro.setOpaque(false); + pnlIntro.setBounds(245, 135, 325, 345); + gHS.getContentPane().add(pnlIntro); + pnlIntro.setLayout(null); + lblIntro.setBounds(10, 10, 305, 300); + lblIntro.setFont(new Font("", Font.BOLD, 12)); + lblIntro.setHorizontalAlignment(SwingConstants.LEFT); + lblIntro.setOpaque(false); + lblIntro.setFocusable(false); + lblIntro.setText("Forge is an open source implementation of Magic: the Gathering written in the Java programming language.

    " + + "
  • Select a Game Mode on the left
  • Select a Player
  • Choose a deck from the list
  • Click Select Deck
  • Press Start to begin the game
  • "); + pnlIntro.add(lblIntro); + pnlDecks.setVisible(false); + pnlDecks.setOpaque(false); + pnlDecks.setBounds(245, 135, 325, 345); + gHS.getContentPane().add(pnlDecks); + pnlDecks.setLayout(null); + lblDecksHeader.setBounds(10, 10, 305, 34); + pnlDecks.add(lblDecksHeader); + lblDecksHeader.setFont(new Font("", Font.BOLD | Font.ITALIC, 14)); + lblDecksHeader.setHorizontalAlignment(SwingConstants.CENTER); + lblDecksHeader.setOpaque(false); + lblDecksHeader.setFocusable(false); + scrDecks.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrDecks.setOpaque(false); + scrDecks.setBackground(clrScrollBackground); + scrDecks.setBounds(10, 45, 305, 260); + pnlDecks.add(scrDecks); + lstDecks.setVisible(true); + scrDecks.setViewportView(lstDecks); + lstDecks.setBackground(clrScrollBackground); + lstDecks.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + cmdDeckSelect.setBounds(112, 310, 100, 23); + pnlDecks.add(cmdDeckSelect); + cmdDeckSelect.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); + cmdDeckSelect.setBackground(new Color(255, 222, 173)); + cmdDeckSelect.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doDeckSelect(); + } + }); + pnlSettings.setVisible(false); + pnlSettings.setOpaque(false); + pnlSettings.setBounds(245, 135, 325, 345); + pnlSettings.setLayout(null); + gHS.getContentPane().add(pnlSettings); + scrSettings.setPreferredSize(new Dimension(1, 3)); + scrSettings.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrSettings.setBackground(clrScrollBackground); + scrSettings.setOpaque(false); + scrSettings.setBounds(10, 12, 305, 320); + pnlSettings.add(scrSettings); + pnlSettingsA.setBackground(clrScrollBackground); + pnlSettingsA.setLayout(new GridLayout(15, 1, 0, 0)); + scrSettings.setViewportView(pnlSettingsA); + JLabel lblBasic = new JLabel("Basic Settings"); + lblBasic.setHorizontalAlignment(SwingConstants.CENTER); + pnlSettingsA.add(lblBasic); + chkDeveloperMode.setOpaque(false); + chkDeveloperMode.setBackground(clrScrollBackground); + chkDeveloperMode.setSelected(Singletons.getModel().getPreferences().developerMode); + chkDeveloperMode.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().developerMode = chkDeveloperMode.isSelected(); + } + }); + pnlSettingsA.add(chkDeveloperMode); + chkStackAiLand.setOpaque(false); + chkStackAiLand.setBackground(clrScrollBackground); + chkStackAiLand.setSelected(Singletons.getModel().getPreferences().stackAiLand); + chkStackAiLand.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().stackAiLand = chkStackAiLand.isSelected(); + } + }); + pnlSettingsA.add(chkStackAiLand); + chkUploadDraftData.setBackground(clrScrollBackground); + chkUploadDraftData.setOpaque(false); + chkUploadDraftData.setSelected(Singletons.getModel().getPreferences().uploadDraftAI); + chkUploadDraftData.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().uploadDraftAI = chkUploadDraftData.isSelected(); + } + }); + pnlSettingsA.add(chkUploadDraftData); + JLabel lblGraphs = new JLabel("Graphical Settings"); + lblGraphs.setHorizontalAlignment(SwingConstants.CENTER); + pnlSettingsA.add(lblGraphs); + chkMana.setOpaque(false); + chkMana.setBackground(clrScrollBackground); + chkMana.setSelected(Singletons.getModel().getPreferences().cardOverlay); + chkMana.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().cardOverlay = chkMana.isSelected(); + } + }); + pnlSettingsA.add(chkMana); + chkFoil.setOpaque(false); + chkFoil.setBackground(clrScrollBackground); + chkFoil.setSelected(Singletons.getModel().getPreferences().randCFoil); + chkFoil.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().randCFoil = chkFoil.isSelected(); + } + }); + pnlSettingsA.add(chkFoil); + // cmdLAF.setBorderPainted(false); + // cmdLAF.setBorder(new BevelBorder(BevelBorder.RAISED, null, + // null, null, null)); + cmdLAF.setOpaque(false); + cmdLAF.setBackground(clrScrollBackground); + cmdLAF.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + doLAF(); + } + }); + pnlSettingsA.add(cmdLAF); + chkLAF.setOpaque(false); + chkLAF.setBackground(clrScrollBackground); + chkLAF.setSelected(Singletons.getModel().getPreferences().lafFonts); + chkLAF.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().lafFonts = chkLAF.isSelected(); + } + }); + pnlSettingsA.add(chkLAF); + cmdSize.setOpaque(false); + cmdSize.setBackground(clrScrollBackground); + cmdSize.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + doCardSize(); + } + }); + pnlSettingsA.add(cmdSize); + chkScale.setOpaque(false); + chkScale.setBackground(clrScrollBackground); + chkScale.setSelected(Singletons.getModel().getPreferences().scaleLargerThanOriginal); + chkScale.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().scaleLargerThanOriginal = chkScale.isSelected(); + } + }); + pnlSettingsA.add(chkScale); + cmdStack.setOpaque(false); + cmdStack.setBackground(clrScrollBackground); + cmdStack.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + doStackOffset(); + } + }); + pnlSettingsA.add(cmdStack); + JLabel lblGenGraphs = new JLabel("Deck Generation Settings"); + lblGenGraphs.setHorizontalAlignment(SwingConstants.CENTER); + pnlSettingsA.add(lblGenGraphs); + chkRemoveArtifacts.setOpaque(false); + chkRemoveArtifacts.setBackground(clrScrollBackground); + chkRemoveArtifacts.setSelected(Singletons.getModel().getPreferences().deckGenRmvArtifacts); + chkRemoveArtifacts.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().deckGenRmvArtifacts = chkRemoveArtifacts.isSelected(); + } + }); + pnlSettingsA.add(chkRemoveArtifacts); + chkRemoveSmall.setOpaque(false); + chkRemoveSmall.setBackground(clrScrollBackground); + chkRemoveSmall.setSelected(Singletons.getModel().getPreferences().deckGenRmvSmall); + chkRemoveSmall.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().deckGenRmvSmall = chkRemoveSmall.isSelected(); + } + }); + pnlSettingsA.add(chkRemoveSmall); + pnlUtilities.setOpaque(false); + pnlUtilities.setVisible(false); + pnlUtilities.setBounds(245, 135, 325, 345); + pnlUtilities.setLayout(new GridLayout(5, 1, 0, 0)); + gHS.getContentPane().add(pnlUtilities); + cmdDownloadLQSetPics.setOpaque(false); + cmdDownloadLQSetPics.setBackground(clrScrollBackground); + cmdDownloadLQSetPics.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + new Gui_DownloadSetPictures_LQ(null); + } + }); + pnlUtilities.add(cmdDownloadLQSetPics); + cmdDownloadPrices.setOpaque(false); + cmdDownloadPrices.setBackground(clrScrollBackground); + cmdDownloadPrices.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Gui_DownloadPrices gdp = new Gui_DownloadPrices(); + gdp.setVisible(true); + } + }); + pnlUtilities.add(cmdDownloadPrices); + cmdImportPics.setOpaque(false); + cmdImportPics.setBackground(clrScrollBackground); + cmdImportPics.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + GUI_ImportPicture ip = new GUI_ImportPicture(null); + ip.setVisible(true); + } + }); + pnlUtilities.add(cmdImportPics); + cmdReportBug.setOpaque(false); + cmdReportBug.setBackground(clrScrollBackground); + cmdReportBug.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + BugzReporter br = new BugzReporter(); + br.setVisible(true); + } + }); + pnlUtilities.add(cmdReportBug); + cmdHowToPlay.setOpaque(false); + cmdHowToPlay.setBackground(clrScrollBackground); + cmdHowToPlay.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + String text = ForgeProps.getLocalized(LANG.HowTo.MESSAGE); + + JTextArea area = new JTextArea(text, 25, 40); + area.setWrapStyleWord(true); + area.setLineWrap(true); + area.setEditable(false); + area.setOpaque(false); + + JOptionPane.showMessageDialog(null, new JScrollPane(area), + ForgeProps.getLocalized(LANG.HowTo.TITLE), JOptionPane.INFORMATION_MESSAGE); + } + }); + pnlUtilities.add(cmdHowToPlay); + lblBackground.setIcon(imgBackground); + lblBackground.setBounds(0, 0, 600, 600); + gHS.getContentPane().add(lblBackground); + gHS.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[] {lblBackground, cmdConstructed, + cmdSealed, cmdDraft, cmdQuest, cmdHumanDeck, cmdAIDeck, cmdDeckEditor, cmdSettings, cmdStart, lstDecks, + cmdDeckSelect})); + // non gui init stuff - allDecks = new ArrayList(deckManager.getDecks()); + allDecks = new ArrayList(deckManager.getDecks()); } - + private void doGameModeSelect() { - // simulate a radio button group, because JRadioButton wasn't transparent on Roll-over + // simulate a radio button group, because JRadioButton wasn't + // transparent on Roll-over cmdConstructed.setSelected(GameTypeSelected.equals(GameType.Constructed)); cmdSealed.setSelected(GameTypeSelected.equals(GameType.Sealed)); cmdDraft.setSelected(GameTypeSelected.equals(GameType.Draft)); cmdQuest.setSelected(GameTypeSelected.equals(GameType.Quest)); } - + private void doDeckSelect() { if (lstDecks.getSelectedIndex() != -1) { if (PlayerSelected.equals("Human")) { HumanDeckSelected = lstDecks.getSelectedValue().toString(); cmdHumanDeck.setSelected(true); cmdHumanDeck.setToolTipText(HumanDeckSelected); - } - else if (PlayerSelected.equals("AI")) { + } else if (PlayerSelected.equals("AI")) { AIDeckSelected = lstDecks.getSelectedValue().toString(); cmdAIDeck.setSelected(true); cmdAIDeck.setToolTipText(AIDeckSelected); } - + } } - + private boolean doDeckLogic() { if (GameTypeSelected.equals(GameType.Constructed)) { if (HumanDeckSelected.equals("Generate Deck")) { DeckGeneration.genDecks(PlayerType.HUMAN); - + } else if (HumanDeckSelected.equals("Random Deck")) { Deck rDeck = chooseRandomDeck(); - + if (rDeck != null) { String msg = String.format("You are using deck: %s.", Constant.Runtime.HumanDeck[0].getName()); JOptionPane.showMessageDialog(null, msg, "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); - + Constant.Runtime.HumanDeck[0] = rDeck; } else { - JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name", + JOptionPane.INFORMATION_MESSAGE); return false; } - + } else { Constant.Runtime.HumanDeck[0] = deckManager.getDeck(HumanDeckSelected); } - + if (AIDeckSelected.equals("Generate Deck")) { DeckGeneration.genDecks(PlayerType.COMPUTER); - + } else if (AIDeckSelected.equals("Random Deck")) { Deck rDeck = chooseRandomDeck(); - + if (rDeck != null) { - String msg = String.format("The computer is using deck: %s.", Constant.Runtime.ComputerDeck[0].getName()); + String msg = String.format("The computer is using deck: %s.", + Constant.Runtime.ComputerDeck[0].getName()); JOptionPane.showMessageDialog(null, msg, "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); - + Constant.Runtime.ComputerDeck[0] = rDeck; } else { - JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name", + JOptionPane.INFORMATION_MESSAGE); return false; } - + } else { Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(AIDeckSelected); } - + } else if (GameTypeSelected.equals(GameType.Sealed)) { if (HumanDeckSelected.equals("New Sealed")) { - //NG2.dispose(); - + // NG2.dispose(); + launchSealed(); - + return false; - + } else { if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) { Constant.Runtime.HumanDeck[0] = deckManager.getDeck(HumanDeckSelected); @@ -1043,19 +852,19 @@ public class Gui_HomeScreen { } } else if (GameTypeSelected.equals(GameType.Draft)) { if (HumanDeckSelected.equals("NewDraft")) { - //NG2.dispose(); - + // NG2.dispose(); + launchDraft(); - + return false; } else { if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) { Constant.Runtime.HumanDeck[0] = deckManager.getDraftDeck(HumanDeckSelected)[0]; - - String aiDeck[] = AIDeckSelected.split(" - "); + + String[] aiDeck = AIDeckSelected.split(" - "); int AIDeckNum = Integer.parseInt(aiDeck[1]); String AIDeckName = aiDeck[0]; - + Constant.Runtime.ComputerDeck[0] = deckManager.getDraftDeck(AIDeckName)[AIDeckNum]; } } @@ -1063,7 +872,7 @@ public class Gui_HomeScreen { return true; } - + private void launchDraft() { DeckEditorDraft draft = new DeckEditorDraft(); @@ -1089,9 +898,9 @@ public class Gui_HomeScreen { } } - + private void launchSealed() { - String sealedTypes[] = {"Full Cardpool", "Block / Set", "Custom"}; + String[] sealedTypes = {"Full Cardpool", "Block / Set", "Custom"}; String prompt = "Choose Sealed Deck Format:"; Object o = GuiUtils.getChoice(prompt, sealedTypes); @@ -1111,15 +920,15 @@ public class Gui_HomeScreen { } else { - throw new IllegalStateException( - "choice <<" + safeToString(o) + ">> does not equal any of the sealedTypes."); + throw new IllegalStateException("choice <<" + safeToString(o) + + ">> does not equal any of the sealedTypes."); } ItemPool sDeck = sd.getCardpool(); if (sDeck.countAll() > 1) { Deck deck = new Deck(GameType.Sealed); - + deck.addSideboard(sDeck); for (int i = 0; i < Constant.Color.BasicLands.length; i++) { @@ -1138,26 +947,30 @@ public class Gui_HomeScreen { Constant.Runtime.HumanDeck[0] = deck; AIDeckSelected = "AI_" + sDeckName; - //Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList()); - Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI will use different cardpool - + // Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList()); + Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI + // will + // use + // different + // cardpool + aiDeck.setName("AI_" + sDeckName); aiDeck.setPlayerType(PlayerType.COMPUTER); deckManager.addDeck(aiDeck); DeckManager.writeDeck(aiDeck, DeckManager.makeFileName(aiDeck)); Constant.Runtime.ComputerDeck[0] = aiDeck; - + showDecks(); - //cmdDeckEditor.doClick(); - //editor.customMenu.setCurrentGameType(Constant.GameType.Sealed); - //editor.customMenu.showSealedDeck(deck); + // cmdDeckEditor.doClick(); + // editor.customMenu.setCurrentGameType(Constant.GameType.Sealed); + // editor.customMenu.showSealedDeck(deck); } } - - private Deck chooseGeneratedDeck(String p) { + + private Deck chooseGeneratedDeck(final String p) { Deck ret = null; - + ArrayList decks = new ArrayList(); decks.add("5-Color Deck (original)"); decks.add("Semi-Random Theme Deck"); @@ -1179,9 +992,10 @@ public class Gui_HomeScreen { CardList FiveClrDeck = gen.generate5ColorDeck(); ret = new Deck(GameType.Constructed); - for (int i = 0; i < 60; i++) + for (int i = 0; i < 60; i++) { ret.addMain(FiveClrDeck.get(i).getName()); - + } + } else if (o.toString().equals(decks.get(1))) { GenerateThemeDeck gen = new GenerateThemeDeck(); ArrayList tNames = gen.getThemeNames(); @@ -1199,14 +1013,16 @@ public class Gui_HomeScreen { CardList td = gen.getThemeDeck(stDeck, 60); ret = new Deck(GameType.Constructed); - for (int i = 0; i < td.size(); i++) + for (int i = 0; i < td.size(); i++) { ret.addMain(td.get(i).getName()); + } } else if (o.toString().equals(decks.get(2))) { ArrayList colors = new ArrayList(); colors.add("Random"); - for (String c : Constant.Color.onlyColors) + for (String c : Constant.Color.onlyColors) { colors.add(c); + } String c1; String c2; @@ -1245,16 +1061,17 @@ public class Gui_HomeScreen { } else if (o.toString().equals(decks.get(3))) { ArrayList colors = new ArrayList(); colors.add("Random"); - for (String c : Constant.Color.onlyColors) + for (String c : Constant.Color.onlyColors) { colors.add(c); - + } + String c1; String c2; String c3; PlayerType pt = null; if (p.equals("H")) { pt = PlayerType.HUMAN; - + c1 = GuiUtils.getChoice("Select first color.", colors.toArray()).toString(); if (c1.equals("Random")) { @@ -1279,7 +1096,7 @@ public class Gui_HomeScreen { } else { // if (p.equals("C")) pt = PlayerType.COMPUTER; - + c1 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); colors.remove(c1); c2 = colors.get(MyRandom.random.nextInt(colors.size() - 1) + 1); @@ -1299,120 +1116,128 @@ public class Gui_HomeScreen { return ret; } - + private Deck chooseRandomDeck() { Deck ret = null; - + ArrayList subDecks = new ArrayList(); for (Deck d : allDecks) { - if (d.getDeckType().equals(GameType.Constructed) && !d.isCustomPool()) + if (d.getDeckType().equals(GameType.Constructed) && !d.isCustomPool()) { subDecks.add(d); + } } - + if (subDecks.size() > 0) { int n = MyRandom.random.nextInt(subDecks.size()); ret = subDecks.get(n); - + + } else { + JOptionPane.showMessageDialog(null, "Not enough decks to choose from.", "Random Deck Name", + JOptionPane.INFORMATION_MESSAGE); } - else - JOptionPane.showMessageDialog(null, "Not enough decks to choose from.", "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); return ret; } - private void showDecks() { deckManager.readAllDecks(); - + lblDecksHeader.setText(""); pnlIntro.setVisible(false); pnlDecks.setVisible(false); pnlSettings.setVisible(false); pnlUtilities.setVisible(false); - + DefaultListModel DeckList = new DefaultListModel(); lstDecks.setModel(DeckList); - + if (GameTypeSelected.equals(GameType.Constructed)) { - if (PlayerSelected.equals("Human")) - lblDecksHeader.setText("Your Constructed Decks"); - else if (PlayerSelected.equals("AI")) + if (PlayerSelected.equals("Human")) { + lblDecksHeader.setText("Your Constructed Decks"); + } else if (PlayerSelected.equals("AI")) { lblDecksHeader.setText("AI Constructed Decks"); - + } + if (!PlayerSelected.equals("")) { DeckList.addElement("Generate Deck"); DeckList.addElement("Random Deck"); - + for (Deck aDeck : allDecks) { - if (aDeck.getDeckType().equals(GameType.Constructed) && !aDeck.isCustomPool()) + if (aDeck.getDeckType().equals(GameType.Constructed) && !aDeck.isCustomPool()) { DeckList.addElement(aDeck.getName()); + } } - + } - + } else if (GameTypeSelected.equals(GameType.Sealed)) { if (PlayerSelected.equals("Human")) { lblDecksHeader.setText("Your Sealed Decks"); - + DeckList.addElement("New Sealed"); - + for (Deck aDeck : allDecks) { - if (aDeck.getDeckType().equals(GameType.Sealed) && aDeck.getPlayerType() == PlayerType.HUMAN) + if (aDeck.getDeckType().equals(GameType.Sealed) && aDeck.getPlayerType() == PlayerType.HUMAN) { DeckList.addElement(aDeck.getName()); + } } - } else if (PlayerSelected.equals("AI")){ + } else if (PlayerSelected.equals("AI")) { lblDecksHeader.setText("AI Sealed Decks"); - + for (Deck aDeck : allDecks) { - if (aDeck.getDeckType().equals(GameType.Sealed) && aDeck.getPlayerType().equals(PlayerType.COMPUTER)) + if (aDeck.getDeckType().equals(GameType.Sealed) + && aDeck.getPlayerType().equals(PlayerType.COMPUTER)) { DeckList.addElement(aDeck.getName()); - } + } + } } - + } else if (GameTypeSelected.equals(GameType.Draft)) { if (PlayerSelected.equals("Human")) { lblDecksHeader.setText("Your Draft Decks"); - + DeckList.addElement("New Draft"); - - for (String sKey : deckManager.getDraftDecks().keySet()) + + for (String sKey : deckManager.getDraftDecks().keySet()) { DeckList.addElement(sKey); - + } + } else if (PlayerSelected.equals("AI")) { lblDecksHeader.setText("AI Draft Decks"); - + for (String sKey : deckManager.getDraftDecks().keySet()) { - for (int i=1; i<=7; i++) + for (int i = 1; i <= 7; i++) { DeckList.addElement(sKey + " - " + i); + } } } - + } else if (cmdQuest.isSelected()) { lblDecksHeader.setText(""); - //lstDecks.setVisible(false); - //cmdDeckSelect.setVisible(false); + // lstDecks.setVisible(false); + // cmdDeckSelect.setVisible(false); } - + if (!PlayerSelected.equals("") && !GameTypeSelected.equals(GameType.Quest)) { lstDecks.setModel(DeckList); - //lstDecks.setVisible(true); - //scrDecks.setVisible(true); + // lstDecks.setVisible(true); + // scrDecks.setVisible(true); pnlDecks.setVisible(true); - //cmdDeckSelect.setVisible(true); + // cmdDeckSelect.setVisible(true); } } - + private void doShowEditor() { if (editor == null) { - + editor = new DeckEditorCommon(GameType.Constructed); Command exit = new Command() { private static final long serialVersionUID = -9133358399503226853L; public void execute() { - String ng[] = {""}; + String[] ng = {""}; Gui_HomeScreen.main(ng); } }; @@ -1427,33 +1252,35 @@ public class Gui_HomeScreen { // this for real, feel free. // This make it so the second time you open the Deck Editor, typing a // card name and pressing enter will filter - //editor.getRootPane().setDefaultButton(editor.filterButton); + // editor.getRootPane().setDefaultButton(editor.filterButton); editor.setVisible(true); gHS.dispose(); } - + private void doStartGame() { if (GameTypeSelected.equals(GameType.Quest)) { new QuestOptions(); } else { - if (HumanDeckSelected.equals("") && AIDeckSelected.equals("")) + if (HumanDeckSelected.equals("") && AIDeckSelected.equals("")) { return; - - if (doDeckLogic() == false) + } + + if (!doDeckLogic()) { return; + } AllZone.setDisplay(new GuiDisplay4()); AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]); AllZone.getDisplay().setVisible(true); } - + Constant.Runtime.gameType = GameTypeSelected; - + gHS.dispose(); } - + private void doLAF() { LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); HashMap LAFMap = new HashMap(); @@ -1466,8 +1293,7 @@ public class Gui_HomeScreen { LAFMap.put("Business", "org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel"); LAFMap.put("Business Black Steel", "org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel"); - LAFMap.put("Business Blue Steel", - "org.pushingpixels.substance.api.skin.SubstanceBusinessBlueSteelLookAndFeel"); + LAFMap.put("Business Blue Steel", "org.pushingpixels.substance.api.skin.SubstanceBusinessBlueSteelLookAndFeel"); LAFMap.put("Challenger Deep", "org.pushingpixels.substance.api.skin.SubstanceChallengerDeepLookAndFeel"); LAFMap.put("Creme", "org.pushingpixels.substance.api.skin.SubstanceCremeLookAndFeel"); LAFMap.put("Creme Coffee", "org.pushingpixels.substance.api.skin.SubstanceCremeCoffeeLookAndFeel"); @@ -1486,8 +1312,7 @@ public class Gui_HomeScreen { LAFMap.put("Nebula", "org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel"); LAFMap.put("Nebula Brick Wall", "org.pushingpixels.substance.api.skin.SubstanceNebulaBrickWallLookAndFeel"); LAFMap.put("Office Blue 2007", "org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel"); - LAFMap.put("Office Silver 2007", - "org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel"); + LAFMap.put("Office Silver 2007", "org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel"); LAFMap.put("Raven", "org.pushingpixels.substance.api.skin.SubstanceRavenLookAndFeel"); LAFMap.put("Raven Graphite", "org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteLookAndFeel"); LAFMap.put("Sahara", "org.pushingpixels.substance.api.skin.SubstanceSaharaLookAndFeel"); @@ -1513,18 +1338,18 @@ public class Gui_HomeScreen { Singletons.getModel().getPreferences().laf = LAFMap.get(name); UIManager.setLookAndFeel(LAFMap.get(name)); - //SwingUtilities.updateComponentTreeUI(NG2); + // SwingUtilities.updateComponentTreeUI(NG2); } catch (Exception ex) { ErrorViewer.showError(ex); } } } - + private void doCardSize() { String[] keys = {"Tiny", "Smaller", "Small", "Medium", "Large(default)", "Huge"}; - int[] widths = {52, 80, 120, 200, 300, 400}; - int[] heights = {50, 59, 88, 98, 130, 168}; - + int[] widths = { 52, 80, 120, 200, 300, 400 }; + int[] heights = { 50, 59, 88, 98, 130, 168 }; + ListChooser ch = new ListChooser("Choose one", "Choose a new max card size", 0, 1, keys); if (ch.show()) { try { @@ -1542,11 +1367,11 @@ public class Gui_HomeScreen { } } } - + private void doStackOffset() { String[] keys = {"Tiny", "Small", "Medium", "Large"}; - int[] offsets = {5, 7, 10, 15}; - + int[] offsets = { 5, 7, 10, 15 }; + ListChooser ch = new ListChooser("Choose one", "Choose a stack offset value", 0, 1, keys); if (ch.show()) { try { diff --git a/src/main/java/forge/view/swing/Main.java b/src/main/java/forge/view/swing/Main.java index c26a92ae19d..1b3c473b582 100644 --- a/src/main/java/forge/view/swing/Main.java +++ b/src/main/java/forge/view/swing/Main.java @@ -21,7 +21,7 @@ public final class Main { /** * main method for Forge's swing application view. - * + * * @param args * an array of {@link java.lang.String} objects. */ @@ -30,24 +30,25 @@ public final class Main { try { final FModel model = new FModel(null); Singletons.setModel(model); - + FSkin skin = new FSkin(model.preferences.skin); final FView view = new ApplicationView(skin); Singletons.setView(view); - // Need this soon after card factory is loaded - OldGuiNewGame.loadDynamicGamedata(); - - // TODO: this code should go elsewhere, like wherever we start a new game. - // It is only here to maintain semantic equality with the current code base. - + OldGuiNewGame.loadDynamicGamedata(); + + // TODO this code should go elsewhere, like wherever we start a new + // game. + // It is only here to maintain semantic equality with the current + // code base. + model.resetGameState(); view.setModel(model); - } - catch (Throwable exn) { // NOPMD by Braids on 8/7/11 1:07 PM: must catch all throwables here. + } catch (Throwable exn) { // NOPMD by Braids on 8/7/11 1:07 PM: must + // catch all throwables here. ErrorViewer.showError(exn); } } diff --git a/src/main/java/forge/view/swing/OldGuiNewGame.java b/src/main/java/forge/view/swing/OldGuiNewGame.java index c33f533d5f7..a7d96de9b18 100644 --- a/src/main/java/forge/view/swing/OldGuiNewGame.java +++ b/src/main/java/forge/view/swing/OldGuiNewGame.java @@ -1,7 +1,65 @@ package forge.view.swing; +import static net.slightlymagic.braids.util.UtilFunctions.safeToString; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.border.TitledBorder; + +import net.miginfocom.swing.MigLayout; + import com.esotericsoftware.minlog.Log; -import forge.*; + +import forge.AllZone; +import forge.Command; +import forge.Constant; +import forge.Constant_StringArrayList; +import forge.FileUtil; +import forge.GUI_ImportPicture; +import forge.GuiDisplay4; +import forge.GuiDownloadQuestImages; +import forge.Gui_DownloadPictures_LQ; +import forge.Gui_DownloadPrices; +import forge.Gui_DownloadSetPictures_LQ; +import forge.ImageCache; +import forge.MyRandom; +import forge.PlayerType; +import forge.Singletons; import forge.deck.Deck; import forge.deck.DeckGeneration; import forge.deck.DeckManager; @@ -13,8 +71,8 @@ import forge.game.limited.CardPoolLimitation; import forge.game.limited.SealedDeck; import forge.gui.GuiUtils; import forge.gui.ListChooser; -import forge.gui.deckeditor.DeckEditorDraft; import forge.gui.deckeditor.DeckEditorCommon; +import forge.gui.deckeditor.DeckEditorDraft; import forge.item.CardPrinted; import forge.item.ItemPool; import forge.properties.ForgePreferences; @@ -25,21 +83,6 @@ import forge.properties.NewConstants; import forge.properties.NewConstants.LANG.OldGuiNewGame.MENU_BAR.MENU; import forge.properties.NewConstants.LANG.OldGuiNewGame.MENU_BAR.OPTIONS; import forge.quest.gui.QuestOptions; -import net.miginfocom.swing.MigLayout; - -import javax.swing.*; -import javax.swing.UIManager.LookAndFeelInfo; -import javax.swing.border.TitledBorder; -import java.awt.Color; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.*; -import java.util.List; - -import static net.slightlymagic.braids.util.UtilFunctions.safeToString; /*CHOPPIC*/ @@ -47,7 +90,7 @@ import static net.slightlymagic.braids.util.UtilFunctions.safeToString; *

    * OldGuiNewGame class. *

    - * + * * @author Forge * @version $Id$ */ @@ -82,14 +125,17 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. // @SuppressWarnings("unused") // titledBorder2 - /** Constant newGuiCheckBox */ + /** Constant newGuiCheckBox. */ // private static JCheckBox newGuiCheckBox = new JCheckBox("", true); /** Constant smoothLandCheckBox. */ static JCheckBox smoothLandCheckBox = new JCheckBox("", false); /** Constant devModeCheckBox. */ static JCheckBox devModeCheckBox = new JCheckBox("", true); + /** The upld drft check box. */ static JCheckBox upldDrftCheckBox = new JCheckBox("", true); + + /** The foil random check box. */ static JCheckBox foilRandomCheckBox = new JCheckBox("", true); // GenerateConstructedDeck.get2Colors() and GenerateSealedDeck.get2Colors() @@ -97,7 +143,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. /** Constant removeSmallCreatures. */ public static JCheckBoxMenuItem removeSmallCreatures = new JCheckBoxMenuItem( ForgeProps.getLocalized(MENU_BAR.OPTIONS.GENERATE.REMOVE_SMALL)); - + /** Constant removeArtifacts. */ public static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem( ForgeProps.getLocalized(MENU_BAR.OPTIONS.GENERATE.REMOVE_ARTIFACTS)); @@ -179,7 +225,6 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. setupMenu(); setVisible(true); - Log.WARN(); // set logging level to warn SwingUtilities.updateComponentTreeUI(this); } @@ -198,15 +243,14 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. // LOOK_AND_FEEL_ACTION, DNLD_PRICES_ACTION, DOWNLOAD_ACTION, // DOWNLOAD_ACTION_LQ, DOWNLOAD_ACTION_SETLQ, IMPORT_PICTURE, // CARD_SIZES_ACTION, - LOOK_AND_FEEL_ACTION, DNLD_PRICES_ACTION, DOWNLOAD_ACTION_LQ, DOWNLOAD_ACTION_SETLQ, DOWNLOAD_ACTION_QUEST, - IMPORT_PICTURE, CARD_SIZES_ACTION, CARD_STACK_ACTION, CARD_STACK_OFFSET_ACTION, BUGZ_REPORTER_ACTION, - ErrorViewer.ALL_THREADS_ACTION, ABOUT_ACTION, EXIT_ACTION }; + LOOK_AND_FEEL_ACTION, DNLD_PRICES_ACTION, DOWNLOAD_ACTION_LQ, DOWNLOAD_ACTION_SETLQ, + DOWNLOAD_ACTION_QUEST, IMPORT_PICTURE, CARD_SIZES_ACTION, CARD_STACK_ACTION, CARD_STACK_OFFSET_ACTION, + BUGZ_REPORTER_ACTION, ErrorViewer.ALL_THREADS_ACTION, ABOUT_ACTION, EXIT_ACTION }; JMenu menu = new JMenu(ForgeProps.getLocalized(MENU.TITLE)); for (Action a : actions) { menu.add(a); if (a.equals(LOOK_AND_FEEL_ACTION) || a.equals(IMPORT_PICTURE) || a.equals(CARD_STACK_OFFSET_ACTION) - || a.equals(ErrorViewer.ALL_THREADS_ACTION)) - { + || a.equals(ErrorViewer.ALL_THREADS_ACTION)) { menu.addSeparator(); } } @@ -215,21 +259,21 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. // new stuff JMenu generatedDeck = new JMenu(ForgeProps.getLocalized(MENU_BAR.OPTIONS.GENERATE.TITLE)); - + generatedDeck.add(removeSmallCreatures); - removeSmallCreatures.addActionListener(new ActionListener () { - public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvSmall = removeSmallCreatures.isSelected(); - } + removeSmallCreatures.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent arg0) { + Singletons.getModel().getPreferences().deckGenRmvSmall = removeSmallCreatures.isSelected(); + } }); - + generatedDeck.add(removeArtifacts); - removeArtifacts.addActionListener(new ActionListener () { + removeArtifacts.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { Singletons.getModel().getPreferences().deckGenRmvArtifacts = removeArtifacts.isSelected(); } - }); - + }); + JMenu optionsMenu = new JMenu(ForgeProps.getLocalized(OPTIONS.TITLE)); optionsMenu.add(generatedDeck); @@ -265,7 +309,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * getDecks. *

    - * + * * @return a {@link java.util.List} object. */ private List getDecks() { @@ -335,8 +379,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } else { - throw new IllegalStateException( - "choice <<" + safeToString(o) + ">> does not equal any of the sealedTypes."); + throw new IllegalStateException("choice <<" + safeToString(o) + + ">> does not equal any of the sealedTypes."); } ItemPool sDeck = sd.getCardpool(); @@ -354,15 +398,19 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. String sDeckName = JOptionPane.showInputDialog(null, ForgeProps.getLocalized(NEW_GAME_TEXT.SAVE_SEALED_MSG), ForgeProps.getLocalized(NEW_GAME_TEXT.SAVE_SEALED_TTL), JOptionPane.QUESTION_MESSAGE); - + deck.setName(sDeckName); deck.setPlayerType(PlayerType.HUMAN); Constant.Runtime.HumanDeck[0] = deck; Constant.Runtime.gameType = GameType.Sealed; - //Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList()); - Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI will use different cardpool + // Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList()); + Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI + // will + // use + // different + // cardpool aiDeck.setName("AI_" + sDeckName); aiDeck.setPlayerType(PlayerType.COMPUTER); deckManager.addDeck(aiDeck); @@ -370,7 +418,6 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. updateDeckComboBoxes(); deckEditorButtonActionPerformed(GameType.Sealed, deck); - Constant.Runtime.ComputerDeck[0] = aiDeck; } else { @@ -413,7 +460,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * jbInit. *

    - * + * * @throws java.lang.Exception * if any. */ @@ -575,8 +622,9 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. ImageIcon bkgd = new ImageIcon("res/images/ui/newgame_background.jpg"); JLabel myLabel = new JLabel(bkgd); - // Do not pass Integer.MIN_VALUE directly here; it must be packaged in an Integer - // instance. Otherwise, GUI components will not draw unless moused over. + // Do not pass Integer.MIN_VALUE directly here; it must be packaged in + // an Integer + // instance. Otherwise, GUI components will not draw unless moused over. getLayeredPane().add(myLabel, Integer.valueOf(Integer.MIN_VALUE)); myLabel.setBounds(0, 0, bkgd.getIconWidth(), bkgd.getIconHeight()); @@ -590,7 +638,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * updatePanelDisplay. *

    - * + * * @param panel * a {@link javax.swing.JPanel} object. */ @@ -611,7 +659,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * setCustomBorder. *

    - * + * * @param panel * a {@link javax.swing.JPanel} object. * @param title @@ -631,9 +679,11 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * deckEditorButton_actionPerformed. *

    - * - * @param e - * a {@link java.awt.event.ActionEvent} object. + * + * @param gt + * the gt + * @param deck + * the deck */ final void deckEditorButtonActionPerformed(final GameType gt, final Deck deck) { @@ -643,18 +693,18 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. private static final long serialVersionUID = -9133358399503226853L; public void execute() { - + updateDeckComboBoxes(); OldGuiNewGame.this.setVisible(true); } }; - + editor.show(exit); - + if (deck != null) { editor.customMenu.showDeck(deck, gt); } - + this.setVisible(false); editor.setVisible(true); } @@ -663,7 +713,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * getRandomDeck. *

    - * + * * @param d * an array of {@link forge.deck.Deck} objects. * @return a {@link forge.deck.Deck} object. @@ -680,7 +730,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * startButton_actionPerformed. *

    - * + * * @param e * a {@link java.awt.event.ActionEvent} object. */ @@ -793,12 +843,11 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. dispose(); } // startButton_actionPerformed() - /** *

    * singleRadioButton_actionPerformed. *

    - * + * * @param e * a {@link java.awt.event.ActionEvent} object. */ @@ -811,7 +860,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * sealedRadioButton_actionPerformed. *

    - * + * * @param e * a {@link java.awt.event.ActionEvent} object. */ @@ -831,44 +880,47 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. allDecks = getDecks(); switch (Constant.Runtime.gameType) { - case Sealed: - humanComboBox.addItem("New Sealed"); - computerComboBox.addItem("New Sealed"); + case Sealed: + humanComboBox.addItem("New Sealed"); + computerComboBox.addItem("New Sealed"); - for (Deck allDeck : allDecks) { - if (allDeck.getDeckType().equals(GameType.Sealed)) { - JComboBox boxToAdd = allDeck.getPlayerType() == PlayerType.COMPUTER ? computerComboBox : humanComboBox; - boxToAdd.addItem(allDeck.getName()); - } - } // for - break; - case Constructed: - humanComboBox.addItem("Generate Deck"); - computerComboBox.addItem("Generate Deck"); - - humanComboBox.addItem("Random"); - computerComboBox.addItem("Random"); - - for (Deck allDeck : allDecks) { - if (allDeck.getDeckType().equals(GameType.Constructed)) { - humanComboBox.addItem(allDeck.getName()); - computerComboBox.addItem(allDeck.getName()); - } - } // for - break; - case Draft: - humanComboBox.addItem("New Draft"); - Object[] key = deckManager.getDraftDecks().keySet().toArray(); - Arrays.sort(key); - - for (Object aKey : key) { - humanComboBox.addItem(aKey); + for (Deck allDeck : allDecks) { + if (allDeck.getDeckType().equals(GameType.Sealed)) { + JComboBox boxToAdd = allDeck.getPlayerType() == PlayerType.COMPUTER ? computerComboBox + : humanComboBox; + boxToAdd.addItem(allDeck.getName()); } + } // for + break; + case Constructed: + humanComboBox.addItem("Generate Deck"); + computerComboBox.addItem("Generate Deck"); - for (int i = 0; i < 7; i++) { - computerComboBox.addItem("" + (i + 1)); + humanComboBox.addItem("Random"); + computerComboBox.addItem("Random"); + + for (Deck allDeck : allDecks) { + if (allDeck.getDeckType().equals(GameType.Constructed)) { + humanComboBox.addItem(allDeck.getName()); + computerComboBox.addItem(allDeck.getName()); } - break; + } // for + break; + case Draft: + humanComboBox.addItem("New Draft"); + Object[] key = deckManager.getDraftDecks().keySet().toArray(); + Arrays.sort(key); + + for (Object aKey : key) { + humanComboBox.addItem(aKey); + } + + for (int i = 0; i < 7; i++) { + computerComboBox.addItem("" + (i + 1)); + } + break; + default: + break; } // not sure if the code below is useful or not // this will select the deck that you previously used @@ -882,7 +934,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. *

    * getDecks. *

    - * + * * @param gameType * a {@link java.lang.String} object. * @return an array of {@link forge.deck.Deck} objects. @@ -906,16 +958,21 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. return out; } // getDecks() - + /** + * Draft radio button action performed. + * + * @param e + * the e + */ final void draftRadioButtonActionPerformed(final ActionEvent e) { Constant.Runtime.gameType = GameType.Draft; updateDeckComboBoxes(); } /** - * + * The Class LookAndFeelAction. + * * @author dhudson - * */ public static class LookAndFeelAction extends AbstractAction { @@ -923,8 +980,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. private Component c; /** - * + * Instantiates a new look and feel action. + * * @param component + * the component */ public LookAndFeelAction(final Component component) { super(ForgeProps.getLocalized(MENU_BAR.MENU.LF)); @@ -932,7 +991,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** + * Action performed. + * * @param e + * the e */ public final void actionPerformed(final ActionEvent e) { LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); @@ -974,8 +1036,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. "org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel"); LAFMap.put("Raven", "org.pushingpixels.substance.api.skin.SubstanceRavenLookAndFeel"); LAFMap.put("Raven Graphite", "org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteLookAndFeel"); - //LAFMap.put("Raven Graphite Glass", - //"org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteGlassLookAndFeel"); + // LAFMap.put("Raven Graphite Glass", + // "org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteGlassLookAndFeel"); LAFMap.put("Sahara", "org.pushingpixels.substance.api.skin.SubstanceSaharaLookAndFeel"); LAFMap.put("Twilight", "org.pushingpixels.substance.api.skin.SubstanceTwilightLookAndFeel"); @@ -1007,23 +1069,30 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } } -/** - * - * @author dhudson - * - */ + /** + * The Class DownloadPriceAction. + * + * @author dhudson + */ public static class DownloadPriceAction extends AbstractAction { private static final long serialVersionUID = 929877827872974298L; /** - * + * Instantiates a new download price action. */ public DownloadPriceAction() { super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOADPRICE)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { Gui_DownloadPrices gdp = new Gui_DownloadPrices(); @@ -1032,9 +1101,9 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class BugzReporterAction. + * * @author dhudson - * */ public static class BugzReporterAction extends AbstractAction { @@ -1044,53 +1113,66 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. private static final long serialVersionUID = 6354047838575733085L; /** - * + * Instantiates a new bugz reporter action. */ public BugzReporterAction() { super("Report Bug"); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { BugzReporter br = new BugzReporter(); br.setVisible(true); } - } /* * public static class DownloadAction extends AbstractAction { - * + * * private static final long serialVersionUID = 6564425021778307101L; - * + * * public DownloadAction() { * super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOAD)); } - * + * * public void actionPerformed(ActionEvent e) { - * + * * Gui_DownloadPictures.startDownload(null); } } */ /** - * + * The Class DownloadActionLQ. + * * @author dhudson - * */ public static class DownloadActionLQ extends AbstractAction { private static final long serialVersionUID = -6234380664413874813L; /** - * + * Instantiates a new download action lq. */ public DownloadActionLQ() { super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOADLQ)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { new Gui_DownloadPictures_LQ(null); @@ -1098,70 +1180,91 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class DownloadActionSetLQ. + * * @author dhudson - * */ public static class DownloadActionSetLQ extends AbstractAction { private static final long serialVersionUID = 2947202546752930L; /** - * + * Instantiates a new download action set lq. */ public DownloadActionSetLQ() { super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOADSETLQ)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { new Gui_DownloadSetPictures_LQ(null); } } - - /** - * - * @author slapshot5 - * - */ - public static class DownloadActionQuest extends AbstractAction { - private static final long serialVersionUID = -4439763134551377894L; /** - * - */ - public DownloadActionQuest() { - super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOADQUESTIMG)); - } + * The Class DownloadActionQuest. + * + * @author slapshot5 + */ + public static class DownloadActionQuest extends AbstractAction { + private static final long serialVersionUID = -4439763134551377894L; - /** - * - */ - public final void actionPerformed(final ActionEvent e) { - //GuiDownloadQuestImages.startDownload(null); - new GuiDownloadQuestImages(null); - } - } + /** + * Instantiates a new download action quest. + */ + public DownloadActionQuest() { + super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOADQUESTIMG)); + } + + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ + /** + * @param e ActionEvent + */ + public final void actionPerformed(final ActionEvent e) { + // GuiDownloadQuestImages.startDownload(null); + new GuiDownloadQuestImages(null); + } + } /** - * + * The Class ImportPictureAction. + * * @author dhudson - * */ public static class ImportPictureAction extends AbstractAction { private static final long serialVersionUID = 6893292814498031508L; /** - * + * Instantiates a new import picture action. */ public ImportPictureAction() { super(ForgeProps.getLocalized(MENU_BAR.MENU.IMPORTPICTURE)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { GUI_ImportPicture ip = new GUI_ImportPicture(null); @@ -1170,25 +1273,32 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class CardSizesAction. + * * @author dhudson - * */ public static class CardSizesAction extends AbstractAction { private static final long serialVersionUID = -2900235618450319571L; - private static String[] keys = {"Tiny", "Smaller", "Small", "Medium", "Large", "Huge"}; - private static int[] widths = {52, 80, 120, 200, 300, 400}; + private static String[] keys = { "Tiny", "Smaller", "Small", "Medium", "Large", "Huge" }; + private static int[] widths = { 52, 80, 120, 200, 300, 400 }; /** - * + * Instantiates a new card sizes action. */ public CardSizesAction() { super(ForgeProps.getLocalized(MENU_BAR.MENU.CARD_SIZES)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { ListChooser ch = new ListChooser("Choose one", "Choose a new max card size", 0, 1, keys); @@ -1206,8 +1316,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Sets the. + * * @param index + * the index */ public static void set(final int index) { Singletons.getModel().getPreferences().cardSize = CardSizeType.valueOf(keys[index].toLowerCase()); @@ -1216,8 +1328,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Sets the. + * * @param s + * the s */ public static void set(final CardSizeType s) { Singletons.getModel().getPreferences().cardSize = s; @@ -1234,30 +1348,37 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class CardStackAction. + * * @author dhudson - * */ public static class CardStackAction extends AbstractAction { private static final long serialVersionUID = -3770527681359311455L; private static String[] keys = {"3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}; - private static int[] values = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + private static int[] values = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; /** - * + * Instantiates a new card stack action. */ public CardStackAction() { super(ForgeProps.getLocalized(MENU_BAR.MENU.CARD_STACK)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { - ListChooser ch = new ListChooser("Choose one", "Choose the max size of a stack", 0, 1, - keys); + ListChooser ch + = new ListChooser("Choose one", "Choose the max size of a stack", 0, 1, keys); if (ch.show()) { try { @@ -1274,8 +1395,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Sets the. + * * @param index + * the index */ public static void set(final int index) { Singletons.getModel().getPreferences().maxStackSize = values[index]; @@ -1283,8 +1406,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Sets the val. + * * @param val + * the new val */ public static void setVal(final int val) { Singletons.getModel().getPreferences().maxStackSize = val; @@ -1293,25 +1418,32 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class CardStackOffsetAction. + * * @author dhudson - * */ public static class CardStackOffsetAction extends AbstractAction { private static final long serialVersionUID = 5021304777748833975L; private static String[] keys = {"Tiny", "Small", "Medium", "Large"}; - private static int[] offsets = {5, 7, 10, 15}; + private static int[] offsets = { 5, 7, 10, 15 }; /** - * + * Instantiates a new card stack offset action. */ public CardStackOffsetAction() { super(ForgeProps.getLocalized(MENU_BAR.MENU.CARD_STACK_OFFSET)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { ListChooser ch = new ListChooser("Choose one", "Choose a stack offset value", 0, 1, keys); @@ -1330,8 +1462,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Sets the. + * * @param index + * the index */ public static void set(final int index) { Singletons.getModel().getPreferences().stackOffset = StackOffsetType.valueOf(keys[index].toLowerCase()); @@ -1339,8 +1473,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Sets the. + * * @param s + * the s */ public static void set(final StackOffsetType s) { Singletons.getModel().getPreferences().stackOffset = s; @@ -1356,23 +1492,30 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class HowToPlayAction. + * * @author dhudson - * */ public static class HowToPlayAction extends AbstractAction { private static final long serialVersionUID = 5552000208438248428L; /** - * + * Instantiates a new how to play action. */ public HowToPlayAction() { super(ForgeProps.getLocalized(LANG.HowTo.TITLE)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { String text = ForgeProps.getLocalized(LANG.HowTo.MESSAGE); @@ -1389,23 +1532,30 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * The Class AboutAction. + * * @author dhudson - * */ public static class AboutAction extends AbstractAction { private static final long serialVersionUID = 5492173304463396871L; /** - * + * Instantiates a new about action. */ public AboutAction() { super(ForgeProps.getLocalized(MENU_BAR.MENU.ABOUT)); } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ /** - * + * @param e ActionEvent */ public final void actionPerformed(final ActionEvent e) { JTextArea area = new JTextArea(12, 25); @@ -1430,35 +1580,42 @@ 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; + * The Class ExitAction. + * + * @author slapshot5 + */ + public static class ExitAction extends AbstractAction { + private static final long serialVersionUID = -319036939657136034L; - /** - * - */ - public ExitAction() { - super(ForgeProps.getLocalized(MENU_BAR.MENU.EXIT)); - } + /** + * Instantiates a new exit action. + */ + public ExitAction() { + super(ForgeProps.getLocalized(MENU_BAR.MENU.EXIT)); + } - /** - * - */ - public final void actionPerformed(final ActionEvent e) { - System.exit(0); - } - } + /* + * (non-Javadoc) + * + * @see + * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent + * ) + */ + /** + * @param e ActionEvent + */ + public final void actionPerformed(final ActionEvent e) { + System.exit(0); + } + } /** *

    * exit. *

    - * + * * @return a boolean. */ public final boolean exit() { @@ -1521,7 +1678,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } /** - * + * Load dynamic gamedata. */ public static void loadDynamicGamedata() { if (!Constant.CardTypes.loaded[0]) { @@ -1620,15 +1777,15 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. } Constant.Keywords.loaded[0] = true; /* - if (Constant.Runtime.DevMode[0]) { - System.out.println(Constant.Keywords.NonStackingList[0].list); - }*/ + * if (Constant.Runtime.DevMode[0]) { + * System.out.println(Constant.Keywords.NonStackingList[0].list); } + */ } /* * if (!Constant.Color.loaded[0]) { ArrayList lcListFile = * FileUtil.readFile("res/gamedata/LandColorList"); - * + * * if (lcListFile.size() > 1) { for (int i=0; i 1) * Constant.Color.LandColor[0].map.add(s); } } diff --git a/src/main/java/forge/view/swing/SplashFrame.java b/src/main/java/forge/view/swing/SplashFrame.java index 2f51e745032..4ff101ae3c4 100644 --- a/src/main/java/forge/view/swing/SplashFrame.java +++ b/src/main/java/forge/view/swing/SplashFrame.java @@ -10,15 +10,15 @@ import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; -import javax.swing.JPanel; import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.UIManager; -import forge.gui.skin.FSkin; import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; +import forge.gui.skin.FSkin; /** * Shows the splash frame as the application starts. @@ -26,37 +26,42 @@ import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; @SuppressWarnings("serial") public class SplashFrame extends JFrame { - // Inits: Visual changes can be made here. - private static final int BAR_PADDING_X = 20; - private static final int BAR_PADDING_Y = 20; - private static final int BAR_HEIGHT = 57; - - private static final int DISCLAIMER_HEIGHT = 20; - private static final int DISCLAIMER_TOP = 300; - private static final int DISCLAIMER_FONT_SIZE = 9; - private static final Color DISCLAIMER_COLOR = Color.white; - - //private static final int CLOSEBTN_PADDING_X = 15; - private static final int CLOSEBTN_PADDING_Y = 15; - private static final int CLOSEBTN_SIDELENGTH = 15; - private static final Color CLOSEBTN_COLOR = new Color(215,208,188); - + // Inits: Visual changes can be made here. + private static final int BAR_PADDING_X = 20; + private static final int BAR_PADDING_Y = 20; + private static final int BAR_HEIGHT = 57; + + private static final int DISCLAIMER_HEIGHT = 20; + private static final int DISCLAIMER_TOP = 300; + private static final int DISCLAIMER_FONT_SIZE = 9; + private static final Color DISCLAIMER_COLOR = Color.white; + + // private static final int CLOSEBTN_PADDING_X = 15; + private static final int CLOSEBTN_PADDING_Y = 15; + private static final int CLOSEBTN_SIDELENGTH = 15; + private static final Color CLOSEBTN_COLOR = new Color(215, 208, 188); + private SplashProgressModel monitorModel = null; private SplashProgressComponent monitorView = null; - + private boolean SplashHasBeenClosed = false; /** - *

    Create the frame; this must be called from an event - * dispatch thread.

    - * - * - * Throws {@link IllegalStateException} if not called from an event + *

    + * Create the frame; this must be called from an event * dispatch thread. + *

    + * + * Throws + * {@link IllegalStateException} if not called from an event dispatch + * thread. + * + * @param skin + * the skin */ - public SplashFrame(FSkin skin) { + public SplashFrame(final FSkin skin) { super(); - + if (!SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("SplashFrame() must be called from an event dispatch thread."); } @@ -76,121 +81,132 @@ public class SplashFrame extends JFrame { // Insert JPanel to hold content above background final JPanel contentPane = new JPanel(); setContentPane(contentPane); - contentPane.setLayout(null); + contentPane.setLayout(null); // Add disclaimer - final JLabel lblDisclaimer = new JLabel("
    Forge is not affiliated in any way with Wizards of the Coast.
    Forge is open source software, released under the GNU Public License.
    "); + final JLabel lblDisclaimer = new JLabel( + "
    Forge is not affiliated in any way with Wizards of the Coast.
    Forge is open source software, released under the GNU Public License.
    "); - lblDisclaimer.setBounds(0, DISCLAIMER_TOP, - splashWidthPx, DISCLAIMER_HEIGHT); + lblDisclaimer.setBounds(0, DISCLAIMER_TOP, splashWidthPx, DISCLAIMER_HEIGHT); lblDisclaimer.setFont(new Font("Tahoma", Font.PLAIN, DISCLAIMER_FONT_SIZE)); lblDisclaimer.setHorizontalAlignment(SwingConstants.CENTER); lblDisclaimer.setForeground(DISCLAIMER_COLOR); contentPane.add(lblDisclaimer); - + // Add close button final JButton btnClose = new JButton("X"); - btnClose.setBounds(splashWidthPx- (2 * CLOSEBTN_PADDING_Y), - CLOSEBTN_PADDING_Y,CLOSEBTN_SIDELENGTH,CLOSEBTN_SIDELENGTH); + btnClose.setBounds(splashWidthPx - (2 * CLOSEBTN_PADDING_Y), CLOSEBTN_PADDING_Y, CLOSEBTN_SIDELENGTH, + CLOSEBTN_SIDELENGTH); btnClose.setForeground(CLOSEBTN_COLOR); btnClose.setBorder(BorderFactory.createLineBorder(CLOSEBTN_COLOR)); btnClose.setOpaque(false); - btnClose.setBackground(new Color(0,0,0)); + btnClose.setBackground(new Color(0, 0, 0)); btnClose.setFocusPainted(false); contentPane.add(btnClose); - + // Action handler: button hover effect btnClose.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseEntered(java.awt.event.MouseEvent evt) { + public void mouseEntered(final java.awt.event.MouseEvent evt) { btnClose.setBorder(BorderFactory.createLineBorder(Color.white)); btnClose.setForeground(Color.white); } - - public void mouseExited(java.awt.event.MouseEvent evt) { + + public void mouseExited(final java.awt.event.MouseEvent evt) { btnClose.setBorder(BorderFactory.createLineBorder(CLOSEBTN_COLOR)); btnClose.setForeground(CLOSEBTN_COLOR); } }); - + // Action handler: button close btnClose.addActionListener(new closeAction()); - + // Action handler: esc key close - contentPane.getInputMap().put( - KeyStroke.getKeyStroke( "ESCAPE" ), "escAction" ); + contentPane.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "escAction"); contentPane.getActionMap().put("escAction", new closeAction()); - + // Set UI to color splash bar fill with theme colors - UIManager.put("ProgressBar.foreground", skin.bg1b); // Filled - UIManager.put("ProgressBar.selectionForeground",skin.txt1a);// Filled - + UIManager.put("ProgressBar.foreground", skin.bg1b); // Filled + UIManager.put("ProgressBar.selectionForeground", skin.txt1a); // Filled + // Instantiate model and view and tie together. monitorModel = new SplashProgressModel(); monitorView = new SplashProgressComponent(); - + monitorModel.setCurrentView(monitorView); monitorView.setCurrentModel(monitorModel); - + // Add prog bar + message, bg image monitorView.displayUpdate("Assembling file list..."); - monitorView.setBounds(BAR_PADDING_X, splashHeightPx - BAR_PADDING_Y - BAR_HEIGHT, - splashWidthPx - (2 * BAR_PADDING_X), BAR_HEIGHT); + monitorView.setBounds(BAR_PADDING_X, splashHeightPx - BAR_PADDING_Y - BAR_HEIGHT, splashWidthPx + - (2 * BAR_PADDING_X), BAR_HEIGHT); contentPane.add(monitorView); - + contentPane.setOpaque(false); final JLabel bgLabel = new JLabel(bgIcon); - - // Do not pass Integer.MIN_VALUE directly here; it must be packaged in an Integer - // instance. Otherwise, GUI components will not draw unless moused over. + + // Do not pass Integer.MIN_VALUE directly here; it must be packaged in + // an Integer + // instance. Otherwise, GUI components will not draw unless moused over. getLayeredPane().add(bgLabel, Integer.valueOf(Integer.MIN_VALUE)); bgLabel.setBounds(0, 0, splashWidthPx, splashHeightPx); - pack(); + pack(); } /** * Getter for progress bar view. - * @return the SplashViewProgressMonitor progress bar used in the splash frame. + * + * @return the SplashViewProgressMonitor progress bar used in the splash + * frame. */ public final SplashProgressComponent getMonitorView() { return monitorView; } - + /** * Getter for progress monitor model. + * * @return the BraidsProgressMonitor model used in the splash frame. */ public final BraidsProgressMonitor getMonitorModel() { return monitorModel; } - + /** - * Returns state of splash frame, to determine if GUI should continue loading. + * Returns state of splash frame, to determine if GUI should continue + * loading. + * * @return SplashHasBeenClosed boolean. */ public final boolean getSplashHasBeenClosed() { return SplashHasBeenClosed; } - + /** * Sets state of splash frame, to determine if GUI should continue loading. - * @param SplashHasBeenClosed boolean. + * + * @param neoState + * the new splash has been closed */ - public final void setSplashHasBeenClosed(boolean neoState) { + public final void setSplashHasBeenClosed(final boolean neoState) { SplashHasBeenClosed = neoState; } - + /** - *

    closeAction

    - * Closes the splash frame by toggling "has been closed" switch - * (to cancel preloading) and dispose() (to discard JFrame). - * @param SplashHasBeenClosed boolean. - */ + *

    + * closeAction + *

    + * Closes the splash frame by toggling "has been closed" switch (to cancel + * preloading) and dispose() (to discard JFrame). + * + * @param SplashHasBeenClosed + * boolean. + */ private class closeAction extends AbstractAction { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { setSplashHasBeenClosed(true); dispose(); } diff --git a/src/main/java/forge/view/swing/SplashProgressComponent.java b/src/main/java/forge/view/swing/SplashProgressComponent.java index 8df91f032b6..734c8edb47b 100644 --- a/src/main/java/forge/view/swing/SplashProgressComponent.java +++ b/src/main/java/forge/view/swing/SplashProgressComponent.java @@ -6,9 +6,9 @@ import javax.swing.SwingUtilities; import net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor; import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; -/** - * Swing component view, to be used with BaseProgressMonitor. - * +/** + * Swing component view, to be used with BaseProgressMonitor. + * */ @SuppressWarnings("serial") public class SplashProgressComponent extends JProgressBar { @@ -22,66 +22,63 @@ public class SplashProgressComponent extends JProgressBar { */ public SplashProgressComponent() { super(); - + if (!SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("must be called from within an event dispatch thread"); } - + setString(""); setStringPainted(true); } - + /** * Updates progress bar stripe and text with current state of model. * */ public final void updateProgressBar() { // Update bar "stripe" - SwingUtilities.invokeLater(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { public void run() { - stripeUpdate(); + stripeUpdate(); } }); - - // Update bar message - // Note: shouldUpdateUI() severely retards motion - // of the preloader, so is temporarily disabled. - //if (getCurrentModel().shouldUpdateUI()) { - if ((getCurrentModel().getNumPhases() > 1)) { - displayUpdate( - "Phase " + getCurrentModel().getCurrentPhase() + ". " - //+ getUnitsCompletedSoFarThisPhase() + " units processed. " - //+ "Overall: " + getTotalPercentCompleteAsString() + "% complete, " - + "Overall ETA in " + getCurrentModel().getRelativeETAAsString(true) + "." - ); - } - else { - displayUpdate( - //"Overall: " + - getCurrentModel().getUnitsCompletedSoFarThisPhase() + " units processed; " - //+ "(" + getTotalPercentCompleteAsString() + "%); " - + "ETA in " + getCurrentModel().getRelativeETAAsString(true) + "." - ); - } - // getCurrentModel().justUpdatedUI(); - //} - + // Update bar message + // Note: shouldUpdateUI() severely retards motion + // of the preloader, so is temporarily disabled. + // if (getCurrentModel().shouldUpdateUI()) { + if ((getCurrentModel().getNumPhases() > 1)) { + displayUpdate("Phase " + getCurrentModel().getCurrentPhase() + ". " + // + getUnitsCompletedSoFarThisPhase() + " units processed. " + // + "Overall: " + getTotalPercentCompleteAsString() + + // "% complete, " + + "Overall ETA in " + getCurrentModel().getRelativeETAAsString(true) + "."); + } else { + displayUpdate( + // "Overall: " + + getCurrentModel().getUnitsCompletedSoFarThisPhase() + " units processed; " + // + "(" + getTotalPercentCompleteAsString() + "%); " + + "ETA in " + getCurrentModel().getRelativeETAAsString(true) + "."); + } + // getCurrentModel().justUpdatedUI(); + // } + if (getCurrentModel().getCurrentPhase() == getCurrentModel().getNumPhases() - && getCurrentModel().getUnitsCompletedSoFarThisPhase() >= getCurrentModel().getTotalUnitsThisPhase()) + && getCurrentModel().getUnitsCompletedSoFarThisPhase() >= getCurrentModel().getTotalUnitsThisPhase()) { displayUpdate("Done! Firing up the GUI..."); - } - } - + } + } + /** - * Shows the message inside the progress dialog; does not always work on - * all platforms. - * - * @param message the message to display + * Shows the message inside the progress dialog; does not always work on all + * platforms. + * + * @param message + * the message to display */ public final void displayUpdate(final String message) { - final Runnable proc = new Runnable() { + final Runnable proc = new Runnable() { public void run() { setString(message); getCurrentModel().justUpdatedUI(); @@ -90,46 +87,46 @@ public class SplashProgressComponent extends JProgressBar { if (SwingUtilities.isEventDispatchThread()) { proc.run(); - } - else { + } else { SwingUtilities.invokeLater(proc); } } - + /** * Moves the stripe inside the progress dialog. - * - */ + * + */ public final void stripeUpdate() { completed = getCurrentModel().getUnitsCompletedSoFarThisPhase(); total = getCurrentModel().getTotalUnitsThisPhase(); - - setValue((int)Math.round((int)completed/total*100)); + + setValue((int) Math.round((int) completed / total * 100)); } - + /** * Resets the stripe inside the progress dialog back to zero. - * + * */ public final void stripeReset() { setValue(0); } - + /** * Retrieves the model from which this component uses data. * * @param neoModel + * the new current model */ - public void setCurrentModel(BaseProgressMonitor neoModel) { + public final void setCurrentModel(final BaseProgressMonitor neoModel) { currentModel = neoModel; } - + /** * Sets model from which this component uses data. * - * @return + * @return the current model */ - public BraidsProgressMonitor getCurrentModel() { + public final BraidsProgressMonitor getCurrentModel() { return currentModel; } } diff --git a/src/main/java/forge/view/swing/SplashProgressModel.java b/src/main/java/forge/view/swing/SplashProgressModel.java index bee8761c276..c08a459e1a0 100644 --- a/src/main/java/forge/view/swing/SplashProgressModel.java +++ b/src/main/java/forge/view/swing/SplashProgressModel.java @@ -2,50 +2,59 @@ package forge.view.swing; import net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor; -/** +/** * Creates an instance of BaseProgressMonitor that is used in the splash frame. * * Not all mutators notify the view yet. - * + * */ public class SplashProgressModel extends BaseProgressMonitor { private SplashProgressComponent currentView = null; - + /** - * Constructor called with no arguments, indicating 1 phase - * and number of phase units assumed to be 1 also (can be updated later). - * @param numPhases + * Constructor called with no arguments, indicating 1 phase and number of + * phase units assumed to be 1 also (can be updated later). + * */ public SplashProgressModel() { - super(); + super(); } - - @Override + + /* + * (non-Javadoc) + * + * @see net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor# + * incrementUnitsCompletedThisPhase(long) + */ + /** * @see net.slightlymagic.braids.util.progress_monitor.BaseProgressMonitor#incrementUnitsCompletedThisPhase(long) + * @param numUnits long */ - public void incrementUnitsCompletedThisPhase(long numUnits) { + @Override + public final void incrementUnitsCompletedThisPhase(final long numUnits) { super.incrementUnitsCompletedThisPhase(numUnits); getCurrentView().updateProgressBar(); } - + /** - * Gets view from which data is sent for display + * Gets view from which data is sent for display. * - * @return + * @return the current view */ - public SplashProgressComponent getCurrentView() { + public final SplashProgressComponent getCurrentView() { return currentView; } /** - * Sets view to which data is sent for display + * Sets view to which data is sent for display. * * @param neoView + * the new current view */ - public void setCurrentView(SplashProgressComponent neoView) { + public final void setCurrentView(final SplashProgressComponent neoView) { currentView = neoView; } - + } diff --git a/src/main/java/forge/view/swing/WinLoseFrame.java b/src/main/java/forge/view/swing/WinLoseFrame.java index 0a9eb027e0e..8efcf8db90f 100644 --- a/src/main/java/forge/view/swing/WinLoseFrame.java +++ b/src/main/java/forge/view/swing/WinLoseFrame.java @@ -15,6 +15,7 @@ import javax.swing.JScrollPane; import javax.swing.SwingConstants; import javax.swing.border.AbstractBorder; +import net.miginfocom.swing.MigLayout; import forge.AllZone; import forge.Phase; import forge.Player; @@ -24,47 +25,62 @@ import forge.properties.ForgeProps; import forge.properties.NewConstants.LANG.WinLoseFrame.WINLOSETEXT; import forge.quest.data.QuestMatchState; -import net.miginfocom.swing.MigLayout; - -/**

    WinLoseFrame.

    - * VIEW - Core display for win/lose UI shown after completing a game. - * Uses handlers to customize central panel for various game modes. - * +/** + *

    + * WinLoseFrame. + *

    + * VIEW - Core display for win/lose UI shown after completing a game. Uses + * handlers to customize central panel for various game modes. + * */ @SuppressWarnings("serial") public class WinLoseFrame extends JFrame { private QuestMatchState matchState; private WinLoseModeHandler modeHandler; - + + /** The btn continue. */ public FButton btnContinue; + + /** The btn quit. */ public FButton btnQuit; + + /** The btn restart. */ public FButton btnRestart; - + + /** The lbl title. */ public JLabel lblTitle; + + /** The lbl stats. */ public JLabel lblStats; - + + /** The pnl custom. */ public JPanel pnlCustom; - + /** - *

    WinLoseFrame.

    + *

    + * WinLoseFrame. + *

    * Starts win/lose UI with default display. * */ public WinLoseFrame() { this(new WinLoseModeHandler()); } - + /** - *

    WinLoseFrame.

    - * Starts the standard win/lose UI with custom display - * for different game modes (quest, puzzle, etc.) + *

    + * WinLoseFrame. + *

    + * Starts the standard win/lose UI with custom display for different game + * modes (quest, puzzle, etc.) * - * @param mh {@link forge.view.swing.WinLoseModeHandler} + * @param mh + * {@link forge.view.swing.WinLoseModeHandler} */ - public WinLoseFrame(WinLoseModeHandler mh) { + public WinLoseFrame(final WinLoseModeHandler mh) { super(); - + // modeHandler handles the unique display for different game modes. modeHandler = mh; modeHandler.setView(this); @@ -74,81 +90,87 @@ public class WinLoseFrame extends JFrame { FPanel contentPanel = new FPanel(new MigLayout("wrap, fill, insets 20 0 10 10")); contentPanel.setBGImg(AllZone.getSkin().texture1); contentPanel.setBorder(new WinLoseBorder()); - getContentPane().add(contentPanel); - - //Footer should be at least 150 to keep buttons in-pane on Mac OS X - //it needs to be > 175 now that skinning is used + getContentPane().add(contentPanel); + + // Footer should be at least 150 to keep buttons in-pane on Mac OS X + // it needs to be > 175 now that skinning is used int HEAD_HEIGHT = 150; int FOOT_HEIGHT = 182; int FRAME_WIDTH_SMALL = 300; int FRAME_WIDTH_BIG = 600; - + // Head panel JPanel pnlHead = new JPanel(new MigLayout("wrap, fill")); pnlHead.setOpaque(false); - contentPanel.add(pnlHead,"width " + FRAME_WIDTH_SMALL + "!, align center"); + contentPanel.add(pnlHead, "width " + FRAME_WIDTH_SMALL + "!, align center"); lblTitle = new JLabel("WinLoseFrame > lblTitle is broken."); - lblTitle.setForeground(Color.white); + lblTitle.setForeground(Color.white); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); - lblTitle.setFont(AllZone.getSkin().font1.deriveFont(Font.PLAIN,26)); - + lblTitle.setFont(AllZone.getSkin().font1.deriveFont(Font.PLAIN, 26)); + lblStats = new JLabel("WinLoseFrame > lblStats is broken."); - lblStats.setForeground(Color.white); + lblStats.setForeground(Color.white); lblStats.setHorizontalAlignment(SwingConstants.CENTER); - lblStats.setFont(AllZone.getSkin().font1.deriveFont(Font.PLAIN,26)); - + lblStats.setFont(AllZone.getSkin().font1.deriveFont(Font.PLAIN, 26)); + pnlHead.add(lblTitle, "growx"); pnlHead.add(lblStats, "growx"); - + // Custom display panel in center; populated later by mode handler. JScrollPane scroller = new JScrollPane(); scroller.getVerticalScrollBar().setUnitIncrement(16); pnlCustom = new JPanel(new MigLayout("wrap, fillx")); - pnlCustom.setBackground(new Color(111,87,59)); + pnlCustom.setBackground(new Color(111, 87, 59)); pnlCustom.setForeground(Color.white); - contentPanel.add(scroller,"w 96%!, align center, gapleft 2%"); + contentPanel.add(scroller, "w 96%!, align center, gapleft 2%"); scroller.getViewport().add(pnlCustom); - - // Foot panel + + // Foot panel JPanel pnlFoot = new JPanel(new MigLayout("wrap, fill, hidemode 3")); pnlFoot.setOpaque(false); - contentPanel.add(pnlFoot,"width " + FRAME_WIDTH_SMALL + "!, align center"); - - this.btnContinue = new FButton("Continue"); - this.btnRestart = new FButton("Restart"); - this.btnQuit = new FButton("Quit"); - - pnlFoot.add(btnContinue,"h 36:36, w 200!, gap 0 0 5 5, align center"); - pnlFoot.add(btnRestart,"h 36:36, w 200!, gap 0 0 5 5, align center"); - pnlFoot.add(btnQuit,"h 36:36, w 200!, gap 0 0 5 5, align center"); - + contentPanel.add(pnlFoot, "width " + FRAME_WIDTH_SMALL + "!, align center"); + + this.btnContinue = new FButton("Continue"); + this.btnRestart = new FButton("Restart"); + this.btnQuit = new FButton("Quit"); + + pnlFoot.add(btnContinue, "h 36:36, w 200!, gap 0 0 5 5, align center"); + pnlFoot.add(btnRestart, "h 36:36, w 200!, gap 0 0 5 5, align center"); + pnlFoot.add(btnQuit, "h 36:36, w 200!, gap 0 0 5 5, align center"); + // Button actions btnQuit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(final ActionEvent e) { btnQuit_actionPerformed(e); } + public void actionPerformed(final ActionEvent e) { + btnQuit_actionPerformed(e); + } }); - + btnContinue.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(final ActionEvent e) { btnContinue_actionPerformed(e); } + public void actionPerformed(final ActionEvent e) { + btnContinue_actionPerformed(e); + } }); - + btnRestart.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(final ActionEvent e) { btnRestart_actionPerformed(e); } + public void actionPerformed(final ActionEvent e) { + btnRestart_actionPerformed(e); + } }); // End game and set state of "continue" button Phase.setGameBegins(0); - + if (matchState.isMatchOver()) { btnContinue.setEnabled(false); btnQuit.grabFocus(); } // Show Wins and Loses - Player human = AllZone.getHumanPlayer(); + Player human = AllZone.getHumanPlayer(); int humanWins = matchState.countGamesWonBy(human.getName()); - int humanLosses = matchState.getGamesPlayedCount() - humanWins; - + int humanLosses = matchState.getGamesPlayedCount() - humanWins; + lblStats.setText(ForgeProps.getLocalized(WINLOSETEXT.WON) + humanWins + ForgeProps.getLocalized(WINLOSETEXT.LOST) + humanLosses); @@ -158,78 +180,89 @@ public class WinLoseFrame extends JFrame { } else { lblTitle.setText(ForgeProps.getLocalized(WINLOSETEXT.LOSE)); } - + // Populate custom panel, if necessary. boolean hasContents = modeHandler.populateCustomPanel(); - if(!hasContents) { scroller.setVisible(false); } - + if (!hasContents) { + scroller.setVisible(false); + } + // Size and show frame Dimension screen = this.getToolkit().getScreenSize(); Rectangle bounds = this.getBounds(); - - if(hasContents) { + + if (hasContents) { bounds.height = screen.height - 150; - scroller.setPreferredSize(new Dimension(FRAME_WIDTH_BIG, - screen.height - HEAD_HEIGHT - FOOT_HEIGHT)); + scroller.setPreferredSize(new Dimension(FRAME_WIDTH_BIG, screen.height - HEAD_HEIGHT - FOOT_HEIGHT)); bounds.width = FRAME_WIDTH_BIG; - bounds.x = (screen.width - FRAME_WIDTH_BIG)/2; - bounds.y = (screen.height - bounds.height)/2; - } - else { + bounds.x = (screen.width - FRAME_WIDTH_BIG) / 2; + bounds.y = (screen.height - bounds.height) / 2; + } else { bounds.height = HEAD_HEIGHT + FOOT_HEIGHT; bounds.width = FRAME_WIDTH_SMALL; - bounds.x = (screen.width - FRAME_WIDTH_SMALL)/2; - bounds.y = (screen.height - bounds.height)/2; + bounds.x = (screen.width - FRAME_WIDTH_SMALL) / 2; + bounds.y = (screen.height - bounds.height) / 2; } - + this.setBackground(AllZone.getSkin().bg1a); - this.setBounds(bounds); + this.setBounds(bounds); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setUndecorated(true); this.setVisible(true); } - + /** - *

    continueButton_actionPerformed.

    - * - * @param e a {@link java.awt.event.ActionEvent} object. + *

    + * continueButton_actionPerformed. + *

    + * + * @param e + * a {@link java.awt.event.ActionEvent} object. */ - final void btnContinue_actionPerformed(ActionEvent e) { + final void btnContinue_actionPerformed(final ActionEvent e) { closeWinLoseFrame(); AllZone.getDisplay().setVisible(true); modeHandler.startNextRound(); } - + /** - *

    restartButton_actionPerformed.

    - * - * @param e a {@link java.awt.event.ActionEvent} object. + *

    + * restartButton_actionPerformed. + *

    + * + * @param e + * a {@link java.awt.event.ActionEvent} object. */ - final void btnRestart_actionPerformed(ActionEvent e) { - closeWinLoseFrame(); + final void btnRestart_actionPerformed(final ActionEvent e) { + closeWinLoseFrame(); AllZone.getDisplay().setVisible(true); matchState.reset(); modeHandler.startNextRound(); } - + /** - *

    btnQuit_actionPerformed.

    - * - * @param e a {@link java.awt.event.ActionEvent} object. + *

    + * btnQuit_actionPerformed. + *

    + * + * @param e + * a {@link java.awt.event.ActionEvent} object. */ - final void btnQuit_actionPerformed(ActionEvent e) { - closeWinLoseFrame(); + final void btnQuit_actionPerformed(final ActionEvent e) { + closeWinLoseFrame(); matchState.reset(); - modeHandler.actionOnQuit(); + modeHandler.actionOnQuit(); // clear Image caches, so the program doesn't get slower and slower // not needed with soft values - will shrink as needed // ImageUtil.rotatedCache.clear(); // ImageCache.cache.clear(); } - + /** - *

    closeWinLoseFrame.

    + *

    + * closeWinLoseFrame. + *

    * Disposes WinLoseFrame UI. * * @return {@link javax.swing.JFrame} display frame @@ -242,15 +275,14 @@ public class WinLoseFrame extends JFrame { this.dispose(); return frame; } - - private class WinLoseBorder extends AbstractBorder { - public void paintBorder(Component c, - Graphics g, int x, int y, int width, - int height) { - g.setColor(AllZone.getSkin().txt1a); - g.drawRect(x+1, y+1, width-3, height-3); - g.setColor(AllZone.getSkin().bg1a); - g.drawRect(x+3, y+3, width-7, height-7); - } + + private class WinLoseBorder extends AbstractBorder { + public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, + final int height) { + g.setColor(AllZone.getSkin().txt1a); + g.drawRect(x + 1, y + 1, width - 3, height - 3); + g.setColor(AllZone.getSkin().bg1a); + g.drawRect(x + 3, y + 3, width - 7, height - 7); + } } } diff --git a/src/main/java/forge/view/swing/WinLoseModeHandler.java b/src/main/java/forge/view/swing/WinLoseModeHandler.java index 90fb55edfba..e590fc5a73a 100644 --- a/src/main/java/forge/view/swing/WinLoseModeHandler.java +++ b/src/main/java/forge/view/swing/WinLoseModeHandler.java @@ -3,36 +3,44 @@ package forge.view.swing; import forge.AllZone; import forge.Constant; -/** - *

    WinLoseModeHandler.

    +/** + *

    + * WinLoseModeHandler. + *

    + * + * Superclass of custom mode handling for win/lose UI. Can add swing components + * to custom center panel. Custom mode handling for quest, puzzle, etc. should + * extend this class. * - * Superclass of custom mode handling for win/lose UI. Can add swing components - * to custom center panel. Custom mode handling for quest, puzzle, etc. - * should extend this class. - * */ public class WinLoseModeHandler { - + + /** The view. */ protected WinLoseFrame view; - + /** - *

    actionOnQuit.

    - * Action performed when "continue" button is pressed in default win/lose UI. + *

    + * actionOnQuit. + *

    + * Action performed when "continue" button is pressed in default win/lose + * UI. * */ public void actionOnContinue() { - + } - + /** - *

    actionOnQuit.

    + *

    + * actionOnQuit. + *

    * Action performed when "quit" button is pressed in default win/lose UI. * */ - public void actionOnQuit() { + public final void actionOnQuit() { if (System.getenv("NG2") != null) { if (System.getenv("NG2").equalsIgnoreCase("true")) { - String argz[] = {}; + String[] argz = {}; Gui_HomeScreen.main(argz); } else { new OldGuiNewGame(); @@ -41,45 +49,54 @@ public class WinLoseModeHandler { new OldGuiNewGame(); } } - + /** - *

    actionOnRestart.

    + *

    + * actionOnRestart. + *

    * Action performed when "restart" button is pressed in default win/lose UI. * */ public void actionOnRestart() { - + } - + /** - *

    startNextRound.

    - * Either continues or restarts a current game. May be overridden - * for use with other game modes. - * - * @param e a {@link java.awt.event.ActionEvent} object. + *

    + * startNextRound. + *

    + * Either continues or restarts a current game. May be overridden for use + * with other game modes. + * */ - public void startNextRound() { + public final void startNextRound() { AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]); } - + /** - *

    populateCustomPanel.

    - * May be overridden as required by various mode handlers to show - * custom information in center panel. Default configuration is empty. + *

    + * populateCustomPanel. + *

    + * May be overridden as required by various mode handlers to show custom + * information in center panel. Default configuration is empty. * - * @param boolean indicating if custom panel has contents. + * @return true, if successful */ - public boolean populateCustomPanel() { + public final boolean populateCustomPanel() { return false; } - + /** - *

    setView.

    - * Links win/lose swing frame to mode handler, mostly to allow - * direct manipulation of custom center panel. + *

    + * setView. + *

    + * Links win/lose swing frame to mode handler, mostly to allow direct + * manipulation of custom center panel. * + * @param wlh + * the new view */ - public void setView(WinLoseFrame wlh) { - view = wlh; + public final void setView(final WinLoseFrame wlh) { + view = wlh; } }