mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
checkstyle
This commit is contained in:
@@ -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,37 +25,48 @@ 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
|
||||
@@ -65,15 +75,16 @@ public class ApplicationView implements FView {
|
||||
|
||||
if (splashFrame == null) {
|
||||
result = null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
result = splashFrame.getMonitorModel();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.view.FView#setModel(forge.model.FModel)
|
||||
*/
|
||||
|
||||
@@ -105,62 +116,68 @@ public class ApplicationView implements FView {
|
||||
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();
|
||||
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);
|
||||
try {
|
||||
if ("".equals(finalPreferences.laf)) {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} else {
|
||||
UIManager.setLookAndFeel(finalPreferences.laf);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// For the following two blocks, check if user has cancelled SplashFrame.
|
||||
// For the following two blocks, check if user has cancelled
|
||||
// SplashFrame.
|
||||
// Note: Error thrown sometimes because log file cannot be accessed
|
||||
if(!splashFrame.getSplashHasBeenClosed()) {
|
||||
if (!splashFrame.getSplashHasBeenClosed()) {
|
||||
AllZone.getCardFactory(); // forces preloading of all cards
|
||||
}
|
||||
|
||||
if(!splashFrame.getSplashHasBeenClosed()) {
|
||||
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()));
|
||||
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.
|
||||
// Enable only one of the following two lines.
|
||||
// The second
|
||||
// is useful for debugging.
|
||||
|
||||
splashFrame.dispose();
|
||||
//splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
splashFrame.dispose();
|
||||
// splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
splashFrame = null;
|
||||
|
||||
splashFrame = null;
|
||||
|
||||
if (System.getenv("NG2") != null) {
|
||||
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||
String argz[] = {};
|
||||
Gui_HomeScreen.main(argz);
|
||||
} else {
|
||||
new OldGuiNewGame();
|
||||
if (System.getenv("NG2") != null) {
|
||||
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||
String[] argz = {};
|
||||
Gui_HomeScreen.main(argz);
|
||||
} else {
|
||||
new OldGuiNewGame();
|
||||
}
|
||||
} else {
|
||||
new OldGuiNewGame();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
new OldGuiNewGame();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
}
|
||||
} // End if(splashHasBeenClosed)
|
||||
} // End if(splashHasBeenClosed)
|
||||
|
||||
} // End ApplicationView()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,19 +35,20 @@ public final class Main {
|
||||
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.
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -82,14 +125,17 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
// @SuppressWarnings("unused")
|
||||
// titledBorder2
|
||||
/** Constant <code>newGuiCheckBox</code> */
|
||||
/** Constant <code>newGuiCheckBox</code>. */
|
||||
// private static JCheckBox newGuiCheckBox = new JCheckBox("", true);
|
||||
/** Constant <code>smoothLandCheckBox</code>. */
|
||||
static JCheckBox smoothLandCheckBox = new JCheckBox("", false);
|
||||
/** Constant <code>devModeCheckBox</code>. */
|
||||
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()
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -217,18 +261,18 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
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);
|
||||
@@ -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<CardPrinted> sDeck = sd.getCardpool();
|
||||
@@ -361,8 +405,12 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
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);
|
||||
@@ -371,7 +419,6 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
deckEditorButtonActionPerformed(GameType.Sealed, deck);
|
||||
|
||||
|
||||
Constant.Runtime.ComputerDeck[0] = aiDeck;
|
||||
} else {
|
||||
new OldGuiNewGame();
|
||||
@@ -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());
|
||||
@@ -632,8 +680,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* deckEditorButton_actionPerformed.
|
||||
* </p>
|
||||
*
|
||||
* @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) {
|
||||
|
||||
@@ -793,7 +843,6 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
dispose();
|
||||
} // startButton_actionPerformed()
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* singleRadioButton_actionPerformed.
|
||||
@@ -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
|
||||
@@ -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,21 +1113,27 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1074,23 +1149,30 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* 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,22 +1180,29 @@ 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);
|
||||
@@ -1121,47 +1210,61 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author slapshot5
|
||||
*
|
||||
*/
|
||||
public static class DownloadActionQuest extends AbstractAction {
|
||||
private static final long serialVersionUID = -4439763134551377894L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public DownloadActionQuest() {
|
||||
super(ForgeProps.getLocalized(MENU_BAR.MENU.DOWNLOADQUESTIMG));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final void actionPerformed(final ActionEvent e) {
|
||||
//GuiDownloadQuestImages.startDownload(null);
|
||||
new GuiDownloadQuestImages(null);
|
||||
}
|
||||
}
|
||||
* The Class DownloadActionQuest.
|
||||
*
|
||||
* @author slapshot5
|
||||
*/
|
||||
public static class DownloadActionQuest extends AbstractAction {
|
||||
private static final long serialVersionUID = -4439763134551377894L;
|
||||
|
||||
/**
|
||||
* 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<String> ch = new ListChooser<String>("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<String> ch = new ListChooser<String>("Choose one", "Choose the max size of a stack", 0, 1,
|
||||
keys);
|
||||
ListChooser<String> ch
|
||||
= new ListChooser<String>("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<String> ch = new ListChooser<String>("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);
|
||||
@@ -1432,27 +1582,34 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -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,9 +1777,9 @@ 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); }
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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.
|
||||
@@ -27,19 +27,19 @@ import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
|
||||
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 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 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 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;
|
||||
@@ -47,14 +47,19 @@ public class SplashFrame extends JFrame {
|
||||
private boolean SplashHasBeenClosed = false;
|
||||
|
||||
/**
|
||||
* <p>Create the frame; this <strong>must</strong> be called from an event
|
||||
* dispatch thread.</p>
|
||||
*
|
||||
* <!-- CheckStyle won't let me use at-throws. -->
|
||||
* Throws {@link IllegalStateException} if not called from an event
|
||||
* <p>
|
||||
* Create the frame; this <strong>must</strong> be called from an event
|
||||
* dispatch thread.
|
||||
* </p>
|
||||
*
|
||||
* <!-- CheckStyle won't let me use at-throws. --> 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()) {
|
||||
@@ -79,10 +84,10 @@ public class SplashFrame extends JFrame {
|
||||
contentPane.setLayout(null);
|
||||
|
||||
// Add disclaimer
|
||||
final JLabel lblDisclaimer = new JLabel("<html><center>Forge is not affiliated in any way with Wizards of the Coast.<br>Forge is open source software, released under the GNU Public License.</center></html>");
|
||||
final JLabel lblDisclaimer = new JLabel(
|
||||
"<html><center>Forge is not affiliated in any way with Wizards of the Coast.<br>Forge is open source software, released under the GNU Public License.</center></html>");
|
||||
|
||||
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);
|
||||
@@ -91,23 +96,23 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
// 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);
|
||||
}
|
||||
@@ -117,14 +122,13 @@ public class SplashFrame extends JFrame {
|
||||
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();
|
||||
@@ -135,15 +139,16 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
// 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);
|
||||
@@ -153,7 +158,9 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
@@ -161,6 +168,7 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
/**
|
||||
* Getter for progress monitor model.
|
||||
*
|
||||
* @return the BraidsProgressMonitor model used in the splash frame.
|
||||
*/
|
||||
public final BraidsProgressMonitor getMonitorModel() {
|
||||
@@ -168,7 +176,9 @@ public class SplashFrame extends JFrame {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
@@ -177,20 +187,26 @@ public class SplashFrame extends JFrame {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>closeAction</p>
|
||||
* Closes the splash frame by toggling "has been closed" switch
|
||||
* (to cancel preloading) and dispose() (to discard JFrame).
|
||||
* @param SplashHasBeenClosed boolean.
|
||||
* <p>
|
||||
* closeAction
|
||||
* </p>
|
||||
* 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();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ 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")
|
||||
@@ -39,46 +39,43 @@ public class SplashProgressComponent extends JProgressBar {
|
||||
// Update bar "stripe"
|
||||
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();
|
||||
//}
|
||||
|
||||
// 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.
|
||||
* Shows the message inside the progress dialog; does not always work on all
|
||||
* platforms.
|
||||
*
|
||||
* @param message the message to display
|
||||
* @param message
|
||||
* the message to display
|
||||
*/
|
||||
public final void displayUpdate(final String message) {
|
||||
final Runnable proc = new Runnable() {
|
||||
@@ -90,8 +87,7 @@ public class SplashProgressComponent extends JProgressBar {
|
||||
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
proc.run();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SwingUtilities.invokeLater(proc);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +100,7 @@ public class SplashProgressComponent extends JProgressBar {
|
||||
completed = getCurrentModel().getUnitsCompletedSoFarThisPhase();
|
||||
total = getCurrentModel().getTotalUnitsThisPhase();
|
||||
|
||||
setValue((int)Math.round((int)completed/total*100));
|
||||
setValue((int) Math.round((int) completed / total * 100));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,17 +115,18 @@ public class SplashProgressComponent extends JProgressBar {
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,38 +13,47 @@ 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();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,11 +25,12 @@ import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.LANG.WinLoseFrame.WINLOSETEXT;
|
||||
import forge.quest.data.QuestMatchState;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
/** <p>WinLoseFrame.</p>
|
||||
* VIEW - Core display for win/lose UI shown after completing a game.
|
||||
* Uses handlers to customize central panel for various game modes.
|
||||
/**
|
||||
* <p>
|
||||
* WinLoseFrame.
|
||||
* </p>
|
||||
* VIEW - Core display for win/lose UI shown after completing a game. Uses
|
||||
* handlers to customize central panel for various game modes.
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@@ -37,17 +39,28 @@ 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;
|
||||
|
||||
/**
|
||||
* <p>WinLoseFrame.</p>
|
||||
* <p>
|
||||
* WinLoseFrame.
|
||||
* </p>
|
||||
* Starts win/lose UI with default display.
|
||||
*
|
||||
*/
|
||||
@@ -56,13 +69,16 @@ public class WinLoseFrame extends JFrame {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>WinLoseFrame.</p>
|
||||
* Starts the standard win/lose UI with custom display
|
||||
* for different game modes (quest, puzzle, etc.)
|
||||
* <p>
|
||||
* WinLoseFrame.
|
||||
* </p>
|
||||
* 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.
|
||||
@@ -76,8 +92,8 @@ public class WinLoseFrame extends JFrame {
|
||||
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
|
||||
// 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;
|
||||
@@ -86,17 +102,17 @@ public class WinLoseFrame extends JFrame {
|
||||
// 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.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.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");
|
||||
@@ -105,35 +121,41 @@ public class WinLoseFrame extends JFrame {
|
||||
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
|
||||
JPanel pnlFoot = new JPanel(new MigLayout("wrap, fill, hidemode 3"));
|
||||
pnlFoot.setOpaque(false);
|
||||
contentPanel.add(pnlFoot,"width " + FRAME_WIDTH_SMALL + "!, 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");
|
||||
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");
|
||||
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
|
||||
@@ -161,25 +183,25 @@ public class WinLoseFrame extends JFrame {
|
||||
|
||||
// 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);
|
||||
@@ -190,22 +212,28 @@ public class WinLoseFrame extends JFrame {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>continueButton_actionPerformed.</p>
|
||||
* <p>
|
||||
* continueButton_actionPerformed.
|
||||
* </p>
|
||||
*
|
||||
* @param e a {@link java.awt.event.ActionEvent} object.
|
||||
* @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();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>restartButton_actionPerformed.</p>
|
||||
* <p>
|
||||
* restartButton_actionPerformed.
|
||||
* </p>
|
||||
*
|
||||
* @param e a {@link java.awt.event.ActionEvent} object.
|
||||
* @param e
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
final void btnRestart_actionPerformed(ActionEvent e) {
|
||||
final void btnRestart_actionPerformed(final ActionEvent e) {
|
||||
closeWinLoseFrame();
|
||||
AllZone.getDisplay().setVisible(true);
|
||||
matchState.reset();
|
||||
@@ -213,11 +241,14 @@ public class WinLoseFrame extends JFrame {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>btnQuit_actionPerformed.</p>
|
||||
* <p>
|
||||
* btnQuit_actionPerformed.
|
||||
* </p>
|
||||
*
|
||||
* @param e a {@link java.awt.event.ActionEvent} object.
|
||||
* @param e
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
final void btnQuit_actionPerformed(ActionEvent e) {
|
||||
final void btnQuit_actionPerformed(final ActionEvent e) {
|
||||
closeWinLoseFrame();
|
||||
matchState.reset();
|
||||
modeHandler.actionOnQuit();
|
||||
@@ -229,7 +260,9 @@ public class WinLoseFrame extends JFrame {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>closeWinLoseFrame.</p>
|
||||
* <p>
|
||||
* closeWinLoseFrame.
|
||||
* </p>
|
||||
* Disposes WinLoseFrame UI.
|
||||
*
|
||||
* @return {@link javax.swing.JFrame} display frame
|
||||
@@ -244,13 +277,12 @@ public class WinLoseFrame extends JFrame {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,26 @@ import forge.AllZone;
|
||||
import forge.Constant;
|
||||
|
||||
/**
|
||||
* <p>WinLoseModeHandler.</p>
|
||||
* <p>
|
||||
* WinLoseModeHandler.
|
||||
* </p>
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* <p>actionOnQuit.</p>
|
||||
* Action performed when "continue" button is pressed in default win/lose UI.
|
||||
* <p>
|
||||
* actionOnQuit.
|
||||
* </p>
|
||||
* Action performed when "continue" button is pressed in default win/lose
|
||||
* UI.
|
||||
*
|
||||
*/
|
||||
public void actionOnContinue() {
|
||||
@@ -25,14 +31,16 @@ public class WinLoseModeHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>actionOnQuit.</p>
|
||||
* <p>
|
||||
* actionOnQuit.
|
||||
* </p>
|
||||
* 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();
|
||||
@@ -43,7 +51,9 @@ public class WinLoseModeHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>actionOnRestart.</p>
|
||||
* <p>
|
||||
* actionOnRestart.
|
||||
* </p>
|
||||
* Action performed when "restart" button is pressed in default win/lose UI.
|
||||
*
|
||||
*/
|
||||
@@ -52,34 +62,41 @@ public class WinLoseModeHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>startNextRound.</p>
|
||||
* Either continues or restarts a current game. May be overridden
|
||||
* for use with other game modes.
|
||||
* <p>
|
||||
* startNextRound.
|
||||
* </p>
|
||||
* 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.
|
||||
*/
|
||||
public void startNextRound() {
|
||||
public final void startNextRound() {
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>populateCustomPanel.</p>
|
||||
* May be overridden as required by various mode handlers to show
|
||||
* custom information in center panel. Default configuration is empty.
|
||||
* <p>
|
||||
* populateCustomPanel.
|
||||
* </p>
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>setView.</p>
|
||||
* Links win/lose swing frame to mode handler, mostly to allow
|
||||
* direct manipulation of custom center panel.
|
||||
* <p>
|
||||
* setView.
|
||||
* </p>
|
||||
* 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) {
|
||||
public final void setView(final WinLoseFrame wlh) {
|
||||
view = wlh;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user