Enforced singleton pattern in FSkin.

Converted FSkin to static factory.
Updated all uses of FSkin as appropriate.
Removed all extra references/storages to FSkin.
This commit is contained in:
Doublestrike
2012-02-06 13:51:02 +00:00
parent 453f602d61
commit 84c1ae6b5f
53 changed files with 515 additions and 645 deletions

View File

@@ -49,6 +49,9 @@ public final class Constant {
/** The Constant ComputerDeck. */ /** The Constant ComputerDeck. */
public static final Deck[] COMPUTER_DECK = new Deck[1]; public static final Deck[] COMPUTER_DECK = new Deck[1];
/** The skin name. */
public static String SKIN_NAME = "default";
/** The game type. */ /** The game type. */
private static GameType gameType = GameType.Constructed; private static GameType gameType = GameType.Constructed;

View File

@@ -11,7 +11,6 @@ import javax.swing.SwingUtilities;
import forge.AllZone; import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.Singletons;
import forge.control.FControl; import forge.control.FControl;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.GameType; import forge.game.GameType;
@@ -45,11 +44,11 @@ public class ControlDraft {
} }
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
view.getLblDirections().setForeground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER)); view.getLblDirections().setForeground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
view.getLblDirections().setForeground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_TEXT)); view.getLblDirections().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
}; };

View File

@@ -165,15 +165,12 @@ public class ControlSettings {
view.getLblTitleSkin().setIcon(new ImageIcon("res/images/skins/default/loader.gif")); view.getLblTitleSkin().setIcon(new ImageIcon("res/images/skins/default/loader.gif"));
final String name = view.getLstChooseSkin().getSelectedValue().toString(); final String name = view.getLstChooseSkin().getSelectedValue().toString();
Singletons.getView().getSkin().unloadSkin();
Singletons.getView().setSkin(null);
final SwingWorker<Object, Object> w = new SwingWorker<Object, Object>() { final SwingWorker<Object, Object> w = new SwingWorker<Object, Object>() {
@Override @Override
public String doInBackground() { public String doInBackground() {
FSkin skin = new FSkin(name); FSkin.loadLight(name);
skin.load(); FSkin.loadFull();
Singletons.getView().setSkin(skin);
prefs.setPref(FPref.UI_SKIN, name); prefs.setPref(FPref.UI_SKIN, name);
prefs.save(); prefs.save();

View File

@@ -13,7 +13,6 @@ import forge.GuiDownloadPrices;
import forge.GuiDownloadQuestImages; import forge.GuiDownloadQuestImages;
import forge.GuiDownloadSetPicturesLQ; import forge.GuiDownloadSetPicturesLQ;
import forge.GuiImportPicture; import forge.GuiImportPicture;
import forge.Singletons;
import forge.deck.Deck; import forge.deck.Deck;
import forge.error.BugzReporter; import forge.error.BugzReporter;
import forge.game.GameType; import forge.game.GameType;
@@ -50,11 +49,11 @@ public class ControlUtilities {
} }
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
view.getLblLicensing().setForeground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER)); view.getLblLicensing().setForeground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
view.getLblLicensing().setForeground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_TEXT)); view.getLblLicensing().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
}; };

View File

@@ -40,6 +40,7 @@ import forge.properties.ForgePreferences.FPref;
import forge.quest.data.QuestPreferences; import forge.quest.data.QuestPreferences;
import forge.util.FileUtil; import forge.util.FileUtil;
import forge.util.HttpUtil; import forge.util.HttpUtil;
import forge.view.toolbox.FSkin;
/** /**
* The default Model implementation for Forge. * The default Model implementation for Forge.
@@ -100,13 +101,19 @@ public class FModel {
// Unfortunately, they're tied up in legacy code in the Display interface, // Unfortunately, they're tied up in legacy code in the Display interface,
// currently in GuiTopLevel. When that code is updated, this TODO should be resolved. // currently in GuiTopLevel. When that code is updated, this TODO should be resolved.
// Doublestrike 24-01-12 // Doublestrike 24-01-12
// ==
// It's looking like all the settings at the same time, here only.
// Doublestrike 06-02-12
Constant.Runtime.DEV_MODE[0] = preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED); Constant.Runtime.DEV_MODE[0] = preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED);
Constant.Runtime.SKIN_NAME = preferences.getPref(FPref.UI_SKIN);
// Load splash image and preloader swatches for skin
FSkin.loadLight(Constant.Runtime.SKIN_NAME);
// Instantiate AI // Instantiate AI
AllZone.setInputControl(new InputControl(FModel.this)); AllZone.setInputControl(new InputControl(FModel.this));
AllZone.getInputControl().setComputer(new ComputerAIInput(new ComputerAIGeneral())); AllZone.getInputControl().setComputer(new ComputerAIInput(new ComputerAIGeneral()));
// Set gameplay preferences and constants // Set gameplay preferences and constants
final HttpUtil pinger = new HttpUtil(); final HttpUtil pinger = new HttpUtil();
final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php"; final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php";

View File

@@ -25,7 +25,6 @@ import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
/** /**
@@ -47,29 +46,27 @@ public class QuestStallManager {
* Master method for assembling stall data: merchant... * Master method for assembling stall data: merchant...
*/ */
public static void buildStalls() { public static void buildStalls() {
final FSkin skin = Singletons.getView().getSkin();
QuestStallManager.stalls = new HashMap<String, QuestStallDefinition>(); QuestStallManager.stalls = new HashMap<String, QuestStallDefinition>();
QuestStallManager.stalls.put(QuestStallManager.ALCHEMIST, new QuestStallDefinition(QuestStallManager.ALCHEMIST, QuestStallManager.stalls.put(QuestStallManager.ALCHEMIST, new QuestStallDefinition(QuestStallManager.ALCHEMIST,
"Orim, Samite Healer", "The walls of this alchemist's stall are covered with shelves with potions, oils, " "Orim, Samite Healer", "The walls of this alchemist's stall are covered with shelves with potions, oils, "
+ "powders, poultices and elixirs, each meticulously labeled.", + "powders, poultices and elixirs, each meticulously labeled.",
skin.getIcon(FSkin.QuestIcons.ICO_BOTTLES))); FSkin.getIcon(FSkin.QuestIcons.ICO_BOTTLES)));
QuestStallManager.stalls.put(QuestStallManager.BANKER, new QuestStallDefinition(QuestStallManager.BANKER, QuestStallManager.stalls.put(QuestStallManager.BANKER, new QuestStallDefinition(QuestStallManager.BANKER,
"Bank of Sarpadia", "A large book large enough to be seen from the outside rests on the Banker's desk.", "Bank of Sarpadia", "A large book large enough to be seen from the outside rests on the Banker's desk.",
skin.getIcon(FSkin.QuestIcons.ICO_COIN))); FSkin.getIcon(FSkin.QuestIcons.ICO_COIN)));
QuestStallManager.stalls.put(QuestStallManager.BOOKSTORE, new QuestStallDefinition(QuestStallManager.BOOKSTORE, QuestStallManager.stalls.put(QuestStallManager.BOOKSTORE, new QuestStallDefinition(QuestStallManager.BOOKSTORE,
"Beleren's Books", "Tomes of different sizes are stacked in man-high towers.", "Beleren's Books", "Tomes of different sizes are stacked in man-high towers.",
skin.getIcon(FSkin.QuestIcons.ICO_BOOK))); FSkin.getIcon(FSkin.QuestIcons.ICO_BOOK)));
QuestStallManager.stalls.put(QuestStallManager.GEAR, new QuestStallDefinition(QuestStallManager.GEAR, QuestStallManager.stalls.put(QuestStallManager.GEAR, new QuestStallDefinition(QuestStallManager.GEAR,
"The Rope and Axe", "The Rope and Axe",
"This adventurer's market has a tool for every need ... or so the plaque on the wall claims.", "This adventurer's market has a tool for every need ... or so the plaque on the wall claims.",
skin.getIcon(FSkin.QuestIcons.ICO_GEAR))); FSkin.getIcon(FSkin.QuestIcons.ICO_GEAR)));
QuestStallManager.stalls.put(QuestStallManager.NURSERY, new QuestStallDefinition(QuestStallManager.NURSERY, QuestStallManager.stalls.put(QuestStallManager.NURSERY, new QuestStallDefinition(QuestStallManager.NURSERY,
"Force of Nature Nursery", "The smells of the one hundred and one different plants forms a unique fragrance.", "Force of Nature Nursery", "The smells of the one hundred and one different plants forms a unique fragrance.",
skin.getIcon(FSkin.QuestIcons.ICO_LEAF))); FSkin.getIcon(FSkin.QuestIcons.ICO_LEAF)));
QuestStallManager.stalls.put(QuestStallManager.PET_SHOP, new QuestStallDefinition(QuestStallManager.PET_SHOP, QuestStallManager.stalls.put(QuestStallManager.PET_SHOP, new QuestStallDefinition(QuestStallManager.PET_SHOP,
"The Hive", "This large menagerie echoes with a multitude of animal noises.", "The Hive", "This large menagerie echoes with a multitude of animal noises.",
skin.getIcon(FSkin.QuestIcons.ICO_FOX))); FSkin.getIcon(FSkin.QuestIcons.ICO_FOX)));
} }
/** /**

View File

@@ -20,7 +20,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -52,7 +51,7 @@ public class QuestItemElixir extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_ELIXER); return FSkin.getIcon(FSkin.QuestIcons.ICO_ELIXER);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@@ -84,5 +83,4 @@ public class QuestItemElixir extends QuestItemAbstract {
AllZone.getQuestData().addLife(1); AllZone.getQuestData().addLife(1);
} }
} }
} }

View File

@@ -19,7 +19,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -54,7 +53,7 @@ public class QuestItemEstates extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_GOLD); return FSkin.getIcon(FSkin.QuestIcons.ICO_GOLD);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -19,7 +19,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -51,7 +50,7 @@ public class QuestItemLuckyCoin extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_COIN); return FSkin.getIcon(FSkin.QuestIcons.ICO_COIN);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -19,7 +19,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -57,7 +56,7 @@ public class QuestItemMap extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_MAP); return FSkin.getIcon(FSkin.QuestIcons.ICO_MAP);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -20,7 +20,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -53,7 +52,7 @@ public class QuestItemPoundFlesh extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_BREW); return FSkin.getIcon(FSkin.QuestIcons.ICO_BREW);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -19,7 +19,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -45,7 +44,7 @@ public class QuestItemSleight extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_BOOK); return FSkin.getIcon(FSkin.QuestIcons.ICO_BOOK);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -20,7 +20,6 @@ package forge.quest.data.item;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -64,7 +63,7 @@ public class QuestItemZeppelin extends QuestItemAbstract {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public final ImageIcon getIcon() { public final ImageIcon getIcon() {
return Singletons.getView().getSkin().getIcon(FSkin.QuestIcons.ICO_ZEP); return FSkin.getIcon(FSkin.QuestIcons.ICO_ZEP);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -38,23 +38,19 @@ public class FView {
private transient SplashFrame splashFrame; private transient SplashFrame splashFrame;
private FProgressBar barProgress = null; private FProgressBar barProgress = null;
private FSkin skin;
/** /**
* The splashFrame field is guaranteed to exist when this constructor exits. * The splashFrame field is guaranteed to exist when this constructor exits.
* *
* @param skin0 &emsp; {@link forge.view.toolbox.FSkin}
*/ */
public FView(final FSkin skin0) { public FView() {
this.skin = skin0;
// We must use invokeAndWait here to fulfill the constructor's // We must use invokeAndWait here to fulfill the constructor's
// contract. NOPMD by Braids on 8/18/11 11:37 PM // contract. NOPMD by Braids on 8/18/11 11:37 PM
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
FView.this.splashFrame = new SplashFrame(FView.this.skin); FView.this.splashFrame = new SplashFrame();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -87,19 +83,9 @@ public class FView {
this.barProgress = bar0; this.barProgress = bar0;
} }
/** @return {@link forge.view.toolbox.FSkin} */
public FSkin getSkin() {
return this.skin;
}
/** @param skin0 &emsp; {@link forge.view.toolbox.FSkin} */
public void setSkin(final FSkin skin0) {
this.skin = skin0;
}
/** /**
* Tell the view that the model has been bootstrapped, and its data is ready * Tell the view that the model has been bootstrapped, the initial stuff
* for initial display. * for the skin is in place, and data is ready for initial display.
*/ */
public final void initialize() { public final void initialize() {
this.setProgressBar(splashFrame.getProgressBar()); this.setProgressBar(splashFrame.getProgressBar());
@@ -108,7 +94,7 @@ public class FView {
AllZone.getCardFactory(); AllZone.getCardFactory();
// Preloads skin components (using progress bar). // Preloads skin components (using progress bar).
FView.this.skin.load(); FSkin.loadFull();
// Does not use progress bar, due to be deprecated with battlefield refactoring. // Does not use progress bar, due to be deprecated with battlefield refactoring.
CardFaceSymbols.loadImages(); CardFaceSymbols.loadImages();

View File

@@ -52,7 +52,6 @@ import forge.view.toolbox.FSkin;
public class GuiTopLevel extends JFrame implements Display, CardContainer { public class GuiTopLevel extends JFrame implements Display, CardContainer {
private final JLayeredPane lpnContent; private final JLayeredPane lpnContent;
private final FControl control; private final FControl control;
private final FSkin skin;
/** /**
* Parent JFrame for Forge UI. * Parent JFrame for Forge UI.
@@ -65,11 +64,10 @@ public class GuiTopLevel extends JFrame implements Display, CardContainer {
this.lpnContent = new JLayeredPane(); this.lpnContent = new JLayeredPane();
this.lpnContent.setOpaque(true); this.lpnContent.setOpaque(true);
this.skin = Singletons.getView().getSkin();
this.setContentPane(this.lpnContent); this.setContentPane(this.lpnContent);
this.addOverlay(); this.addOverlay();
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setIconImage(skin.getIcon(FSkin.ForgeIcons.ICO_FAVICON).getImage()); this.setIconImage(FSkin.getIcon(FSkin.ForgeIcons.ICO_FAVICON).getImage());
this.setTitle("Forge: " + Singletons.getModel().getBuildInfo().getVersion()); this.setTitle("Forge: " + Singletons.getModel().getBuildInfo().getVersion());
// Init controller // Init controller

View File

@@ -21,8 +21,6 @@ import forge.Singletons;
import forge.error.ErrorViewer; import forge.error.ErrorViewer;
import forge.error.ExceptionHandler; import forge.error.ExceptionHandler;
import forge.model.FModel; import forge.model.FModel;
import forge.properties.ForgePreferences.FPref;
import forge.view.toolbox.FSkin;
/** /**
* Main class for Forge's swing application view. * Main class for Forge's swing application view.
@@ -46,8 +44,7 @@ public final class Main {
ExceptionHandler.registerErrorHandling(); ExceptionHandler.registerErrorHandling();
try { try {
final FModel model = new FModel(); final FModel model = new FModel();
final FSkin skin = new FSkin(model.getPreferences().getPref(FPref.UI_SKIN)); final FView view = new FView();
final FView view = new FView(skin);
Singletons.setModel(model); Singletons.setModel(model);
Singletons.setView(view); Singletons.setView(view);

View File

@@ -6,7 +6,6 @@ import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
import forge.view.toolbox.FLabel; import forge.view.toolbox.FLabel;
import forge.view.toolbox.FPanel; import forge.view.toolbox.FPanel;
@@ -17,7 +16,6 @@ import forge.view.toolbox.FSkin;
* instantiates top-level controller for bazaar UI. */ * instantiates top-level controller for bazaar UI. */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BazaarTopLevel extends FPanel { public class BazaarTopLevel extends FPanel {
private final FSkin skin;
private final JPanel pnlAllStalls; private final JPanel pnlAllStalls;
private final ViewStall pnlSingleStall; private final ViewStall pnlSingleStall;
private FLabel previousSelected; private FLabel previousSelected;
@@ -28,12 +26,11 @@ public class BazaarTopLevel extends FPanel {
super(); super();
// Final inits // Final inits
this.skin = Singletons.getView().getSkin();
this.pnlAllStalls = new JPanel(); this.pnlAllStalls = new JPanel();
this.pnlSingleStall = new ViewStall(this); this.pnlSingleStall = new ViewStall(this);
// Component styling // Component styling
this.setBGTexture(skin.getIcon(FSkin.Backgrounds.BG_TEXTURE)); this.setBGTexture(FSkin.getIcon(FSkin.Backgrounds.BG_TEXTURE));
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
pnlAllStalls.setOpaque(false); pnlAllStalls.setOpaque(false);
pnlAllStalls.setLayout(new MigLayout("insets 0, gap 0, wrap, align center")); pnlAllStalls.setLayout(new MigLayout("insets 0, gap 0, wrap, align center"));

View File

@@ -7,7 +7,6 @@ import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.quest.data.bazaar.QuestStallPurchasable; import forge.quest.data.bazaar.QuestStallPurchasable;
import forge.view.GuiTopLevel; import forge.view.GuiTopLevel;
import forge.view.toolbox.FLabel; import forge.view.toolbox.FLabel;
@@ -31,7 +30,7 @@ public class ViewItem extends FRoundedPanel {
tarDesc = new FTextArea(); tarDesc = new FTextArea();
btnPurchase = new FLabel.Builder().text("Buy").opaque(true).fontScaleFactor(0.2).hoverable(true).build(); btnPurchase = new FLabel.Builder().text("Buy").opaque(true).fontScaleFactor(0.2).hoverable(true).build();
this.setBackground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_THEME2)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Layout // Layout
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));

View File

@@ -31,7 +31,6 @@ import javax.swing.text.StyledDocument;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.bazaar.ControlStall; import forge.control.bazaar.ControlStall;
import forge.quest.data.bazaar.QuestStallDefinition; import forge.quest.data.bazaar.QuestStallDefinition;
import forge.quest.data.bazaar.QuestStallManager; import forge.quest.data.bazaar.QuestStallManager;
@@ -50,7 +49,6 @@ import forge.view.toolbox.FSkin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewStall extends JPanel { public class ViewStall extends JPanel {
private final FSkin skin;
private final FLabel lblStallName, lblEmpty, lblStats; private final FLabel lblStallName, lblEmpty, lblStats;
private final JTextPane tpnFluff; private final JTextPane tpnFluff;
private final JPanel pnlInventory; private final JPanel pnlInventory;
@@ -63,7 +61,6 @@ public class ViewStall extends JPanel {
/** @param v0 {@link forge.view.bazaar.BazaarTopLevel} */ /** @param v0 {@link forge.view.bazaar.BazaarTopLevel} */
protected ViewStall(final BazaarTopLevel v0) { protected ViewStall(final BazaarTopLevel v0) {
// Final/component inits // Final/component inits
this.skin = Singletons.getView().getSkin();
this.lblStallName = new FLabel.Builder().text("").fontAlign(SwingConstants.CENTER).build(); this.lblStallName = new FLabel.Builder().text("").fontAlign(SwingConstants.CENTER).build();
this.lblEmpty = new FLabel.Builder() this.lblEmpty = new FLabel.Builder()
.text("The merchant does not have anything useful for sale.") .text("The merchant does not have anything useful for sale.")
@@ -82,8 +79,8 @@ public class ViewStall extends JPanel {
this.setOpaque(false); this.setOpaque(false);
tpnFluff.setOpaque(false); tpnFluff.setOpaque(false);
tpnFluff.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); tpnFluff.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnFluff.setFont(skin.getItalicFont(15)); tpnFluff.setFont(FSkin.getItalicFont(15));
tpnFluff.setFocusable(false); tpnFluff.setFocusable(false);
tpnFluff.setEditable(false); tpnFluff.setEditable(false);
tpnFluff.setBorder(null); tpnFluff.setBorder(null);

View File

@@ -53,7 +53,6 @@ import forge.view.toolbox.FSkin;
public class HomeTopLevel extends FPanel { public class HomeTopLevel extends FPanel {
private JPanel pnlMenu, pnlContent; private JPanel pnlMenu, pnlContent;
private FButton btnDraft, btnConstructed, btnSealed, btnQuest, btnSettings, btnUtilities, btnExit, btnDeckEditor; private FButton btnDraft, btnConstructed, btnSealed, btnQuest, btnSettings, btnUtilities, btnExit, btnDeckEditor;
private FSkin skin;
private String constraints; private String constraints;
private ControlHomeUI control; private ControlHomeUI control;
@@ -72,7 +71,6 @@ public class HomeTopLevel extends FPanel {
*/ */
public HomeTopLevel() { public HomeTopLevel() {
super(); super();
skin = Singletons.getView().getSkin();
constructed = new ViewConstructed(this); constructed = new ViewConstructed(this);
sealed = new ViewSealed(this); sealed = new ViewSealed(this);
@@ -82,7 +80,7 @@ public class HomeTopLevel extends FPanel {
utilities = new ViewUtilities(this); utilities = new ViewUtilities(this);
this.setOpaque(false); this.setOpaque(false);
this.setBGTexture(skin.getIcon(FSkin.Backgrounds.BG_TEXTURE)); this.setBGTexture(FSkin.getIcon(FSkin.Backgrounds.BG_TEXTURE));
this.setLayout(null); this.setLayout(null);
this.addComponentListener(new ComponentAdapter() { this.addComponentListener(new ComponentAdapter() {
@Override @Override
@@ -102,10 +100,10 @@ public class HomeTopLevel extends FPanel {
pnlMenu = new FRoundedPanel(); pnlMenu = new FRoundedPanel();
pnlMenu.setLayout(new MigLayout("insets 0, gap 0, wrap")); pnlMenu.setLayout(new MigLayout("insets 0, gap 0, wrap"));
pnlMenu.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); pnlMenu.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
pnlContent = new FRoundedPanel(); pnlContent = new FRoundedPanel();
pnlContent.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); pnlContent.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
pnlContent.setLayout(new MigLayout("insets 0, gap 0")); pnlContent.setLayout(new MigLayout("insets 0, gap 0"));
btnConstructed = new FButton(); btnConstructed = new FButton();
@@ -161,7 +159,7 @@ public class HomeTopLevel extends FPanel {
add(pnlMenu, "w 36%!, h 96%!, gap 2% 2% 2% 2%"); add(pnlMenu, "w 36%!, h 96%!, gap 2% 2% 2% 2%");
add(pnlContent, "w 58%!, h 96%!, gap 0% 2% 2% 2%"); add(pnlContent, "w 58%!, h 96%!, gap 0% 2% 2% 2%");
JLabel lblIcon = new JLabel(skin.getIcon(FSkin.ForgeIcons.ICO_LOGO)); JLabel lblIcon = new JLabel(FSkin.getIcon(FSkin.ForgeIcons.ICO_LOGO));
pnlMenu.add(lblIcon, "gapleft 10%, ax center"); pnlMenu.add(lblIcon, "gapleft 10%, ax center");
constraints = "w 80%!, gapleft 10%, gaptop 1%, gapbottom 1%, h 40px!"; constraints = "w 80%!, gapleft 10%, gaptop 1%, gapbottom 1%, h 40px!";

View File

@@ -18,7 +18,6 @@ import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.gui.GuiUtils; import forge.gui.GuiUtils;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants; import forge.properties.NewConstants;
@@ -33,7 +32,6 @@ import forge.view.toolbox.FSkin;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class QuestFileLister extends JPanel { public class QuestFileLister extends JPanel {
private ImageIcon icoDelete, icoDeleteOver, icoEdit, icoEditOver; private ImageIcon icoDelete, icoDeleteOver, icoEdit, icoEditOver;
private FSkin skin;
private RowPanel previousSelect; private RowPanel previousSelect;
private RowPanel[] rows; private RowPanel[] rows;
private Command cmdRowSelect, cmdRowDelete, cmdRowEdit; private Command cmdRowSelect, cmdRowDelete, cmdRowEdit;
@@ -53,20 +51,19 @@ public class QuestFileLister extends JPanel {
*/ */
public QuestFileLister(final boolean deletable, final boolean editable) { public QuestFileLister(final boolean deletable, final boolean editable) {
super(); super();
this.skin = Singletons.getView().getSkin();
this.clrDefault = new Color(0, 0, 0, 0); this.clrDefault = new Color(0, 0, 0, 0);
this.clrHover = skin.getColor(FSkin.Colors.CLR_HOVER); this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrActive = skin.getColor(FSkin.Colors.CLR_ACTIVE); this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.clrBorders = skin.getColor(FSkin.Colors.CLR_BORDERS); this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, wrap")); this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
icoDelete = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE); icoDelete = FSkin.getIcon(FSkin.ForgeIcons.ICO_DELETE);
icoDeleteOver = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE_OVER); icoDeleteOver = FSkin.getIcon(FSkin.ForgeIcons.ICO_DELETE_OVER);
icoEdit = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT); icoEdit = FSkin.getIcon(FSkin.ForgeIcons.ICO_EDIT);
icoEditOver = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT_OVER); icoEditOver = FSkin.getIcon(FSkin.ForgeIcons.ICO_EDIT_OVER);
} }
/** @param qd0 &emsp; {@link forge.quest.data.QuestData}[] */ /** @param qd0 &emsp; {@link forge.quest.data.QuestData}[] */
@@ -86,7 +83,7 @@ public class QuestFileLister extends JPanel {
// Note: careful with the widths of the rows here; // Note: careful with the widths of the rows here;
// scroll panes will have difficulty dynamically resizing if 100% width is set. // scroll panes will have difficulty dynamically resizing if 100% width is set.
final JPanel rowTitle = new JPanel(); final JPanel rowTitle = new JPanel();
rowTitle.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA)); rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
rowTitle.setLayout(new MigLayout("insets 0, gap 0")); rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0"); rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0");
rowTitle.add(new FLabel.Builder().text("Rename").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0"); rowTitle.add(new FLabel.Builder().text("Rename").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0");

View File

@@ -25,7 +25,6 @@ import forge.view.toolbox.FSkin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class QuestPreferencesHandler extends JPanel { public class QuestPreferencesHandler extends JPanel {
private final FSkin skin;
private final QuestPreferences prefs; private final QuestPreferences prefs;
private final JPanel pnlDifficulty, pnlBooster, pnlRewards, pnlShop; private final JPanel pnlDifficulty, pnlBooster, pnlRewards, pnlShop;
private final FLabel lblErrRewards, lblErrBooster, lblErrDifficulty, lblErrShop; private final FLabel lblErrRewards, lblErrBooster, lblErrDifficulty, lblErrShop;
@@ -42,7 +41,6 @@ public class QuestPreferencesHandler extends JPanel {
public QuestPreferencesHandler() { public QuestPreferencesHandler() {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, wrap")); this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
this.skin = Singletons.getView().getSkin();
this.prefs = Singletons.getModel().getQuestPreferences(); this.prefs = Singletons.getModel().getQuestPreferences();
pnlRewards = new JPanel(); pnlRewards = new JPanel();
@@ -257,13 +255,13 @@ public class QuestPreferencesHandler extends JPanel {
this.qpref = qp0; this.qpref = qp0;
this.err = e0; this.err = e0;
this.clrHover = skin.getColor(FSkin.Colors.CLR_HOVER); this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrActive = skin.getColor(FSkin.Colors.CLR_ACTIVE); this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.clrText = skin.getColor(FSkin.Colors.CLR_TEXT); this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
this.setOpaque(false); this.setOpaque(false);
this.setBorder(null); this.setBorder(null);
this.setFont(skin.getFont(13)); this.setFont(FSkin.getFont(13));
this.setForeground(clrText); this.setForeground(clrText);
this.setCaretColor(clrText); this.setCaretColor(clrText);
this.setBackground(clrHover); this.setBackground(clrHover);

View File

@@ -62,12 +62,10 @@ public class SplashFrame extends JFrame {
* Create the frame; this <strong>must</strong> be called from an event * Create the frame; this <strong>must</strong> be called from an event
* dispatch thread. * dispatch thread.
* *
* @param skin &emsp; An FSkin object, must be passed here since it hasn't
* been set in the view yet.
* @throws Exception {@link IllegalStateException} if not called from an * @throws Exception {@link IllegalStateException} if not called from an
* event dispatch thread. * event dispatch thread.
*/ */
public SplashFrame(final FSkin skin) throws Exception { public SplashFrame() throws Exception {
super(); super();
if (!SwingUtilities.isEventDispatchThread()) { if (!SwingUtilities.isEventDispatchThread()) {
@@ -75,7 +73,7 @@ public class SplashFrame extends JFrame {
"SplashFrame() must be called from an event dispatch thread."); "SplashFrame() must be called from an event dispatch thread.");
} }
final ImageIcon bgIcon = skin.getIcon(FSkin.Backgrounds.BG_SPLASH); final ImageIcon bgIcon = FSkin.getIcon(FSkin.Backgrounds.BG_SPLASH);
final int splashWidthPx = bgIcon.getIconWidth(); final int splashWidthPx = bgIcon.getIconWidth();
final int splashHeightPx = bgIcon.getIconHeight(); final int splashHeightPx = bgIcon.getIconHeight();

View File

@@ -2,7 +2,6 @@ package forge.view.home;
import javax.swing.JButton; import javax.swing.JButton;
import forge.Singletons;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
/** /**
@@ -16,14 +15,13 @@ public class StartButton extends JButton {
*/ */
public StartButton(HomeTopLevel v0) { public StartButton(HomeTopLevel v0) {
super(); super();
final FSkin skin = Singletons.getView().getSkin();
setRolloverEnabled(true); setRolloverEnabled(true);
setRolloverIcon(skin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER)); setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
setOpaque(false); setOpaque(false);
setIcon(skin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP)); setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
setContentAreaFilled(false); setContentAreaFilled(false);
setBorder(null); setBorder(null);
setBorderPainted(false); setBorderPainted(false);
setPressedIcon(skin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN)); setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN));
} }
} }

View File

@@ -9,7 +9,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.control.home.ControlConstructed; import forge.control.home.ControlConstructed;
import forge.view.toolbox.FLabel; import forge.view.toolbox.FLabel;
import forge.view.toolbox.FList; import forge.view.toolbox.FList;
@@ -23,7 +22,6 @@ import forge.view.toolbox.FSkin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewConstructed extends JPanel { public class ViewConstructed extends JPanel {
private final FSkin skin;
private final HomeTopLevel parentView; private final HomeTopLevel parentView;
private final ControlConstructed control; private final ControlConstructed control;
private final JButton btnStart; private final JButton btnStart;
@@ -50,7 +48,6 @@ public class ViewConstructed extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, hidemode 2")); this.setLayout(new MigLayout("insets 0, gap 0, hidemode 2"));
parentView = v0; parentView = v0;
skin = Singletons.getView().getSkin();
populateHuman(); populateHuman();
@@ -84,26 +81,26 @@ public class ViewConstructed extends JPanel {
lstDecksHuman.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); lstDecksHuman.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
JLabel lblHuman = new JLabel("Choose your deck:"); JLabel lblHuman = new JLabel("Choose your deck:");
lblHuman.setFont(skin.getBoldFont(16)); lblHuman.setFont(FSkin.getBoldFont(16));
lblHuman.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblHuman.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblHuman.setHorizontalAlignment(SwingConstants.CENTER); lblHuman.setHorizontalAlignment(SwingConstants.CENTER);
JLabel lblColorInfo = new JLabel(colorsToolTip); JLabel lblColorInfo = new JLabel(colorsToolTip);
lblColorInfo.setToolTipText(colorsToolTip); lblColorInfo.setToolTipText(colorsToolTip);
lblColorInfo.setFont(skin.getItalicFont(12)); lblColorInfo.setFont(FSkin.getItalicFont(12));
lblColorInfo.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblColorInfo.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblColorInfo.setHorizontalAlignment(SwingConstants.CENTER); lblColorInfo.setHorizontalAlignment(SwingConstants.CENTER);
JLabel lblThemeInfo = new JLabel(themeToolTip); JLabel lblThemeInfo = new JLabel(themeToolTip);
lblThemeInfo.setToolTipText(themeToolTip); lblThemeInfo.setToolTipText(themeToolTip);
lblThemeInfo.setFont(skin.getItalicFont(12)); lblThemeInfo.setFont(FSkin.getItalicFont(12));
lblThemeInfo.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblThemeInfo.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblThemeInfo.setHorizontalAlignment(SwingConstants.CENTER); lblThemeInfo.setHorizontalAlignment(SwingConstants.CENTER);
JLabel lblDecklistInfo = new JLabel(decklistToolTip); JLabel lblDecklistInfo = new JLabel(decklistToolTip);
lblDecklistInfo.setToolTipText(decklistToolTip); lblDecklistInfo.setToolTipText(decklistToolTip);
lblDecklistInfo.setFont(skin.getItalicFont(12)); lblDecklistInfo.setFont(FSkin.getItalicFont(12));
lblDecklistInfo.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblDecklistInfo.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER); lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER);
// Random theme and pre-constructed buttons // Random theme and pre-constructed buttons
@@ -159,26 +156,26 @@ public class ViewConstructed extends JPanel {
lstDecksAI.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); lstDecksAI.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
JLabel lblAI = new JLabel("Choose a deck for the computer:"); JLabel lblAI = new JLabel("Choose a deck for the computer:");
lblAI.setFont(skin.getBoldFont(16)); lblAI.setFont(FSkin.getBoldFont(16));
lblAI.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblAI.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblAI.setHorizontalAlignment(SwingConstants.CENTER); lblAI.setHorizontalAlignment(SwingConstants.CENTER);
JLabel lblColorInfo = new JLabel(colorsToolTip); JLabel lblColorInfo = new JLabel(colorsToolTip);
lblColorInfo.setToolTipText(colorsToolTip); lblColorInfo.setToolTipText(colorsToolTip);
lblColorInfo.setFont(skin.getItalicFont(12)); lblColorInfo.setFont(FSkin.getItalicFont(12));
lblColorInfo.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblColorInfo.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblColorInfo.setHorizontalAlignment(SwingConstants.CENTER); lblColorInfo.setHorizontalAlignment(SwingConstants.CENTER);
JLabel lblThemeInfo = new JLabel(themeToolTip); JLabel lblThemeInfo = new JLabel(themeToolTip);
lblThemeInfo.setToolTipText(themeToolTip); lblThemeInfo.setToolTipText(themeToolTip);
lblThemeInfo.setFont(skin.getItalicFont(12)); lblThemeInfo.setFont(FSkin.getItalicFont(12));
lblThemeInfo.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblThemeInfo.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblThemeInfo.setHorizontalAlignment(SwingConstants.CENTER); lblThemeInfo.setHorizontalAlignment(SwingConstants.CENTER);
JLabel lblDecklistInfo = new JLabel(decklistToolTip); JLabel lblDecklistInfo = new JLabel(decklistToolTip);
lblDecklistInfo.setToolTipText(decklistToolTip); lblDecklistInfo.setToolTipText(decklistToolTip);
lblDecklistInfo.setFont(skin.getItalicFont(12)); lblDecklistInfo.setFont(FSkin.getItalicFont(12));
lblDecklistInfo.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblDecklistInfo.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER); lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER);
// Random theme and pre-constructed deck buttons // Random theme and pre-constructed deck buttons
@@ -300,7 +297,7 @@ public class ViewConstructed extends JPanel {
JLabel lblOr = new JLabel("OR"); JLabel lblOr = new JLabel("OR");
lblOr.setHorizontalAlignment(SwingConstants.CENTER); lblOr.setHorizontalAlignment(SwingConstants.CENTER);
lblOr.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblOr.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
add(lblOr, BorderLayout.CENTER); add(lblOr, BorderLayout.CENTER);
} }
} }

View File

@@ -18,7 +18,6 @@ import javax.swing.text.StyledDocument;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.control.home.ControlDraft; import forge.control.home.ControlDraft;
import forge.game.GameType; import forge.game.GameType;
import forge.view.toolbox.DeckLister; import forge.view.toolbox.DeckLister;
@@ -37,7 +36,6 @@ import forge.view.toolbox.FSkin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewDraft extends JPanel { public class ViewDraft extends JPanel {
private final FSkin skin;
private final ControlDraft control; private final ControlDraft control;
private final HomeTopLevel parentView; private final HomeTopLevel parentView;
private final JList lstAI; private final JList lstAI;
@@ -113,7 +111,6 @@ public class ViewDraft extends JPanel {
public ViewDraft(HomeTopLevel v0) { public ViewDraft(HomeTopLevel v0) {
super(); super();
this.parentView = v0; this.parentView = v0;
this.skin = Singletons.getView().getSkin();
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, hidemode 2")); this.setLayout(new MigLayout("insets 0, gap 0, hidemode 2"));
@@ -133,8 +130,8 @@ public class ViewDraft extends JPanel {
// Init directions text pane // Init directions text pane
tpnDirections = new JTextPane(); tpnDirections = new JTextPane();
tpnDirections.setOpaque(false); tpnDirections.setOpaque(false);
tpnDirections.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); tpnDirections.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnDirections.setFont(skin.getFont(15)); tpnDirections.setFont(FSkin.getFont(15));
tpnDirections.setAlignmentX(SwingConstants.CENTER); tpnDirections.setAlignmentX(SwingConstants.CENTER);
tpnDirections.setFocusable(false); tpnDirections.setFocusable(false);
tpnDirections.setEditable(false); tpnDirections.setEditable(false);
@@ -158,15 +155,15 @@ public class ViewDraft extends JPanel {
// Layout // Layout
final JLabel lblHuman = new JLabel("Select your deck: "); final JLabel lblHuman = new JLabel("Select your deck: ");
lblHuman.setFont(skin.getBoldFont(16)); lblHuman.setFont(FSkin.getBoldFont(16));
lblHuman.setHorizontalAlignment(SwingConstants.CENTER); lblHuman.setHorizontalAlignment(SwingConstants.CENTER);
lblHuman.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblHuman.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.add(lblHuman, "w 60%!, gap 5% 5% 2% 2%"); this.add(lblHuman, "w 60%!, gap 5% 5% 2% 2%");
final JLabel lblAI = new JLabel("Who will you play?"); final JLabel lblAI = new JLabel("Who will you play?");
lblAI.setFont(skin.getBoldFont(16)); lblAI.setFont(FSkin.getBoldFont(16));
lblAI.setHorizontalAlignment(SwingConstants.CENTER); lblAI.setHorizontalAlignment(SwingConstants.CENTER);
lblAI.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblAI.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.add(lblAI, "w 25%!, gap 0 0 2% 2%, wrap"); this.add(lblAI, "w 25%!, gap 0 0 2% 2%, wrap");
lstHumanDecks = new DeckLister(GameType.Draft, exit); lstHumanDecks = new DeckLister(GameType.Draft, exit);
@@ -179,9 +176,9 @@ public class ViewDraft extends JPanel {
this.add(btnBuildDeck, "w 60%!, h 5%!, gap 5% 5% 0 0, wrap"); this.add(btnBuildDeck, "w 60%!, h 5%!, gap 5% 5% 0 0, wrap");
lblDirections = new JLabel("Click For Directions"); lblDirections = new JLabel("Click For Directions");
lblDirections.setFont(skin.getFont(16)); lblDirections.setFont(FSkin.getFont(16));
lblDirections.setHorizontalAlignment(SwingConstants.CENTER); lblDirections.setHorizontalAlignment(SwingConstants.CENTER);
lblDirections.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblDirections.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.add(lblDirections, "alignx center, span 2 1, gap 5% 5% 5% 2%, wrap"); this.add(lblDirections, "alignx center, span 2 1, gap 5% 5% 5% 2%, wrap");
btnStart = new StartButton(parentView); btnStart = new StartButton(parentView);
@@ -208,8 +205,8 @@ public class ViewDraft extends JPanel {
}); });
btnClose.setText("Close"); btnClose.setText("Close");
pnlContainer.setBorder(new LineBorder(skin.getColor(FSkin.Colors.CLR_BORDERS), 1)); pnlContainer.setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1));
pnlContainer.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); pnlContainer.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
pnlContainer.setLayout(new MigLayout("insets 0, wrap")); pnlContainer.setLayout(new MigLayout("insets 0, wrap"));
pnlContainer.add(tpnDirections, "w 90%, gap 5% 0 20px 0, wrap"); pnlContainer.add(tpnDirections, "w 90%, gap 5% 0 20px 0, wrap");
pnlContainer.add(btnClose, "w 300px!, h 40px!, gap 0 0 20px 20px, alignx center"); pnlContainer.add(btnClose, "w 300px!, h 40px!, gap 0 0 20px 20px, alignx center");

View File

@@ -20,7 +20,6 @@ import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.home.ControlQuest; import forge.control.home.ControlQuest;
import forge.game.GameType; import forge.game.GameType;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
@@ -45,7 +44,6 @@ import forge.view.toolbox.SubTab;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewQuest extends JScrollPane { public class ViewQuest extends JScrollPane {
private final FSkin skin;
private final HomeTopLevel parentView; private final HomeTopLevel parentView;
private final ControlQuest control; private final ControlQuest control;
private final String eventPanelConstraints; private final String eventPanelConstraints;
@@ -84,8 +82,7 @@ public class ViewQuest extends JScrollPane {
// Non-final inits // Non-final inits
this.parentView = v0; this.parentView = v0;
this.skin = Singletons.getView().getSkin(); this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_THEME2);
this.clrBorders = skin.getColor(FSkin.Colors.CLR_THEME2);
this.eventPanelConstraints = "w 100%!, h 86px!, gap 0 0 5px 5px"; this.eventPanelConstraints = "w 100%!, h 86px!, gap 0 0 5px 5px";
// Final component inits // Final component inits
@@ -125,10 +122,10 @@ public class ViewQuest extends JScrollPane {
btnCurrentDeck = new FLabel.Builder().opaque(true).hoverable(true).build(); btnCurrentDeck = new FLabel.Builder().opaque(true).hoverable(true).build();
btnBazaar = new FLabel.Builder().selectable(true).opaque(true).hoverable(true).text("Bazaar") btnBazaar = new FLabel.Builder().selectable(true).opaque(true).hoverable(true).text("Bazaar")
.fontScaleAuto(false).tooltip("Peruse the Bazaar").build(); .fontScaleAuto(false).tooltip("Peruse the Bazaar").build();
btnBazaar.setFont(Singletons.getView().getSkin().getFont(14)); btnBazaar.setFont(FSkin.getFont(14));
btnSpellShop = new FLabel.Builder().opaque(true).hoverable(true).text("Spell Shop") btnSpellShop = new FLabel.Builder().opaque(true).hoverable(true).text("Spell Shop")
.fontScaleAuto(false).tooltip("Travel to the Spell Shop").build(); .fontScaleAuto(false).tooltip("Travel to the Spell Shop").build();
btnSpellShop.setFont(Singletons.getView().getSkin().getFont(14)); btnSpellShop.setFont(FSkin.getFont(14));
btnStart = new StartButton(parentView); btnStart = new StartButton(parentView);
btnEmbark = new FLabel.Builder().opaque(true).hoverable(true).text("Embark!").build(); btnEmbark = new FLabel.Builder().opaque(true).hoverable(true).text("Embark!").build();
btnNewDeck = new FLabel.Builder().opaque(true).hoverable(true).text("Build a New Deck").build(); btnNewDeck = new FLabel.Builder().opaque(true).hoverable(true).text("Build a New Deck").build();
@@ -208,7 +205,7 @@ public class ViewQuest extends JScrollPane {
/** Layout and details for Swing components in title panel. */ /** Layout and details for Swing components in title panel. */
private void populateTitle() { private void populateTitle() {
pnlTitle.setLayout(new MigLayout("insets 0, gap 0, align center")); pnlTitle.setLayout(new MigLayout("insets 0, gap 0, align center"));
pnlTitle.setBackground(skin.getColor(FSkin.Colors.CLR_THEME2)); pnlTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
((FRoundedPanel) pnlTitle).setBorderColor(clrBorders); ((FRoundedPanel) pnlTitle).setBorderColor(clrBorders);
pnlTitle.add(lblTitle, "w 98%!, h 70%!, gap 0 0 15%! 15%!"); pnlTitle.add(lblTitle, "w 98%!, h 70%!, gap 0 0 15%! 15%!");
@@ -219,10 +216,10 @@ public class ViewQuest extends JScrollPane {
pnlStats.setOpaque(false); pnlStats.setOpaque(false);
pnlStats.setBorder(new MatteBorder(1, 0, 1, 0, clrBorders)); pnlStats.setBorder(new MatteBorder(1, 0, 1, 0, clrBorders));
lblLife.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_LIFE)); lblLife.setIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_LIFE));
lblCredits.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_COINSTACK)); lblCredits.setIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_COINSTACK));
lblWins.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_PLUS)); lblWins.setIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_PLUS));
lblLosses.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_MINUS)); lblLosses.setIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_MINUS));
lblNextChallengeInWins.setText("No challenges available."); lblNextChallengeInWins.setText("No challenges available.");
} }
@@ -267,7 +264,7 @@ public class ViewQuest extends JScrollPane {
final FRoundedPanel pnl = new FRoundedPanel(); final FRoundedPanel pnl = new FRoundedPanel();
pnl.setLayout(new MigLayout("insets 0, align center")); pnl.setLayout(new MigLayout("insets 0, align center"));
pnl.setBorderColor(clrBorders); pnl.setBorderColor(clrBorders);
pnl.setBackground(skin.getColor(FSkin.Colors.CLR_THEME2)); pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnl.add(new FLabel.Builder().text("Load a previous Quest").build(), "h 95%!, gap 0 0 2.5% 0"); pnl.add(new FLabel.Builder().text("Load a previous Quest").build(), "h 95%!, gap 0 0 2.5% 0");
final FLabel lbl = new FLabel.Builder().text("To use quest files " final FLabel lbl = new FLabel.Builder().text("To use quest files "
@@ -292,7 +289,7 @@ public class ViewQuest extends JScrollPane {
final FRoundedPanel pnl1 = new FRoundedPanel(); final FRoundedPanel pnl1 = new FRoundedPanel();
pnl1.setLayout(new MigLayout("insets 0, align center")); pnl1.setLayout(new MigLayout("insets 0, align center"));
pnl1.setBorderColor(clrBorders); pnl1.setBorderColor(clrBorders);
pnl1.setBackground(skin.getColor(FSkin.Colors.CLR_THEME2)); pnl1.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnl1.add(new FLabel.Builder().text("Start a new quest").build(), "h 95%!, gap 0 0 2.5% 0"); pnl1.add(new FLabel.Builder().text("Start a new quest").build(), "h 95%!, gap 0 0 2.5% 0");
final ButtonGroup group1 = new ButtonGroup(); final ButtonGroup group1 = new ButtonGroup();
@@ -441,7 +438,7 @@ public class ViewQuest extends JScrollPane {
// Select first event. // Select first event.
selectedOpponent = (SelectablePanel) pnlDuels.getComponent(0); selectedOpponent = (SelectablePanel) pnlDuels.getComponent(0);
selectedOpponent.setBackground(skin.getColor(FSkin.Colors.CLR_ACTIVE)); selectedOpponent.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
} }
pnlStats.setVisible(true); pnlStats.setVisible(true);
@@ -470,7 +467,7 @@ public class ViewQuest extends JScrollPane {
if (pnlChallenges.getComponentCount() > 0) { if (pnlChallenges.getComponentCount() > 0) {
pnlStart.setVisible(true); pnlStart.setVisible(true);
selectedOpponent = (SelectablePanel) pnlChallenges.getComponent(0); selectedOpponent = (SelectablePanel) pnlChallenges.getComponent(0);
selectedOpponent.setBackground(skin.getColor(FSkin.Colors.CLR_ACTIVE)); selectedOpponent.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
} }
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@@ -525,7 +522,7 @@ public class ViewQuest extends JScrollPane {
btnCurrentDeck.setText(" Build, then select a deck in the \"Decks\" tab. "); btnCurrentDeck.setText(" Build, then select a deck in the \"Decks\" tab. ");
} }
else { else {
btnCurrentDeck.setBackground(skin.getColor(FSkin.Colors.CLR_INACTIVE)); btnCurrentDeck.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
btnCurrentDeck.setText("Current deck: " + control.getCurrentDeck().getName()); btnCurrentDeck.setText("Current deck: " + control.getCurrentDeck().getName());
} }
} }
@@ -538,9 +535,9 @@ public class ViewQuest extends JScrollPane {
/** @param e0 &emsp; QuestEvent */ /** @param e0 &emsp; QuestEvent */
public SelectablePanel(QuestEvent e0) { public SelectablePanel(QuestEvent e0) {
super(); super();
this.clrSelected = skin.getColor(FSkin.Colors.CLR_ACTIVE); this.clrSelected = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.clrDefault = skin.getColor(FSkin.Colors.CLR_INACTIVE); this.clrDefault = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
this.clrHover = skin.getColor(FSkin.Colors.CLR_HOVER); this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.event = e0; this.event = e0;
this.setBackground(clrDefault); this.setBackground(clrDefault);
@@ -551,7 +548,7 @@ public class ViewQuest extends JScrollPane {
final FLabel lblIcon = new FLabel.Builder().iconScaleFactor(1).build(); final FLabel lblIcon = new FLabel.Builder().iconScaleFactor(1).build();
if (!file.exists()) { if (!file.exists()) {
lblIcon.setIcon(skin.getIcon(FSkin.ForgeIcons.ICO_UNKNOWN)); lblIcon.setIcon(FSkin.getIcon(FSkin.ForgeIcons.ICO_UNKNOWN));
} }
else { else {
lblIcon.setIcon(new ImageIcon(file.toString())); lblIcon.setIcon(new ImageIcon(file.toString()));
@@ -594,7 +591,7 @@ public class ViewQuest extends JScrollPane {
// Description // Description
final FTextArea tarDesc = new FTextArea(); final FTextArea tarDesc = new FTextArea();
tarDesc.setText(event.getDescription()); tarDesc.setText(event.getDescription());
tarDesc.setFont(skin.getItalicFont(12)); tarDesc.setFont(FSkin.getItalicFont(12));
this.add(tarDesc, "w 80%!, h 30px!"); this.add(tarDesc, "w 80%!, h 30px!");
} }

View File

@@ -6,7 +6,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.control.home.ControlSealed; import forge.control.home.ControlSealed;
import forge.game.GameType; import forge.game.GameType;
import forge.view.toolbox.DeckLister; import forge.view.toolbox.DeckLister;
@@ -21,7 +20,6 @@ import forge.view.toolbox.FSkin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewSealed extends JPanel { public class ViewSealed extends JPanel {
private final FSkin skin;
private final HomeTopLevel parentView; private final HomeTopLevel parentView;
private final ControlSealed control; private final ControlSealed control;
private DeckLister lstHumanDecks; private DeckLister lstHumanDecks;
@@ -39,13 +37,12 @@ public class ViewSealed extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, hidemode 2, wrap")); this.setLayout(new MigLayout("insets 0, gap 0, hidemode 2, wrap"));
parentView = v0; parentView = v0;
skin = Singletons.getView().getSkin();
control = new ControlSealed(this); control = new ControlSealed(this);
// Title // Title
JLabel lblTitle = new JLabel("Select a deck for yourself, or build a new one: "); JLabel lblTitle = new JLabel("Select a deck for yourself, or build a new one: ");
lblTitle.setFont(skin.getBoldFont(14)); lblTitle.setFont(FSkin.getBoldFont(14));
lblTitle.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblTitle.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
// Deck lister // Deck lister

View File

@@ -50,7 +50,6 @@ import forge.view.toolbox.FSkin;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewSettings extends JScrollPane { public class ViewSettings extends JScrollPane {
private final ControlSettings control; private final ControlSettings control;
private final FSkin skin;
private final JPanel viewport; private final JPanel viewport;
private final FLabel btnReset; private final FLabel btnReset;
private HomeTopLevel parentView; private HomeTopLevel parentView;
@@ -72,7 +71,6 @@ public class ViewSettings extends JScrollPane {
public ViewSettings(final HomeTopLevel v0) { public ViewSettings(final HomeTopLevel v0) {
super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED); super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED);
skin = Singletons.getView().getSkin();
parentView = v0; parentView = v0;
viewport = new JPanel(); viewport = new JPanel();
viewport.setOpaque(false); viewport.setOpaque(false);
@@ -143,8 +141,8 @@ public class ViewSettings extends JScrollPane {
viewport.add(lblTitleGraphics, sectionConstraints); viewport.add(lblTitleGraphics, sectionConstraints);
lblTitleSkin = new FLabel.Builder().text("Choose Skin").build(); lblTitleSkin = new FLabel.Builder().text("Choose Skin").build();
lblTitleSkin.setFont(skin.getBoldFont(14)); lblTitleSkin.setFont(FSkin.getBoldFont(14));
lblTitleSkin.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblTitleSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
final JLabel lblNoteSkin = new NoteLabel("Various user-created themes for Forge backgrounds, fonts, and colors."); final JLabel lblNoteSkin = new NoteLabel("Various user-created themes for Forge backgrounds, fonts, and colors.");
viewport.add(lblTitleSkin, regularConstraints); viewport.add(lblTitleSkin, regularConstraints);
viewport.add(lblNoteSkin, regularConstraints); viewport.add(lblNoteSkin, regularConstraints);
@@ -234,9 +232,9 @@ public class ViewSettings extends JScrollPane {
public OptionsCheckBox(final String txt0) { public OptionsCheckBox(final String txt0) {
super(); super();
setText(txt0); setText(txt0);
setFont(skin.getBoldFont(12)); setFont(FSkin.getBoldFont(12));
setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
setBackground(skin.getColor(FSkin.Colors.CLR_HOVER)); setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
setOpaque(false); setOpaque(false);
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@@ -258,9 +256,9 @@ public class ViewSettings extends JScrollPane {
public OptionsRadio(final String txt0) { public OptionsRadio(final String txt0) {
super(); super();
setText(txt0); setText(txt0);
setFont(skin.getBoldFont(12)); setFont(FSkin.getBoldFont(12));
setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
setBackground(skin.getColor(FSkin.Colors.CLR_HOVER)); setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
setOpaque(false); setOpaque(false);
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@@ -299,10 +297,10 @@ public class ViewSettings extends JScrollPane {
private class SectionLabel extends JLabel { private class SectionLabel extends JLabel {
public SectionLabel(String txt0) { public SectionLabel(String txt0) {
super(txt0); super(txt0);
setBorder(new MatteBorder(0, 0, 1, 0, skin.getColor(FSkin.Colors.CLR_BORDERS))); setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
setHorizontalAlignment(SwingConstants.CENTER); setHorizontalAlignment(SwingConstants.CENTER);
setFont(skin.getBoldFont(16)); setFont(FSkin.getBoldFont(16));
setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
} }
@@ -310,8 +308,8 @@ public class ViewSettings extends JScrollPane {
private class NoteLabel extends JLabel { private class NoteLabel extends JLabel {
public NoteLabel(String txt0) { public NoteLabel(String txt0) {
super(txt0); super(txt0);
setFont(skin.getItalicFont(12)); setFont(FSkin.getItalicFont(12));
setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
} }
@@ -333,7 +331,7 @@ public class ViewSettings extends JScrollPane {
public KeyboardShortcutField(final Shortcut s0) { public KeyboardShortcutField(final Shortcut s0) {
super(); super();
this.setEditable(false); this.setEditable(false);
this.setFont(skin.getFont(14)); this.setFont(FSkin.getFont(14));
this.setCodeString(Singletons.getModel().getPreferences().getPref(s0.getPrefKey())); this.setCodeString(Singletons.getModel().getPreferences().getPref(s0.getPrefKey()));
this.addKeyListener(new KeyAdapter() { this.addKeyListener(new KeyAdapter() {
@@ -346,7 +344,7 @@ public class ViewSettings extends JScrollPane {
this.addFocusListener(new FocusAdapter() { this.addFocusListener(new FocusAdapter() {
@Override @Override
public void focusGained(final FocusEvent e) { public void focusGained(final FocusEvent e) {
KeyboardShortcutField.this.setBackground(skin.getColor(FSkin.Colors.CLR_ACTIVE)); KeyboardShortcutField.this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
} }
@Override @Override

View File

@@ -15,7 +15,6 @@ import javax.swing.text.StyledDocument;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.home.ControlUtilities; import forge.control.home.ControlUtilities;
import forge.view.toolbox.FButton; import forge.view.toolbox.FButton;
import forge.view.toolbox.FLabel; import forge.view.toolbox.FLabel;
@@ -31,7 +30,6 @@ import forge.view.toolbox.FSkin;
public class ViewUtilities extends JPanel { public class ViewUtilities extends JPanel {
private final HomeTopLevel parentView; private final HomeTopLevel parentView;
private final ControlUtilities control; private final ControlUtilities control;
private final FSkin skin;
private final JTextPane tpnLicensing; private final JTextPane tpnLicensing;
private final JLabel lblLicensing; private final JLabel lblLicensing;
@@ -62,7 +60,6 @@ public class ViewUtilities extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, wrap, ay center")); this.setLayout(new MigLayout("insets 0, gap 0, wrap, ay center"));
parentView = v0; parentView = v0;
skin = Singletons.getView().getSkin();
final String constraintsLBL = "w 90%!, h 20px!, gap 5% 0 3px 8px"; final String constraintsLBL = "w 90%!, h 20px!, gap 5% 0 3px 8px";
final String constraintsBTN = "h 30px!, w 50%!, gap 25% 0 0 0"; final String constraintsBTN = "h 30px!, w 50%!, gap 25% 0 0 0";
@@ -129,8 +126,8 @@ public class ViewUtilities extends JPanel {
tpnLicensing = new JTextPane(); tpnLicensing = new JTextPane();
tpnLicensing.setOpaque(false); tpnLicensing.setOpaque(false);
tpnLicensing.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); tpnLicensing.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnLicensing.setFont(skin.getFont(15)); tpnLicensing.setFont(FSkin.getFont(15));
tpnLicensing.setAlignmentX(SwingConstants.CENTER); tpnLicensing.setAlignmentX(SwingConstants.CENTER);
tpnLicensing.setFocusable(false); tpnLicensing.setFocusable(false);
tpnLicensing.setEditable(false); tpnLicensing.setEditable(false);
@@ -143,9 +140,9 @@ public class ViewUtilities extends JPanel {
doc.setParagraphAttributes(0, doc.getLength(), center, false); doc.setParagraphAttributes(0, doc.getLength(), center, false);
lblLicensing = new JLabel("Click For License Information"); lblLicensing = new JLabel("Click For License Information");
lblLicensing.setFont(skin.getFont(16)); lblLicensing.setFont(FSkin.getFont(16));
lblLicensing.setHorizontalAlignment(SwingConstants.CENTER); lblLicensing.setHorizontalAlignment(SwingConstants.CENTER);
lblLicensing.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblLicensing.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.add(lblLicensing, "alignx center, gap 5% 0 5% 0"); this.add(lblLicensing, "alignx center, gap 5% 0 5% 0");
control = new ControlUtilities(this); control = new ControlUtilities(this);
@@ -165,8 +162,8 @@ public class ViewUtilities extends JPanel {
}); });
btnClose.setText("Close"); btnClose.setText("Close");
pnlContainer.setBorder(new LineBorder(skin.getColor(FSkin.Colors.CLR_BORDERS), 1)); pnlContainer.setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1));
pnlContainer.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); pnlContainer.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
pnlContainer.setLayout(new MigLayout("insets 0, wrap")); pnlContainer.setLayout(new MigLayout("insets 0, wrap"));
pnlContainer.add(tpnLicensing, "w 90%, gap 5% 0 20px 0, wrap"); pnlContainer.add(tpnLicensing, "w 90%, gap 5% 0 20px 0, wrap");
pnlContainer.add(btnClose, "w 300px!, h 40px!, gap 0 0 20px 20px, alignx center"); pnlContainer.add(btnClose, "w 300px!, h 40px!, gap 0 0 20px 20px, alignx center");

View File

@@ -33,7 +33,6 @@ import javax.swing.JTextArea;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.ControlMatchUI; import forge.control.ControlMatchUI;
import forge.control.match.ControlDetail; import forge.control.match.ControlDetail;
import forge.control.match.ControlDock; import forge.control.match.ControlDock;
@@ -97,8 +96,8 @@ public class MatchTopLevel extends FPanel {
// Set properties // Set properties
this.setOpaque(false); this.setOpaque(false);
this.setBGTexture(Singletons.getView().getSkin().getIcon(FSkin.Backgrounds.BG_TEXTURE)); this.setBGTexture(FSkin.getIcon(FSkin.Backgrounds.BG_TEXTURE));
this.setBGImg(Singletons.getView().getSkin().getIcon(FSkin.Backgrounds.BG_MATCH)); this.setBGImg(FSkin.getIcon(FSkin.Backgrounds.BG_MATCH));
this.setLayout(null); this.setLayout(null);
b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2); b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2);

View File

@@ -70,7 +70,6 @@ public class QuestWinLoseHandler extends ControlWinLose {
private ImageIcon icoTemp; private ImageIcon icoTemp;
private JLabel lblTemp1; private JLabel lblTemp1;
private JLabel lblTemp2; private JLabel lblTemp2;
private FSkin skin;
private ViewWinLose view; private ViewWinLose view;
private boolean isAnte; private boolean isAnte;
@@ -102,7 +101,6 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qEvent = AllZone.getQuestEvent(); this.model.qEvent = AllZone.getQuestEvent();
this.model.qPrefs = Singletons.getModel().getQuestPreferences(); this.model.qPrefs = Singletons.getModel().getQuestPreferences();
this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName()); this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName());
this.skin = Singletons.getView().getSkin();
this.isAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE); this.isAnte = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE);
} }
@@ -469,13 +467,13 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qData.addCredits(credTotal); this.model.qData.addCredits(credTotal);
// Generate Swing components and attach. // Generate Swing components and attach.
this.icoTemp = GuiUtils.getResizedIcon(skin.getIcon(FSkin.QuestIcons.ICO_GOLD), 0.5); this.icoTemp = GuiUtils.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_GOLD), 0.5);
this.lblTemp1 = new TitleLabel("Gameplay Results"); this.lblTemp1 = new TitleLabel("Gameplay Results");
this.lblTemp2 = new JLabel(sb.toString()); this.lblTemp2 = new JLabel(sb.toString());
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER); this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
this.lblTemp2.setFont(skin.getFont(14)); this.lblTemp2.setFont(FSkin.getFont(14));
this.lblTemp2.setForeground(Color.white); this.lblTemp2.setForeground(Color.white);
this.lblTemp2.setIcon(this.icoTemp); this.lblTemp2.setIcon(this.icoTemp);
this.lblTemp2.setIconTextGap(50); this.lblTemp2.setIconTextGap(50);
@@ -584,12 +582,12 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qData.addCredits(questRewardCredits); this.model.qData.addCredits(questRewardCredits);
// Generate Swing components and attach. // Generate Swing components and attach.
this.icoTemp = GuiUtils.getResizedIcon(skin.getIcon(FSkin.QuestIcons.ICO_BOX), 0.5); this.icoTemp = GuiUtils.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOX), 0.5);
this.lblTemp1 = new TitleLabel("Challenge Rewards for \"" + ((QuestChallenge) this.model.qEvent).getTitle() this.lblTemp1 = new TitleLabel("Challenge Rewards for \"" + ((QuestChallenge) this.model.qEvent).getTitle()
+ "\""); + "\"");
this.lblTemp2 = new JLabel(sb.toString()); this.lblTemp2 = new JLabel(sb.toString());
this.lblTemp2.setFont(skin.getFont(14)); this.lblTemp2.setFont(FSkin.getFont(14));
this.lblTemp2.setForeground(Color.white); this.lblTemp2.setForeground(Color.white);
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER); this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
this.lblTemp2.setIconTextGap(50); this.lblTemp2.setIconTextGap(50);
@@ -607,12 +605,12 @@ public class QuestWinLoseHandler extends ControlWinLose {
private void penalizeLoss() { private void penalizeLoss() {
int x = Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.PENALTY_LOSS); int x = Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.PENALTY_LOSS);
this.icoTemp = GuiUtils.getResizedIcon(skin.getIcon(FSkin.QuestIcons.ICO_HEART), 0.5); this.icoTemp = GuiUtils.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_HEART), 0.5);
this.lblTemp1 = new TitleLabel("Gameplay Results"); this.lblTemp1 = new TitleLabel("Gameplay Results");
this.lblTemp2 = new JLabel("You lose! You have lost " + x + " credits."); this.lblTemp2 = new JLabel("You lose! You have lost " + x + " credits.");
this.lblTemp2.setFont(skin.getFont(14)); this.lblTemp2.setFont(FSkin.getFont(14));
this.lblTemp2.setForeground(Color.white); this.lblTemp2.setForeground(Color.white);
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER); this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
this.lblTemp2.setIconTextGap(50); this.lblTemp2.setIconTextGap(50);
@@ -696,7 +694,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
private class TitleLabel extends JLabel { private class TitleLabel extends JLabel {
TitleLabel(final String msg) { TitleLabel(final String msg) {
super(msg); super(msg);
this.setFont(skin.getFont(16)); this.setFont(FSkin.getFont(16));
this.setPreferredSize(new Dimension(200, 40)); this.setPreferredSize(new Dimension(200, 40));
this.setHorizontalAlignment(SwingConstants.CENTER); this.setHorizontalAlignment(SwingConstants.CENTER);
this.setForeground(Color.white); this.setForeground(Color.white);

View File

@@ -22,7 +22,6 @@ import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.control.match.ControlDetail; import forge.control.match.ControlDetail;
import forge.gui.game.CardDetailPanel; import forge.gui.game.CardDetailPanel;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -35,7 +34,6 @@ import forge.view.toolbox.FSkin;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewDetail extends FRoundedPanel { public class ViewDetail extends FRoundedPanel {
private ControlDetail control; private ControlDetail control;
private FSkin skin;
private CardDetailPanel pnlDetail; private CardDetailPanel pnlDetail;
/** /**
@@ -43,11 +41,10 @@ public class ViewDetail extends FRoundedPanel {
*/ */
public ViewDetail() { public ViewDetail() {
super(); super();
skin = Singletons.getView().getSkin();
pnlDetail = new CardDetailPanel(null); pnlDetail = new CardDetailPanel(null);
pnlDetail.setOpaque(false); pnlDetail.setOpaque(false);
this.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
add(pnlDetail, "w 100%!, h 100%!"); add(pnlDetail, "w 100%!, h 100%!");
@@ -58,7 +55,7 @@ public class ViewDetail extends FRoundedPanel {
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
int px = (int) (ViewDetail.this.getWidth() / 15); int px = (int) (ViewDetail.this.getWidth() / 15);
px = (px < 11 ? 11 : px); px = (px < 11 ? 11 : px);
Font font = skin.getFont(px); Font font = FSkin.getFont(px);
pnlDetail.getNameCostLabel().setFont(font); pnlDetail.getNameCostLabel().setFont(font);
pnlDetail.getTypeLabel().setFont(font); pnlDetail.getTypeLabel().setFont(font);
@@ -68,7 +65,7 @@ public class ViewDetail extends FRoundedPanel {
pnlDetail.getSetInfoLabel().setFont(font); pnlDetail.getSetInfoLabel().setFont(font);
pnlDetail.getCDArea().setFont(font); pnlDetail.getCDArea().setFont(font);
setFont(skin.getFont(px)); setFont(FSkin.getFont(px));
} }
}); });
} }

View File

@@ -34,7 +34,6 @@ import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.match.ControlDock; import forge.control.match.ControlDock;
import forge.view.toolbox.FButton; import forge.view.toolbox.FButton;
import forge.view.toolbox.FOverlay; import forge.view.toolbox.FOverlay;
@@ -47,7 +46,6 @@ import forge.view.toolbox.FSkin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewDock extends FRoundedPanel { public class ViewDock extends FRoundedPanel {
private final FSkin skin;
private final ControlDock control; private final ControlDock control;
private final Action actClose; private final Action actClose;
@@ -57,9 +55,8 @@ public class ViewDock extends FRoundedPanel {
*/ */
public ViewDock() { public ViewDock() {
super(); super();
this.skin = Singletons.getView().getSkin();
this.setToolTipText("Shortcut Button Dock"); this.setToolTipText("Shortcut Button Dock");
this.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
//this.setLayout(new MigLayout("insets 0, gap 0, ay center, ax center")); //this.setLayout(new MigLayout("insets 0, gap 0, ay center, ax center"));
// Mig layout does not support wrapping! // Mig layout does not support wrapping!
@@ -76,7 +73,7 @@ public class ViewDock extends FRoundedPanel {
} }
}; };
final JLabel btnConcede = new DockButton(skin.getIcon(FSkin.DockIcons.ICO_CONCEDE), "Concede Game"); final JLabel btnConcede = new DockButton(FSkin.getIcon(FSkin.DockIcons.ICO_CONCEDE), "Concede Game");
btnConcede.addMouseListener(new MouseAdapter() { btnConcede.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
@@ -84,7 +81,7 @@ public class ViewDock extends FRoundedPanel {
} }
}); });
final JLabel btnSettings = new DockButton(skin.getIcon(FSkin.DockIcons.ICO_SETTINGS), "Game Settings"); final JLabel btnSettings = new DockButton(FSkin.getIcon(FSkin.DockIcons.ICO_SETTINGS), "Game Settings");
btnSettings.addMouseListener(new MouseAdapter() { btnSettings.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
@@ -92,7 +89,7 @@ public class ViewDock extends FRoundedPanel {
} }
}); });
final JLabel btnEndTurn = new DockButton(skin.getIcon(FSkin.DockIcons.ICO_ENDTURN), "End Turn"); final JLabel btnEndTurn = new DockButton(FSkin.getIcon(FSkin.DockIcons.ICO_ENDTURN), "End Turn");
btnEndTurn.addMouseListener(new MouseAdapter() { btnEndTurn.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
@@ -100,7 +97,7 @@ public class ViewDock extends FRoundedPanel {
} }
}); });
final JLabel btnViewDeckList = new DockButton(skin.getIcon(FSkin.DockIcons.ICO_DECKLIST), "View Deck List"); final JLabel btnViewDeckList = new DockButton(FSkin.getIcon(FSkin.DockIcons.ICO_DECKLIST), "View Deck List");
btnViewDeckList.addMouseListener(new MouseAdapter() { btnViewDeckList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
@@ -132,7 +129,7 @@ public class ViewDock extends FRoundedPanel {
*/ */
public class DockButton extends JLabel { public class DockButton extends JLabel {
private final Image img; private final Image img;
private final Color hoverBG = ViewDock.this.skin.getColor(FSkin.Colors.CLR_HOVER); private final Color hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
private final Color defaultBG = new Color(0, 0, 0, 0); private final Color defaultBG = new Color(0, 0, 0, 0);
private Color clrBorders = new Color(0, 0, 0, 0); private Color clrBorders = new Color(0, 0, 0, 0);
private int w, h; private int w, h;
@@ -160,7 +157,7 @@ public class ViewDock extends FRoundedPanel {
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
DockButton.this.clrBorders = ViewDock.this.skin.getColor(FSkin.Colors.CLR_BORDERS); DockButton.this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
DockButton.this.setBackground(DockButton.this.hoverBG); DockButton.this.setBackground(DockButton.this.hoverBG);
} }

View File

@@ -41,7 +41,6 @@ import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.Constant.Zone; import forge.Constant.Zone;
import forge.Player; import forge.Player;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil; import forge.card.cardfactory.CardFactoryUtil;
import forge.card.mana.ManaPool; import forge.card.mana.ManaPool;
import forge.control.match.ControlField; import forge.control.match.ControlField;
@@ -60,8 +59,6 @@ import forge.view.toolbox.FSkin.SkinProp;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ViewField extends FRoundedPanel { public class ViewField extends FRoundedPanel {
private final FSkin skin;
private final ControlField control; private final ControlField control;
private final PlayArea tabletop; private final PlayArea tabletop;
@@ -88,21 +85,20 @@ public class ViewField extends FRoundedPanel {
*/ */
public ViewField(final Player player) { public ViewField(final Player player) {
super(); super();
this.skin = Singletons.getView().getSkin();
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
this.setCornerRadius(5); this.setCornerRadius(5);
this.setToolTipText(player.getName() + " Gameboard"); this.setToolTipText(player.getName() + " Gameboard");
this.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.inactiveBorder = new LineBorder(new Color(0, 0, 0, 0), 1); this.inactiveBorder = new LineBorder(new Color(0, 0, 0, 0), 1);
this.hoverBorder = new LineBorder(this.skin.getColor(FSkin.Colors.CLR_BORDERS), 1); this.hoverBorder = new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1);
this.clrHover = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER); this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrPhaseActiveEnabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_ACTIVE_ENABLED); this.clrPhaseActiveEnabled = FSkin.getColor(FSkin.Colors.CLR_PHASE_ACTIVE_ENABLED);
this.clrPhaseInactiveEnabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_INACTIVE_ENABLED); this.clrPhaseInactiveEnabled = FSkin.getColor(FSkin.Colors.CLR_PHASE_INACTIVE_ENABLED);
this.clrPhaseActiveDisabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_ACTIVE_DISABLED); this.clrPhaseActiveDisabled = FSkin.getColor(FSkin.Colors.CLR_PHASE_ACTIVE_DISABLED);
this.clrPhaseInactiveDisabled = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_PHASE_INACTIVE_DISABLED); this.clrPhaseInactiveDisabled = FSkin.getColor(FSkin.Colors.CLR_PHASE_INACTIVE_DISABLED);
// Player icon logic // Player icon logic
String filename; String filename;
@@ -125,14 +121,14 @@ public class ViewField extends FRoundedPanel {
iiTemp = (f.exists() iiTemp = (f.exists()
? new ImageIcon(filename) ? new ImageIcon(filename)
: skin.getIcon(FSkin.ForgeIcons.ICO_UNKNOWN)); : FSkin.getIcon(FSkin.ForgeIcons.ICO_UNKNOWN));
this.img = iiTemp.getImage(); this.img = iiTemp.getImage();
// Avatar and life // Avatar and life
avatarArea = new JPanel(); avatarArea = new JPanel();
avatarArea.setOpaque(false); avatarArea.setOpaque(false);
avatarArea.setBackground(skin.getColor(FSkin.Colors.CLR_HOVER)); avatarArea.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
avatarArea.setLayout(new MigLayout("insets 0, gap 0")); avatarArea.setLayout(new MigLayout("insets 0, gap 0"));
lblAvatar = new JLabel(); lblAvatar = new JLabel();
@@ -141,7 +137,7 @@ public class ViewField extends FRoundedPanel {
lblLife = new JLabel(); lblLife = new JLabel();
lblLife.setHorizontalAlignment(SwingConstants.CENTER); lblLife.setHorizontalAlignment(SwingConstants.CENTER);
lblLife.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblLife.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
avatarArea.add(lblLife, "w 100%!, h 30%!, gaptop 4%"); avatarArea.add(lblLife, "w 100%!, h 30%!, gaptop 4%");
this.add(avatarArea, "w 10%!, h 30%!"); this.add(avatarArea, "w 10%!, h 30%!");
@@ -157,7 +153,7 @@ public class ViewField extends FRoundedPanel {
final JScrollPane scroller = new JScrollPane(); final JScrollPane scroller = new JScrollPane();
this.tabletop = new PlayArea(scroller, player.equals(AllZone.getComputerPlayer()) ? true : false); this.tabletop = new PlayArea(scroller, player.equals(AllZone.getComputerPlayer()) ? true : false);
this.tabletop.setBorder(new MatteBorder(0, 1, 0, 0, this.skin.getColor(FSkin.Colors.CLR_BORDERS))); this.tabletop.setBorder(new MatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
this.tabletop.setOpaque(false); this.tabletop.setOpaque(false);
scroller.setViewportView(this.tabletop); scroller.setViewportView(this.tabletop);
@@ -180,7 +176,7 @@ public class ViewField extends FRoundedPanel {
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
int side = (int) (avatarArea.getHeight() * 0.7); int side = (int) (avatarArea.getHeight() * 0.7);
int size = (int) (avatarArea.getHeight() * 0.24); int size = (int) (avatarArea.getHeight() * 0.24);
lblLife.setFont(ViewField.this.skin.getBoldFont(size)); lblLife.setFont(FSkin.getBoldFont(size));
lblAvatar.setIcon(new ImageIcon(img.getScaledInstance(side, side, java.awt.Image.SCALE_SMOOTH))); lblAvatar.setIcon(new ImageIcon(img.getScaledInstance(side, side, java.awt.Image.SCALE_SMOOTH)));
} }
}); });
@@ -278,11 +274,11 @@ public class ViewField extends FRoundedPanel {
final JPanel row5 = new JPanel(new MigLayout("insets 0, gap 0")); final JPanel row5 = new JPanel(new MigLayout("insets 0, gap 0"));
final JPanel row6 = new JPanel(new MigLayout("insets 0, gap 0")); final JPanel row6 = new JPanel(new MigLayout("insets 0, gap 0"));
row1.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA)); row1.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row2.setOpaque(false); row2.setOpaque(false);
row3.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA)); row3.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row4.setOpaque(false); row4.setOpaque(false);
row5.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA)); row5.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row6.setOpaque(false); row6.setOpaque(false);
// Hand, library, graveyard, exile, flashback, poison labels // Hand, library, graveyard, exile, flashback, poison labels
@@ -369,14 +365,14 @@ public class ViewField extends FRoundedPanel {
this.getLblLife().setForeground(Color.red); this.getLblLife().setForeground(Color.red);
} }
else { else {
this.getLblLife().setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); this.getLblLife().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
if (p0.getPoisonCounters() >= 8) { if (p0.getPoisonCounters() >= 8) {
this.getLblPoison().setForeground(Color.red); this.getLblPoison().setForeground(Color.red);
} }
else { else {
this.getLblPoison().setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); this.getLblPoison().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
//mana pool //mana pool
@@ -547,7 +543,7 @@ public class ViewField extends FRoundedPanel {
// ========== Custom class handling // ========== Custom class handling
private FLabel getBuiltFLabel(SkinProp p0, String s0, String s1) { private FLabel getBuiltFLabel(SkinProp p0, String s0, String s1) {
return new FLabel.Builder().icon(new ImageIcon(skin.getImage(p0))) return new FLabel.Builder().icon(new ImageIcon(FSkin.getImage(p0)))
.opaque(false).fontScaleFactor(0.5).iconAlpha(0.6f).iconInBackground(true) .opaque(false).fontScaleFactor(0.5).iconAlpha(0.6f).iconInBackground(true)
.text(s0).tooltip(s1).fontAlign(SwingConstants.RIGHT).build(); .text(s0).tooltip(s1).fontAlign(SwingConstants.RIGHT).build();
} }

View File

@@ -21,7 +21,6 @@ import javax.swing.JScrollPane;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import arcane.ui.HandArea; import arcane.ui.HandArea;
import forge.Singletons;
import forge.control.match.ControlHand; import forge.control.match.ControlHand;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -44,7 +43,7 @@ public class ViewHand extends FRoundedPanel {
public ViewHand(MatchTopLevel v0) { public ViewHand(MatchTopLevel v0) {
final JScrollPane scroller = new JScrollPane(); final JScrollPane scroller = new JScrollPane();
ViewHand.this.hand = new HandArea(scroller); ViewHand.this.hand = new HandArea(scroller);
ViewHand.this.setBackground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_THEME)); ViewHand.this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
topLevel = v0; topLevel = v0;
scroller.setViewportView(ViewHand.this.hand); scroller.setViewportView(ViewHand.this.hand);

View File

@@ -31,7 +31,6 @@ import javax.swing.Timer;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.control.match.ControlInput; import forge.control.match.ControlInput;
import forge.view.toolbox.FButton; import forge.view.toolbox.FButton;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -46,7 +45,6 @@ public class ViewInput extends FRoundedPanel {
private final ControlInput control; private final ControlInput control;
private final JButton btnOK, btnCancel; private final JButton btnOK, btnCancel;
private final JTextArea tarMessage; private final JTextArea tarMessage;
private final FSkin skin;
private final JLabel lblGames; private final JLabel lblGames;
private Timer timer1 = null; private Timer timer1 = null;
private static int counter = 0; private static int counter = 0;
@@ -58,10 +56,9 @@ public class ViewInput extends FRoundedPanel {
*/ */
public ViewInput() { public ViewInput() {
super(); super();
this.skin = Singletons.getView().getSkin();
this.setToolTipText("Input Area"); this.setToolTipText("Input Area");
this.setBackground(this.skin.getColor(FSkin.Colors.CLR_THEME)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.setForeground(this.skin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setLayout(new MigLayout("wrap 2, fill, insets 0, gap 0")); this.setLayout(new MigLayout("wrap 2, fill, insets 0, gap 0"));
// Cancel button // Cancel button
@@ -70,10 +67,10 @@ public class ViewInput extends FRoundedPanel {
// Game counter // Game counter
lblGames = new JLabel(); lblGames = new JLabel();
lblGames.setFont(skin.getBoldFont(12)); lblGames.setFont(FSkin.getBoldFont(12));
lblGames.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblGames.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblGames.setHorizontalAlignment(SwingConstants.CENTER); lblGames.setHorizontalAlignment(SwingConstants.CENTER);
lblGames.setBorder(new MatteBorder(0, 0, 1, 0, skin.getColor(FSkin.Colors.CLR_BORDERS))); lblGames.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
this.tarMessage = new JTextArea(); this.tarMessage = new JTextArea();
this.tarMessage.setOpaque(false); this.tarMessage.setOpaque(false);
@@ -81,8 +78,8 @@ public class ViewInput extends FRoundedPanel {
this.tarMessage.setEditable(false); this.tarMessage.setEditable(false);
this.tarMessage.setLineWrap(true); this.tarMessage.setLineWrap(true);
this.tarMessage.setWrapStyleWord(true); this.tarMessage.setWrapStyleWord(true);
this.tarMessage.setForeground(this.skin.getColor(FSkin.Colors.CLR_TEXT)); this.tarMessage.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.tarMessage.setFont(this.skin.getFont(16)); this.tarMessage.setFont(FSkin.getFont(16));
this.add(this.lblGames, "span 2 1, w 96%!, gapleft 2%, h 10%, wrap"); this.add(this.lblGames, "span 2 1, w 96%!, gapleft 2%, h 10%, wrap");
this.add(this.tarMessage, "span 2 1, h 70%!, w 96%!, gapleft 2%, gaptop 1%"); this.add(this.tarMessage, "span 2 1, h 70%!, w 96%!, gapleft 2%, gaptop 1%");
this.add(this.btnOK, "w 47%!, gapright 2%, gapleft 1%"); this.add(this.btnOK, "w 47%!, gapright 2%, gapleft 1%");
@@ -94,7 +91,7 @@ public class ViewInput extends FRoundedPanel {
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
int px = (int) (ViewInput.this.getWidth() / 17); int px = (int) (ViewInput.this.getWidth() / 17);
px = (px < 11 ? 11 : px); px = (px < 11 ? 11 : px);
tarMessage.setFont(Singletons.getView().getSkin().getFont(px)); tarMessage.setFont(FSkin.getFont(px));
} }
}); });
// After all components are in place, instantiate controller. // After all components are in place, instantiate controller.

View File

@@ -18,7 +18,6 @@
package forge.view.match; package forge.view.match;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.control.match.ControlPicture; import forge.control.match.ControlPicture;
import forge.gui.game.CardPicturePanel; import forge.gui.game.CardPicturePanel;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -42,7 +41,7 @@ public class ViewPicture extends FRoundedPanel {
pnlPicture = new CardPicturePanel(null); pnlPicture = new CardPicturePanel(null);
pnlPicture.setOpaque(false); pnlPicture.setOpaque(false);
this.setBackground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_THEME)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.setLayout(new MigLayout("insets 0, gap 0, center")); this.setLayout(new MigLayout("insets 0, gap 0, center"));
add(pnlPicture, "w 100%!, h 100%!"); add(pnlPicture, "w 100%!, h 100%!");

View File

@@ -83,7 +83,6 @@ public class ViewTabber extends FRoundedPanel {
private List<JLabel> devLBLs; private List<JLabel> devLBLs;
private final ControlTabber control; private final ControlTabber control;
private final FSkin skin;
private TriggerReactionMenu triggerMenu; private TriggerReactionMenu triggerMenu;
private final FPanel pnlStack, pnlCombat, pnlConsole, pnlPlayers, pnlDev; private final FPanel pnlStack, pnlCombat, pnlConsole, pnlPlayers, pnlDev;
@@ -98,10 +97,9 @@ public class ViewTabber extends FRoundedPanel {
* Assembles Swing components for tabber area in sidebar. * Assembles Swing components for tabber area in sidebar.
*/ */
public ViewTabber() { public ViewTabber() {
this.skin = Singletons.getView().getSkin(); this.hoverColor = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.hoverColor = this.skin.getColor(FSkin.Colors.CLR_HOVER); this.activeColor = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.activeColor = this.skin.getColor(FSkin.Colors.CLR_ACTIVE); this.inactiveColor = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
this.inactiveColor = this.skin.getColor(FSkin.Colors.CLR_INACTIVE);
// Assemble card pic viewer // Assemble card pic viewer
this.panelList = new ArrayList<JPanel>(); this.panelList = new ArrayList<JPanel>();
@@ -158,7 +156,7 @@ public class ViewTabber extends FRoundedPanel {
this.populatePnlConsole(); this.populatePnlConsole();
this.vtpTabber = new FVerticalTabPanel(this.panelList); this.vtpTabber = new FVerticalTabPanel(this.panelList);
this.setBackground(skin.getColor(FSkin.Colors.CLR_THEME)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
this.add(vtpTabber, "w 97%!, h 100%!, gapleft 2%"); this.add(vtpTabber, "w 97%!, h 100%!, gapleft 2%");
@@ -177,34 +175,34 @@ public class ViewTabber extends FRoundedPanel {
JLabel[] labels = (JLabel[]) it.next().getValue(); JLabel[] labels = (JLabel[]) it.next().getValue();
for (x = 0; x < labels.length; x++) { for (x = 0; x < labels.length; x++) {
if (x > 0) { if (x > 0) {
labels[x].setFont(skin.getFont(regular)); labels[x].setFont(FSkin.getFont(regular));
} else { } else {
labels[x].setFont(skin.getFont(big)); labels[x].setFont(FSkin.getFont(big));
} }
} }
} }
// Storm label // Storm label
stormLabel.setFont(skin.getFont(big)); stormLabel.setFont(FSkin.getFont(big));
// Stack text areas // Stack text areas
for (JTextArea tar : stackTARs) { for (JTextArea tar : stackTARs) {
tar.setFont(skin.getFont(big)); tar.setFont(FSkin.getFont(big));
} }
// Combat text areas // Combat text areas
for (JTextArea tar : combatTARs) { for (JTextArea tar : combatTARs) {
tar.setFont(skin.getFont(big)); tar.setFont(FSkin.getFont(big));
} }
// Console text areas // Console text areas
for (JTextArea tar : consoleTARs) { for (JTextArea tar : consoleTARs) {
tar.setFont(skin.getFont(big)); tar.setFont(FSkin.getFont(big));
} }
// Devmode Labels // Devmode Labels
for (JLabel lbl : devLBLs) { for (JLabel lbl : devLBLs) {
lbl.setFont(skin.getFont(regular)); lbl.setFont(FSkin.getFont(regular));
} }
} }
}); });
@@ -240,7 +238,7 @@ public class ViewTabber extends FRoundedPanel {
this.vtpTabber.getAllVTabs().get(ControlTabber.STACK_PANEL).setText("Stack : " + stack.size()); this.vtpTabber.getAllVTabs().get(ControlTabber.STACK_PANEL).setText("Stack : " + stack.size());
// final Border border = new LineBorder(this.skin.getClrBorders(), 1); // final Border border = new LineBorder(FSkin.getClrBorders(), 1);
final Border border = new EmptyBorder(5, 5, 5, 5); final Border border = new EmptyBorder(5, 5, 5, 5);
Color[] scheme; Color[] scheme;
@@ -334,7 +332,7 @@ public class ViewTabber extends FRoundedPanel {
return new Color[] { new Color(111, 75, 43), Color.white }; return new Color[] { new Color(111, 75, 43), Color.white };
} }
return new Color[] { new Color(0, 0, 0, 0), skin.getColor(FSkin.Colors.CLR_TEXT) }; return new Color[] { new Color(0, 0, 0, 0), FSkin.getColor(FSkin.Colors.CLR_TEXT) };
} }
/** /**
@@ -358,7 +356,7 @@ public class ViewTabber extends FRoundedPanel {
this.combatTARs.clear(); this.combatTARs.clear();
this.control.showPnlCombat(); this.control.showPnlCombat();
final Border border = new MatteBorder(0, 0, 0, 0, skin.getColor(FSkin.Colors.CLR_BORDERS)); final Border border = new MatteBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
this.vtpTabber.getAllVTabs().get(ControlTabber.COMBAT_PANEL) this.vtpTabber.getAllVTabs().get(ControlTabber.COMBAT_PANEL)
.setText("Combat : " + AllZone.getCombat().getAttackers().length); .setText("Combat : " + AllZone.getCombat().getAttackers().length);
@@ -366,7 +364,7 @@ public class ViewTabber extends FRoundedPanel {
final JTextArea tar = new JTextArea(s); final JTextArea tar = new JTextArea(s);
tar.setOpaque(false); tar.setOpaque(false);
tar.setBorder(border); tar.setBorder(border);
tar.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setFocusable(false); tar.setFocusable(false);
tar.setLineWrap(true); tar.setLineWrap(true);
this.pnlCombat.add(tar, "w 95%!, gapleft 3%, gaptop 1%, h 95%"); this.pnlCombat.add(tar, "w 95%!, gapleft 3%, gaptop 1%, h 95%");
@@ -382,7 +380,7 @@ public class ViewTabber extends FRoundedPanel {
this.pnlConsole.removeAll(); this.pnlConsole.removeAll();
// final Border border = new MatteBorder(0, 0, 0, 0, // final Border border = new MatteBorder(0, 0, 0, 0,
// this.skin.getClrBorders()); // FSkin.getClrBorders());
// by default, grab everything logging level 3 or less // by default, grab everything logging level 3 or less
// TODO - some option to make this configurable is probably desirable // TODO - some option to make this configurable is probably desirable
@@ -390,7 +388,7 @@ public class ViewTabber extends FRoundedPanel {
JTextArea tar = new JTextArea(gl.getLogText(3)); JTextArea tar = new JTextArea(gl.getLogText(3));
tar.setOpaque(false); tar.setOpaque(false);
// tar.setBorder(border); // tar.setBorder(border);
tar.setForeground(this.skin.getColor(FSkin.Colors.CLR_TEXT)); tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setFocusable(false); tar.setFocusable(false);
tar.setEditable(false); tar.setEditable(false);
@@ -600,7 +598,7 @@ public class ViewTabber extends FRoundedPanel {
this.infoLBLs.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords, antes }); this.infoLBLs.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords, antes });
// Set border on bottom label, and larger font on player name // Set border on bottom label, and larger font on player name
antes.setBorder(new MatteBorder(0, 0, 1, 0, this.skin.getColor(FSkin.Colors.CLR_BORDERS))); antes.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
name.setText(p.getName()); name.setText(p.getName());
// Add to "players" tab panel // Add to "players" tab panel
@@ -680,8 +678,8 @@ public class ViewTabber extends FRoundedPanel {
log.setWrapStyleWord(true); log.setWrapStyleWord(true);
log.setEditable(false); log.setEditable(false);
log.setFocusable(false); log.setFocusable(false);
log.setForeground(this.skin.getColor(FSkin.Colors.CLR_TEXT)); log.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
log.setBorder(new MatteBorder(1, 0, 0, 0, this.skin.getColor(FSkin.Colors.CLR_BORDERS))); log.setBorder(new MatteBorder(1, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
log.setText("No log information yet. Input codes entered above. " + "Output data recorded below."); log.setText("No log information yet. Input codes entered above. " + "Output data recorded below.");
@@ -746,7 +744,7 @@ public class ViewTabber extends FRoundedPanel {
this.r = 6; // Radius (for paintComponent) this.r = 6; // Radius (for paintComponent)
this.i = 2; // Insets (for paintComponent) this.i = 2; // Insets (for paintComponent)
this.setEnabled(true); this.setEnabled(true);
this.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@Override @Override
@@ -836,7 +834,7 @@ public class ViewTabber extends FRoundedPanel {
private class InfoLabel extends JLabel { private class InfoLabel extends JLabel {
public InfoLabel() { public InfoLabel() {
super(); super();
this.setForeground(ViewTabber.this.skin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
} }

View File

@@ -13,7 +13,6 @@ import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.PhaseHandler; import forge.PhaseHandler;
import forge.Player; import forge.Player;
import forge.Singletons;
import forge.control.match.ControlWinLose; import forge.control.match.ControlWinLose;
import forge.game.GameType; import forge.game.GameType;
import forge.model.FMatchState; import forge.model.FMatchState;
@@ -34,7 +33,6 @@ public class ViewWinLose {
private final FButton btnContinue, btnRestart, btnQuit; private final FButton btnContinue, btnRestart, btnQuit;
private final JPanel pnlCustom; private final JPanel pnlCustom;
private final FTextArea txtLog; private final FTextArea txtLog;
private final FSkin skin;
/** */ /** */
public ViewWinLose() { public ViewWinLose() {
@@ -53,8 +51,6 @@ public class ViewWinLose {
btnRestart = new FButton(); btnRestart = new FButton();
btnQuit = new FButton(); btnQuit = new FButton();
skin = Singletons.getView().getSkin();
// Control of the win/lose is handled differently for various game modes. // Control of the win/lose is handled differently for various game modes.
ControlWinLose control; ControlWinLose control;
if (Constant.Runtime.getGameType() == GameType.Quest) { if (Constant.Runtime.getGameType() == GameType.Quest) {
@@ -75,18 +71,18 @@ public class ViewWinLose {
lblTitle.setForeground(Color.white); lblTitle.setForeground(Color.white);
lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
lblTitle.setFont(skin.getFont().deriveFont(Font.BOLD, 30)); lblTitle.setFont(FSkin.getFont().deriveFont(Font.BOLD, 30));
lblStats.setForeground(Color.white); lblStats.setForeground(Color.white);
lblStats.setHorizontalAlignment(SwingConstants.CENTER); lblStats.setHorizontalAlignment(SwingConstants.CENTER);
lblStats.setFont(skin.getFont().deriveFont(Font.PLAIN, 26)); lblStats.setFont(FSkin.getFont().deriveFont(Font.PLAIN, 26));
btnContinue.setText(ForgeProps.getLocalized(WinLoseText.CONTINUE)); btnContinue.setText(ForgeProps.getLocalized(WinLoseText.CONTINUE));
btnContinue.setFont(skin.getFont(22)); btnContinue.setFont(FSkin.getFont(22));
btnRestart.setText(ForgeProps.getLocalized(WinLoseText.RESTART)); btnRestart.setText(ForgeProps.getLocalized(WinLoseText.RESTART));
btnRestart.setFont(skin.getFont(22)); btnRestart.setFont(FSkin.getFont(22));
btnQuit.setText(ForgeProps.getLocalized(WinLoseText.QUIT)); btnQuit.setText(ForgeProps.getLocalized(WinLoseText.QUIT));
btnQuit.setFont(skin.getFont(22)); btnQuit.setFont(FSkin.getFont(22));
// End game and set state of "continue" button // End game and set state of "continue" button
PhaseHandler.setGameBegins(0); PhaseHandler.setGameBegins(0);
@@ -114,7 +110,7 @@ public class ViewWinLose {
// Assemble game log scroller. // Assemble game log scroller.
txtLog = new FTextArea(); txtLog = new FTextArea();
txtLog.setText(AllZone.getGameLog().getLogText()); txtLog.setText(AllZone.getGameLog().getLogText());
txtLog.setFont(skin.getFont(14)); txtLog.setFont(FSkin.getFont(14));
// Add all components accordingly. // Add all components accordingly.
overlay.removeAll(); overlay.removeAll();

View File

@@ -27,8 +27,6 @@ import arcane.ui.util.UI;
import com.esotericsoftware.minlog.Log; import com.esotericsoftware.minlog.Log;
import forge.Singletons;
/** /**
* <p> * <p>
* CardFaceSymbols class. * CardFaceSymbols class.
@@ -47,75 +45,74 @@ public class CardFaceSymbols {
* </p> * </p>
*/ */
public static void loadImages() { public static void loadImages() {
final FSkin skin = Singletons.getView().getSkin(); MANA_IMAGES.put("0", FSkin.getImage(FSkin.ColorlessManaImages.IMG_0, 13, 13));
MANA_IMAGES.put("0", skin.getImage(FSkin.ColorlessManaImages.IMG_0, 13, 13)); MANA_IMAGES.put("1", FSkin.getImage(FSkin.ColorlessManaImages.IMG_1, 13, 13));
MANA_IMAGES.put("1", skin.getImage(FSkin.ColorlessManaImages.IMG_1, 13, 13)); MANA_IMAGES.put("2", FSkin.getImage(FSkin.ColorlessManaImages.IMG_2, 13, 13));
MANA_IMAGES.put("2", skin.getImage(FSkin.ColorlessManaImages.IMG_2, 13, 13)); MANA_IMAGES.put("3", FSkin.getImage(FSkin.ColorlessManaImages.IMG_3, 13, 13));
MANA_IMAGES.put("3", skin.getImage(FSkin.ColorlessManaImages.IMG_3, 13, 13)); MANA_IMAGES.put("4", FSkin.getImage(FSkin.ColorlessManaImages.IMG_4, 13, 13));
MANA_IMAGES.put("4", skin.getImage(FSkin.ColorlessManaImages.IMG_4, 13, 13)); MANA_IMAGES.put("5", FSkin.getImage(FSkin.ColorlessManaImages.IMG_5, 13, 13));
MANA_IMAGES.put("5", skin.getImage(FSkin.ColorlessManaImages.IMG_5, 13, 13)); MANA_IMAGES.put("6", FSkin.getImage(FSkin.ColorlessManaImages.IMG_6, 13, 13));
MANA_IMAGES.put("6", skin.getImage(FSkin.ColorlessManaImages.IMG_6, 13, 13)); MANA_IMAGES.put("7", FSkin.getImage(FSkin.ColorlessManaImages.IMG_7, 13, 13));
MANA_IMAGES.put("7", skin.getImage(FSkin.ColorlessManaImages.IMG_7, 13, 13)); MANA_IMAGES.put("8", FSkin.getImage(FSkin.ColorlessManaImages.IMG_8, 13, 13));
MANA_IMAGES.put("8", skin.getImage(FSkin.ColorlessManaImages.IMG_8, 13, 13)); MANA_IMAGES.put("9", FSkin.getImage(FSkin.ColorlessManaImages.IMG_9, 13, 13));
MANA_IMAGES.put("9", skin.getImage(FSkin.ColorlessManaImages.IMG_9, 13, 13)); MANA_IMAGES.put("10", FSkin.getImage(FSkin.ColorlessManaImages.IMG_10, 13, 13));
MANA_IMAGES.put("10", skin.getImage(FSkin.ColorlessManaImages.IMG_10, 13, 13)); MANA_IMAGES.put("11", FSkin.getImage(FSkin.ColorlessManaImages.IMG_11, 13, 13));
MANA_IMAGES.put("11", skin.getImage(FSkin.ColorlessManaImages.IMG_11, 13, 13)); MANA_IMAGES.put("12", FSkin.getImage(FSkin.ColorlessManaImages.IMG_12, 13, 13));
MANA_IMAGES.put("12", skin.getImage(FSkin.ColorlessManaImages.IMG_12, 13, 13)); MANA_IMAGES.put("15", FSkin.getImage(FSkin.ColorlessManaImages.IMG_15, 13, 13));
MANA_IMAGES.put("15", skin.getImage(FSkin.ColorlessManaImages.IMG_15, 13, 13)); MANA_IMAGES.put("16", FSkin.getImage(FSkin.ColorlessManaImages.IMG_16, 13, 13));
MANA_IMAGES.put("16", skin.getImage(FSkin.ColorlessManaImages.IMG_16, 13, 13)); MANA_IMAGES.put("20", FSkin.getImage(FSkin.ColorlessManaImages.IMG_20, 13, 13));
MANA_IMAGES.put("20", skin.getImage(FSkin.ColorlessManaImages.IMG_20, 13, 13)); MANA_IMAGES.put("X", FSkin.getImage(FSkin.ColorlessManaImages.IMG_X, 13, 13));
MANA_IMAGES.put("X", skin.getImage(FSkin.ColorlessManaImages.IMG_X, 13, 13)); MANA_IMAGES.put("Y", FSkin.getImage(FSkin.ColorlessManaImages.IMG_Y, 13, 13));
MANA_IMAGES.put("Y", skin.getImage(FSkin.ColorlessManaImages.IMG_Y, 13, 13)); MANA_IMAGES.put("Z", FSkin.getImage(FSkin.ColorlessManaImages.IMG_Z, 13, 13));
MANA_IMAGES.put("Z", skin.getImage(FSkin.ColorlessManaImages.IMG_Z, 13, 13));
MANA_IMAGES.put("B", skin.getImage(FSkin.ManaImages.IMG_BLACK, 13, 13)); MANA_IMAGES.put("B", FSkin.getImage(FSkin.ManaImages.IMG_BLACK, 13, 13));
MANA_IMAGES.put("BG", skin.getImage(FSkin.ManaImages.IMG_BLACK_GREEN, 13, 13)); MANA_IMAGES.put("BG", FSkin.getImage(FSkin.ManaImages.IMG_BLACK_GREEN, 13, 13));
MANA_IMAGES.put("BR", skin.getImage(FSkin.ManaImages.IMG_BLACK_RED, 13, 13)); MANA_IMAGES.put("BR", FSkin.getImage(FSkin.ManaImages.IMG_BLACK_RED, 13, 13));
MANA_IMAGES.put("G", skin.getImage(FSkin.ManaImages.IMG_GREEN, 13, 13)); MANA_IMAGES.put("G", FSkin.getImage(FSkin.ManaImages.IMG_GREEN, 13, 13));
MANA_IMAGES.put("GU", skin.getImage(FSkin.ManaImages.IMG_GREEN_BLUE, 13, 13)); MANA_IMAGES.put("GU", FSkin.getImage(FSkin.ManaImages.IMG_GREEN_BLUE, 13, 13));
MANA_IMAGES.put("GW", skin.getImage(FSkin.ManaImages.IMG_GREEN_WHITE, 13, 13)); MANA_IMAGES.put("GW", FSkin.getImage(FSkin.ManaImages.IMG_GREEN_WHITE, 13, 13));
MANA_IMAGES.put("R", skin.getImage(FSkin.ManaImages.IMG_RED, 13, 13)); MANA_IMAGES.put("R", FSkin.getImage(FSkin.ManaImages.IMG_RED, 13, 13));
MANA_IMAGES.put("RG", skin.getImage(FSkin.ManaImages.IMG_RED_GREEN, 13, 13)); MANA_IMAGES.put("RG", FSkin.getImage(FSkin.ManaImages.IMG_RED_GREEN, 13, 13));
MANA_IMAGES.put("RW", skin.getImage(FSkin.ManaImages.IMG_RED_WHITE, 13, 13)); MANA_IMAGES.put("RW", FSkin.getImage(FSkin.ManaImages.IMG_RED_WHITE, 13, 13));
MANA_IMAGES.put("U", skin.getImage(FSkin.ManaImages.IMG_BLUE, 13, 13)); MANA_IMAGES.put("U", FSkin.getImage(FSkin.ManaImages.IMG_BLUE, 13, 13));
MANA_IMAGES.put("UB", skin.getImage(FSkin.ManaImages.IMG_BLUE_BLACK, 13, 13)); MANA_IMAGES.put("UB", FSkin.getImage(FSkin.ManaImages.IMG_BLUE_BLACK, 13, 13));
MANA_IMAGES.put("UR", skin.getImage(FSkin.ManaImages.IMG_BLUE_RED, 13, 13)); MANA_IMAGES.put("UR", FSkin.getImage(FSkin.ManaImages.IMG_BLUE_RED, 13, 13));
MANA_IMAGES.put("W", skin.getImage(FSkin.ManaImages.IMG_WHITE, 13, 13)); MANA_IMAGES.put("W", FSkin.getImage(FSkin.ManaImages.IMG_WHITE, 13, 13));
MANA_IMAGES.put("WB", skin.getImage(FSkin.ManaImages.IMG_WHITE_BLACK, 13, 13)); MANA_IMAGES.put("WB", FSkin.getImage(FSkin.ManaImages.IMG_WHITE_BLACK, 13, 13));
MANA_IMAGES.put("WU", skin.getImage(FSkin.ManaImages.IMG_WHITE_BLUE, 13, 13)); MANA_IMAGES.put("WU", FSkin.getImage(FSkin.ManaImages.IMG_WHITE_BLUE, 13, 13));
MANA_IMAGES.put("PW", skin.getImage(FSkin.ManaImages.IMG_PHRYX_WHITE, 13, 13)); MANA_IMAGES.put("PW", FSkin.getImage(FSkin.ManaImages.IMG_PHRYX_WHITE, 13, 13));
MANA_IMAGES.put("PR", skin.getImage(FSkin.ManaImages.IMG_PHRYX_RED, 13, 13)); MANA_IMAGES.put("PR", FSkin.getImage(FSkin.ManaImages.IMG_PHRYX_RED, 13, 13));
MANA_IMAGES.put("PU", skin.getImage(FSkin.ManaImages.IMG_PHRYX_BLUE, 13, 13)); MANA_IMAGES.put("PU", FSkin.getImage(FSkin.ManaImages.IMG_PHRYX_BLUE, 13, 13));
MANA_IMAGES.put("PB", skin.getImage(FSkin.ManaImages.IMG_PHRYX_BLACK, 13, 13)); MANA_IMAGES.put("PB", FSkin.getImage(FSkin.ManaImages.IMG_PHRYX_BLACK, 13, 13));
MANA_IMAGES.put("PG", skin.getImage(FSkin.ManaImages.IMG_PHRYX_GREEN, 13, 13)); MANA_IMAGES.put("PG", FSkin.getImage(FSkin.ManaImages.IMG_PHRYX_GREEN, 13, 13));
MANA_IMAGES.put("2W", skin.getImage(FSkin.ManaImages.IMG_2W, 13, 13)); MANA_IMAGES.put("2W", FSkin.getImage(FSkin.ManaImages.IMG_2W, 13, 13));
MANA_IMAGES.put("2U", skin.getImage(FSkin.ManaImages.IMG_2U, 13, 13)); MANA_IMAGES.put("2U", FSkin.getImage(FSkin.ManaImages.IMG_2U, 13, 13));
MANA_IMAGES.put("2R", skin.getImage(FSkin.ManaImages.IMG_2R, 13, 13)); MANA_IMAGES.put("2R", FSkin.getImage(FSkin.ManaImages.IMG_2R, 13, 13));
MANA_IMAGES.put("2G", skin.getImage(FSkin.ManaImages.IMG_2G, 13, 13)); MANA_IMAGES.put("2G", FSkin.getImage(FSkin.ManaImages.IMG_2G, 13, 13));
MANA_IMAGES.put("2B", skin.getImage(FSkin.ManaImages.IMG_2B, 13, 13)); MANA_IMAGES.put("2B", FSkin.getImage(FSkin.ManaImages.IMG_2B, 13, 13));
MANA_IMAGES.put("S", skin.getImage(FSkin.GameplayImages.IMG_SNOW, 13, 13)); MANA_IMAGES.put("S", FSkin.getImage(FSkin.GameplayImages.IMG_SNOW, 13, 13));
MANA_IMAGES.put("T", skin.getImage(FSkin.GameplayImages.IMG_TAP, 13, 13)); MANA_IMAGES.put("T", FSkin.getImage(FSkin.GameplayImages.IMG_TAP, 13, 13));
MANA_IMAGES.put("slash", skin.getImage(FSkin.GameplayImages.IMG_SLASH, 13, 13)); MANA_IMAGES.put("slash", FSkin.getImage(FSkin.GameplayImages.IMG_SLASH, 13, 13));
MANA_IMAGES.put("attack", skin.getImage(FSkin.GameplayImages.IMG_ATTACK, 32, 32)); MANA_IMAGES.put("attack", FSkin.getImage(FSkin.GameplayImages.IMG_ATTACK, 32, 32));
MANA_IMAGES.put("defend", skin.getImage(FSkin.GameplayImages.IMG_DEFEND, 32, 32)); MANA_IMAGES.put("defend", FSkin.getImage(FSkin.GameplayImages.IMG_DEFEND, 32, 32));
MANA_IMAGES.put("summonsick", skin.getImage(FSkin.GameplayImages.IMG_SUMMONSICK, 32, 32)); MANA_IMAGES.put("summonsick", FSkin.getImage(FSkin.GameplayImages.IMG_SUMMONSICK, 32, 32));
MANA_IMAGES.put("phasing", skin.getImage(FSkin.GameplayImages.IMG_PHASING, 32, 32)); MANA_IMAGES.put("phasing", FSkin.getImage(FSkin.GameplayImages.IMG_PHASING, 32, 32));
MANA_IMAGES.put("counters1", skin.getImage(FSkin.GameplayImages.IMG_COUNTERS1)); MANA_IMAGES.put("counters1", FSkin.getImage(FSkin.GameplayImages.IMG_COUNTERS1));
MANA_IMAGES.put("counters2", skin.getImage(FSkin.GameplayImages.IMG_COUNTERS2)); MANA_IMAGES.put("counters2", FSkin.getImage(FSkin.GameplayImages.IMG_COUNTERS2));
MANA_IMAGES.put("counters3", skin.getImage(FSkin.GameplayImages.IMG_COUNTERS3)); MANA_IMAGES.put("counters3", FSkin.getImage(FSkin.GameplayImages.IMG_COUNTERS3));
MANA_IMAGES.put("countersMulti", skin.getImage(FSkin.GameplayImages.IMG_COUNTERS_MULTI)); MANA_IMAGES.put("countersMulti", FSkin.getImage(FSkin.GameplayImages.IMG_COUNTERS_MULTI));
MANA_IMAGES.put("foil01", skin.getImage(FSkin.Foils.FOIL_01)); MANA_IMAGES.put("foil01", FSkin.getImage(FSkin.Foils.FOIL_01));
MANA_IMAGES.put("foil02", skin.getImage(FSkin.Foils.FOIL_02)); MANA_IMAGES.put("foil02", FSkin.getImage(FSkin.Foils.FOIL_02));
MANA_IMAGES.put("foil03", skin.getImage(FSkin.Foils.FOIL_03)); MANA_IMAGES.put("foil03", FSkin.getImage(FSkin.Foils.FOIL_03));
MANA_IMAGES.put("foil04", skin.getImage(FSkin.Foils.FOIL_04)); MANA_IMAGES.put("foil04", FSkin.getImage(FSkin.Foils.FOIL_04));
MANA_IMAGES.put("foil05", skin.getImage(FSkin.Foils.FOIL_05)); MANA_IMAGES.put("foil05", FSkin.getImage(FSkin.Foils.FOIL_05));
MANA_IMAGES.put("foil06", skin.getImage(FSkin.Foils.FOIL_06)); MANA_IMAGES.put("foil06", FSkin.getImage(FSkin.Foils.FOIL_06));
MANA_IMAGES.put("foil07", skin.getImage(FSkin.Foils.FOIL_07)); MANA_IMAGES.put("foil07", FSkin.getImage(FSkin.Foils.FOIL_07));
MANA_IMAGES.put("foil08", skin.getImage(FSkin.Foils.FOIL_08)); MANA_IMAGES.put("foil08", FSkin.getImage(FSkin.Foils.FOIL_08));
MANA_IMAGES.put("foil09", skin.getImage(FSkin.Foils.FOIL_09)); MANA_IMAGES.put("foil09", FSkin.getImage(FSkin.Foils.FOIL_09));
MANA_IMAGES.put("foil10", skin.getImage(FSkin.Foils.FOIL_10)); MANA_IMAGES.put("foil10", FSkin.getImage(FSkin.Foils.FOIL_10));
} }
/** /**

View File

@@ -20,7 +20,6 @@ import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Command; import forge.Command;
import forge.Constant; import forge.Constant;
import forge.Singletons;
import forge.deck.Deck; import forge.deck.Deck;
import forge.deck.DeckIO; import forge.deck.DeckIO;
import forge.deck.DeckManager; import forge.deck.DeckManager;
@@ -39,7 +38,6 @@ public class DeckLister extends JPanel {
private ImageIcon icoDeleteOver; private ImageIcon icoDeleteOver;
private ImageIcon icoEdit; private ImageIcon icoEdit;
private ImageIcon icoEditOver; private ImageIcon icoEditOver;
private FSkin skin;
private RowPanel previousSelect; private RowPanel previousSelect;
private RowPanel[] rows; private RowPanel[] rows;
private GameType gametype; private GameType gametype;
@@ -65,22 +63,21 @@ public class DeckLister extends JPanel {
*/ */
public DeckLister(GameType gt0, Command cmd0) { public DeckLister(GameType gt0, Command cmd0) {
super(); super();
this.skin = Singletons.getView().getSkin();
this.gametype = gt0; this.gametype = gt0;
this.cmdEditorExit = cmd0; this.cmdEditorExit = cmd0;
this.clrDefault = new Color(0, 0, 0, 0); this.clrDefault = new Color(0, 0, 0, 0);
this.clrHover = skin.getColor(FSkin.Colors.CLR_HOVER); this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrActive = skin.getColor(FSkin.Colors.CLR_ACTIVE); this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.clrBorders = skin.getColor(FSkin.Colors.CLR_BORDERS); this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, wrap")); this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
icoDelete = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE); icoDelete = FSkin.getIcon(FSkin.ForgeIcons.ICO_DELETE);
icoDeleteOver = skin.getIcon(FSkin.ForgeIcons.ICO_DELETE_OVER); icoDeleteOver = FSkin.getIcon(FSkin.ForgeIcons.ICO_DELETE_OVER);
icoEdit = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT); icoEdit = FSkin.getIcon(FSkin.ForgeIcons.ICO_EDIT);
icoEditOver = skin.getIcon(FSkin.ForgeIcons.ICO_EDIT_OVER); icoEditOver = FSkin.getIcon(FSkin.ForgeIcons.ICO_EDIT_OVER);
} }
/** @param decks0 {@link forge.deck.Deck}[] */ /** @param decks0 {@link forge.deck.Deck}[] */
@@ -92,7 +89,7 @@ public class DeckLister extends JPanel {
// Note: careful with the widths of the rows here; // Note: careful with the widths of the rows here;
// scroll panes will have difficulty dynamically resizing if 100% width is set. // scroll panes will have difficulty dynamically resizing if 100% width is set.
JPanel rowTitle = new TitlePanel(); JPanel rowTitle = new TitlePanel();
rowTitle.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA)); rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
rowTitle.setLayout(new MigLayout("insets 0, gap 0")); rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(), rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(),
@@ -278,7 +275,7 @@ public class DeckLister extends JPanel {
setBackground(Color.GREEN); setBackground(Color.GREEN);
} }
setHorizontalAlignment(SwingConstants.CENTER); setHorizontalAlignment(SwingConstants.CENTER);
setFont(skin.getBoldFont(12)); setFont(FSkin.getBoldFont(12));
setHorizontalAlignment(SwingConstants.CENTER); setHorizontalAlignment(SwingConstants.CENTER);
} }
} }
@@ -287,8 +284,8 @@ public class DeckLister extends JPanel {
public GenericLabel(String txt0) { public GenericLabel(String txt0) {
super(txt0); super(txt0);
setHorizontalAlignment(SwingConstants.CENTER); setHorizontalAlignment(SwingConstants.CENTER);
setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
setFont(skin.getBoldFont(12)); setFont(FSkin.getBoldFont(12));
} }
} }

View File

@@ -32,8 +32,6 @@ import java.awt.event.KeyEvent;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import forge.Singletons;
/** /**
* The core JButton used throughout the Forge project. Follows skin font and * The core JButton used throughout the Forge project. Follows skin font and
* theme button styling. * theme button styling.
@@ -49,7 +47,6 @@ public class FButton extends JButton {
private int w, h = 0; private int w, h = 0;
private boolean allImagesPresent = false; private boolean allImagesPresent = false;
private boolean toggle = false; private boolean toggle = false;
private final FSkin skin;
private final AlphaComposite disabledComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.25f); private final AlphaComposite disabledComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.25f);
private KeyAdapter klEnter; private KeyAdapter klEnter;
@@ -68,18 +65,17 @@ public class FButton extends JButton {
*/ */
public FButton(final String msg) { public FButton(final String msg) {
super(msg); super(msg);
this.skin = Singletons.getView().getSkin();
this.setOpaque(false); this.setOpaque(false);
this.setForeground(this.skin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setBackground(Color.red); this.setBackground(Color.red);
this.setFocusPainted(false); this.setFocusPainted(false);
this.setBorder(BorderFactory.createEmptyBorder()); this.setBorder(BorderFactory.createEmptyBorder());
this.setContentAreaFilled(false); this.setContentAreaFilled(false);
this.setMargin(new Insets(0, 25, 0, 25)); this.setMargin(new Insets(0, 25, 0, 25));
this.setFont(this.skin.getBoldFont(14)); this.setFont(FSkin.getBoldFont(14));
this.imgL = skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage(); this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
this.imgM = skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage(); this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
this.imgR = skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage(); this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
if ((this.imgL != null) && (this.imgM != null) && (this.imgR != null)) { if ((this.imgL != null) && (this.imgM != null) && (this.imgR != null)) {
this.allImagesPresent = true; this.allImagesPresent = true;
@@ -101,9 +97,9 @@ public class FButton extends JButton {
if (isToggled()) { return; } if (isToggled()) { return; }
if (FButton.this.isEnabled()) { if (FButton.this.isEnabled()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_RIGHT).getImage();
} }
} }
@@ -112,14 +108,14 @@ public class FButton extends JButton {
if (isToggled()) { return; } if (isToggled()) { return; }
if (FButton.this.isEnabled() && !FButton.this.isFocusOwner()) { if (FButton.this.isEnabled() && !FButton.this.isFocusOwner()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
} }
else if (FButton.this.isEnabled() && FButton.this.isFocusOwner()) { else if (FButton.this.isEnabled() && FButton.this.isFocusOwner()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_RIGHT).getImage();
} }
} }
@@ -128,9 +124,9 @@ public class FButton extends JButton {
if (isToggled()) { return; } if (isToggled()) { return; }
if (FButton.this.isEnabled()) { if (FButton.this.isEnabled()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_RIGHT).getImage();
} }
} }
@@ -139,9 +135,9 @@ public class FButton extends JButton {
if (isToggled()) { return; } if (isToggled()) { return; }
if (FButton.this.isEnabled()) { if (FButton.this.isEnabled()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_RIGHT).getImage();
} }
} }
}); });
@@ -152,9 +148,9 @@ public class FButton extends JButton {
if (isToggled()) { return; } if (isToggled()) { return; }
if (FButton.this.isEnabled()) { if (FButton.this.isEnabled()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_RIGHT).getImage();
} }
addKeyListener(klEnter); addKeyListener(klEnter);
@@ -164,9 +160,9 @@ public class FButton extends JButton {
if (isToggled()) { return; } if (isToggled()) { return; }
if (FButton.this.isEnabled()) { if (FButton.this.isEnabled()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
} }
removeKeyListener(klEnter); removeKeyListener(klEnter);
@@ -177,14 +173,14 @@ public class FButton extends JButton {
@Override @Override
public void setEnabled(boolean b0) { public void setEnabled(boolean b0) {
if (!b0) { if (!b0) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT).getImage();
} }
else { else {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
} }
super.setEnabled(b0); super.setEnabled(b0);
@@ -202,20 +198,20 @@ public class FButton extends JButton {
/** @param b0 &emsp; boolean. */ /** @param b0 &emsp; boolean. */
public void setToggled(boolean b0) { public void setToggled(boolean b0) {
if (b0) { if (b0) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_RIGHT).getImage();
} }
else if (isEnabled()) { else if (isEnabled()) {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
repaint(); repaint();
} }
else { else {
FButton.this.imgL = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT).getImage(); FButton.this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT).getImage();
FButton.this.imgM = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER).getImage(); FButton.this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER).getImage();
FButton.this.imgR = FButton.this.skin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT).getImage(); FButton.this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT).getImage();
repaint(); repaint();
} }
this.toggle = b0; this.toggle = b0;

View File

@@ -5,15 +5,11 @@ import java.awt.event.MouseEvent;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import forge.Singletons;
/** /**
* A custom instance of JCheckBox using Forge skin properties. * A custom instance of JCheckBox using Forge skin properties.
*/ */
@SuppressWarnings("serial")
public class FCheckBox extends JCheckBox { public class FCheckBox extends JCheckBox {
private static final long serialVersionUID = -8633657166511001814L;
private final FSkin skin;
/** */ /** */
public FCheckBox() { public FCheckBox() {
this(""); this("");
@@ -22,10 +18,9 @@ public class FCheckBox extends JCheckBox {
/** @param s0 &emsp; {@link java.lang.String} */ /** @param s0 &emsp; {@link java.lang.String} */
public FCheckBox(final String s0) { public FCheckBox(final String s0) {
super(s0); super(s0);
this.skin = Singletons.getView().getSkin(); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
this.setBackground(skin.getColor(FSkin.Colors.CLR_HOVER)); this.setFont(FSkin.getFont(14));
this.setFont(skin.getFont(14));
this.setOpaque(false); this.setOpaque(false);
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {

View File

@@ -17,7 +17,6 @@ import javax.swing.JLabel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import forge.Command; import forge.Command;
import forge.Singletons;
/** /**
* Uses the Builder pattern to facilitate/encourage inline styling. * Uses the Builder pattern to facilitate/encourage inline styling.
@@ -175,11 +174,11 @@ public class FLabel extends JLabel {
} }
// Final inits // Final inits
private final Color clrText = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_TEXT); private final Color clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
private final Color clrBorders = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_BORDERS); private final Color clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
private final Color clrHover = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER); private final Color clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
private final Color clrInactive = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_INACTIVE); private final Color clrInactive = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
private final Color clrActive = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_ACTIVE); private final Color clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
// Custom properties, assigned either at realization (using builder) // Custom properties, assigned either at realization (using builder)
// or dynamically (using methods below). // or dynamically (using methods below).
@@ -205,14 +204,14 @@ public class FLabel extends JLabel {
ref = (fontScaleBy == SwingConstants.VERTICAL ? getHeight() : getWidth()); ref = (fontScaleBy == SwingConstants.VERTICAL ? getHeight() : getWidth());
switch (fontStyle) { switch (fontStyle) {
case Font.BOLD: case Font.BOLD:
setFont(Singletons.getView().getSkin().getBoldFont((int) (ref * fontScaleFactor))); setFont(FSkin.getBoldFont((int) (ref * fontScaleFactor)));
repaint(); repaint();
break; break;
case Font.ITALIC: case Font.ITALIC:
setFont(Singletons.getView().getSkin().getItalicFont((int) (ref * fontScaleFactor))); setFont(FSkin.getItalicFont((int) (ref * fontScaleFactor)));
break; break;
default: default:
setFont(Singletons.getView().getSkin().getFont((int) (ref * fontScaleFactor))); setFont(FSkin.getFont((int) (ref * fontScaleFactor)));
} }
} }

View File

@@ -8,15 +8,12 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import forge.Singletons;
/** /**
* A JList object using Forge skin properties. * A JList object using Forge skin properties.
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FList extends JList { public class FList extends JList {
private FSkin skin;
/** /**
* A JList object using Forge skin properties. * A JList object using Forge skin properties.
* This constructor assumes list contents are null and will be set later. * This constructor assumes list contents are null and will be set later.
@@ -34,8 +31,6 @@ public class FList extends JList {
*/ */
public FList(Object[] o0) { public FList(Object[] o0) {
super(o0); super(o0);
skin = Singletons.getView().getSkin();
setOpaque(false); setOpaque(false);
ListCellRenderer renderer = new ComplexCellRenderer(); ListCellRenderer renderer = new ComplexCellRenderer();
@@ -52,9 +47,9 @@ public class FList extends JList {
lst0, val0, i0, isSelected, cellHasFocus); lst0, val0, i0, isSelected, cellHasFocus);
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3)); lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
lblItem.setBackground(skin.getColor(FSkin.Colors.CLR_ACTIVE)); lblItem.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
lblItem.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lblItem.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblItem.setFont(skin.getFont(13)); lblItem.setFont(FSkin.getFont(13));
lblItem.setOpaque(isSelected); lblItem.setOpaque(isSelected);
return lblItem; return lblItem;
} }

View File

@@ -5,15 +5,11 @@ import java.awt.event.MouseEvent;
import javax.swing.JRadioButton; import javax.swing.JRadioButton;
import forge.Singletons;
/** /**
* A custom instance of JRadioButton using Forge skin properties. * A custom instance of JRadioButton using Forge skin properties.
*/ */
@SuppressWarnings("serial")
public class FRadioButton extends JRadioButton { public class FRadioButton extends JRadioButton {
private static final long serialVersionUID = -2366973722131882766L;
private final FSkin skin;
/** */ /** */
public FRadioButton() { public FRadioButton() {
this(""); this("");
@@ -23,10 +19,9 @@ public class FRadioButton extends JRadioButton {
public FRadioButton(String s0) { public FRadioButton(String s0) {
super(); super();
this.setText(s0); this.setText(s0);
this.skin = Singletons.getView().getSkin(); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
this.setBackground(skin.getColor(FSkin.Colors.CLR_HOVER)); this.setFont(FSkin.getFont(14));
this.setFont(skin.getFont(14));
this.setOpaque(false); this.setOpaque(false);
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {

View File

@@ -25,8 +25,6 @@ import java.awt.RenderingHints;
import javax.swing.JPanel; import javax.swing.JPanel;
import forge.Singletons;
/** /**
* <p> * <p>
* FRoundedPanel. * FRoundedPanel.
@@ -42,7 +40,7 @@ public class FRoundedPanel extends JPanel {
private boolean[] borders = { true, true, true, true }; private boolean[] borders = { true, true, true, true };
private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE
private Color shadowColor = new Color(150, 150, 150, 150); private Color shadowColor = new Color(150, 150, 150, 150);
private Color borderColor = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_BORDERS); private Color borderColor = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
private int shadowOffset = 5; private int shadowOffset = 5;
private int cornerRadius = 10; private int cornerRadius = 10;
private boolean showShadow = false; private boolean showShadow = false;

View File

@@ -5,15 +5,12 @@ import java.awt.Component;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import forge.Singletons;
/** /**
* A very basic extension of JScrollPane to centralize common styling changes. * A very basic extension of JScrollPane to centralize common styling changes.
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FScrollPane extends JScrollPane { public class FScrollPane extends JScrollPane {
private FSkin skin;
/** /**
* A very basic extension of JScrollPane to centralize common styling changes. * A very basic extension of JScrollPane to centralize common styling changes.
* *
@@ -22,9 +19,7 @@ public class FScrollPane extends JScrollPane {
public FScrollPane(Component c0) { public FScrollPane(Component c0) {
super(c0); super(c0);
getViewport().setOpaque(false); getViewport().setOpaque(false);
setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1));
skin = Singletons.getView().getSkin();
setBorder(new LineBorder(skin.getColor(FSkin.Colors.CLR_BORDERS), 1));
setOpaque(false); setOpaque(false);
} }
} }

View File

@@ -44,16 +44,25 @@ import forge.gui.GuiUtils;
* *
*/ */
public class FSkin { public enum FSkin {
/** Singleton instance of skin. */
SINGLETON_INSTANCE;
/** */ /** */
public enum Backgrounds implements SkinProp { /** */ public enum Backgrounds implements SkinProp { /** */
BG_SPLASH, /** */ BG_SPLASH (null), /** */
BG_TEXTURE, /** */ BG_TEXTURE (null), /** */
BG_MATCH, /** */ BG_MATCH (null); /** */
private int[] coords;
/** @param xy &emsp; int[] coordinates */
Backgrounds(int[] xy) { this.coords = xy; }
/** @return int[] */
public int[] getCoords() { return coords; }
} }
/** */ /** */
public enum Colors implements SkinProp, Coords { /** */ public enum Colors implements SkinProp { /** */
CLR_THEME (new int[] {70, 10}), /** */ CLR_THEME (new int[] {70, 10}), /** */
CLR_BORDERS (new int[] {70, 30}), /** */ CLR_BORDERS (new int[] {70, 30}), /** */
CLR_ZEBRA (new int[] {70, 50}), /** */ CLR_ZEBRA (new int[] {70, 50}), /** */
@@ -75,7 +84,7 @@ public class FSkin {
} }
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */ /** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
public enum ZoneImages implements SkinProp, Coords { /** */ public enum ZoneImages implements SkinProp { /** */
ICO_HAND (new int[] {280, 40, 40, 40}), /** */ ICO_HAND (new int[] {280, 40, 40, 40}), /** */
ICO_LIBRARY (new int[] {280, 0, 40, 40}), /** */ ICO_LIBRARY (new int[] {280, 0, 40, 40}), /** */
ICO_EXILE (new int[] {320, 40, 40, 40}), /** */ ICO_EXILE (new int[] {320, 40, 40, 40}), /** */
@@ -91,7 +100,7 @@ public class FSkin {
} }
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */ /** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
public enum ManaImages implements SkinProp, Coords { /** */ public enum ManaImages implements SkinProp { /** */
IMG_BLACK (new int[] {360, 160, 40, 40}), /** */ IMG_BLACK (new int[] {360, 160, 40, 40}), /** */
IMG_RED (new int[] {400, 160, 40, 40}), /** */ IMG_RED (new int[] {400, 160, 40, 40}), /** */
IMG_COLORLESS (new int[] {440, 160, 40, 40}), /** */ IMG_COLORLESS (new int[] {440, 160, 40, 40}), /** */
@@ -127,7 +136,7 @@ public class FSkin {
} }
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */ /** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
public enum ColorlessManaImages implements SkinProp, Coords { /** */ public enum ColorlessManaImages implements SkinProp { /** */
IMG_0 (new int[] {640, 200, 20, 20}), /** */ IMG_0 (new int[] {640, 200, 20, 20}), /** */
IMG_1 (new int[] {660, 200, 20, 20}), /** */ IMG_1 (new int[] {660, 200, 20, 20}), /** */
IMG_2 (new int[] {640, 220, 20, 20}), /** */ IMG_2 (new int[] {640, 220, 20, 20}), /** */
@@ -156,7 +165,7 @@ public class FSkin {
} }
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */ /** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
public enum GameplayImages implements SkinProp, Coords { /** */ public enum GameplayImages implements SkinProp { /** */
IMG_SNOW (new int[] {320, 160, 40, 40}), /** */ IMG_SNOW (new int[] {320, 160, 40, 40}), /** */
IMG_TAP (new int[] {660, 440, 20, 20}), /** */ IMG_TAP (new int[] {660, 440, 20, 20}), /** */
IMG_UNTAP (new int[] {640, 460, 20, 20}), /** */ IMG_UNTAP (new int[] {640, 460, 20, 20}), /** */
@@ -178,7 +187,7 @@ public class FSkin {
} }
/** */ /** */
public enum Foils implements SkinProp, Coords { /** */ public enum Foils implements SkinProp { /** */
FOIL_01 (new int[] {0, 0, 400, 570}), /** */ FOIL_01 (new int[] {0, 0, 400, 570}), /** */
FOIL_02 (new int[] {400, 0, 400, 570}), /** */ FOIL_02 (new int[] {400, 0, 400, 570}), /** */
FOIL_03 (new int[] {0, 570, 400, 570}), /** */ FOIL_03 (new int[] {0, 570, 400, 570}), /** */
@@ -198,7 +207,7 @@ public class FSkin {
} }
/** */ /** */
public enum DockIcons implements SkinProp, Coords { /** */ public enum DockIcons implements SkinProp { /** */
ICO_SHORTCUTS (new int[] {160, 640, 80, 80}), /** */ ICO_SHORTCUTS (new int[] {160, 640, 80, 80}), /** */
ICO_SETTINGS (new int[] {80, 640, 80, 80}), /** */ ICO_SETTINGS (new int[] {80, 640, 80, 80}), /** */
ICO_ENDTURN (new int[] {320, 640, 80, 80}), /** */ ICO_ENDTURN (new int[] {320, 640, 80, 80}), /** */
@@ -213,7 +222,7 @@ public class FSkin {
} }
/** */ /** */
public enum QuestIcons implements SkinProp, Coords { /** */ public enum QuestIcons implements SkinProp { /** */
ICO_ZEP (new int[] {0, 480, 80, 80}), /** */ ICO_ZEP (new int[] {0, 480, 80, 80}), /** */
ICO_GEAR (new int[] {80, 480, 80, 80}), /** */ ICO_GEAR (new int[] {80, 480, 80, 80}), /** */
ICO_GOLD (new int[] {160, 480, 80, 80}), /** */ ICO_GOLD (new int[] {160, 480, 80, 80}), /** */
@@ -243,7 +252,7 @@ public class FSkin {
} }
/** */ /** */
public enum ForgeIcons implements SkinProp, Coords { /** */ public enum ForgeIcons implements SkinProp { /** */
ICO_EDIT (new int[] {640, 500, 20, 20}), /** */ ICO_EDIT (new int[] {640, 500, 20, 20}), /** */
ICO_EDIT_OVER (new int[] {660, 500, 20, 20}), /** */ ICO_EDIT_OVER (new int[] {660, 500, 20, 20}), /** */
ICO_DELETE (new int[] {640, 480, 20, 20}), /** */ ICO_DELETE (new int[] {640, 480, 20, 20}), /** */
@@ -261,7 +270,7 @@ public class FSkin {
} }
/** */ /** */
public enum ButtonImages implements SkinProp, Coords { /** */ public enum ButtonImages implements SkinProp { /** */
IMG_BTN_START_UP (new int[] {480, 200, 160, 80}), /** */ IMG_BTN_START_UP (new int[] {480, 200, 160, 80}), /** */
IMG_BTN_START_OVER (new int[] {480, 280, 160, 80}), /** */ IMG_BTN_START_OVER (new int[] {480, 280, 160, 80}), /** */
IMG_BTN_START_DOWN (new int[] {480, 360, 160, 80}), /** */ IMG_BTN_START_DOWN (new int[] {480, 360, 160, 80}), /** */
@@ -297,23 +306,21 @@ public class FSkin {
public int[] getCoords() { return coords; } public int[] getCoords() { return coords; }
} }
/** Properties of various components that make up the skin. */ /** Properties of various components that make up the skin.
public interface SkinProp { } * This interface allows all enums to be under the same roof.
/** Add this interface for sub-sprite components, storing their coords. */ * It also enforces a getter for coordinate locations in sprites. */
public interface Coords { public interface SkinProp {
/** */
int[] COORDS = null;
/** @return int[] */ /** @return int[] */
int[] getCoords(); int[] getCoords();
} }
private Map<SkinProp, ImageIcon> icons; private static Map<SkinProp, ImageIcon> icons;
private Map<SkinProp, Image> images; private static Map<SkinProp, Image> images;
private Map<SkinProp, Color> colors; private static Map<SkinProp, Color> colors;
private Map<Integer, Font> plainFonts; private static Map<Integer, Font> plainFonts;
private Map<Integer, Font> boldFonts; private static Map<Integer, Font> boldFonts;
private Map<Integer, Font> italicFonts; private static Map<Integer, Font> italicFonts;
private static final String private static final String
FILE_SKINS_DIR = "res/images/skins/", FILE_SKINS_DIR = "res/images/skins/",
@@ -322,24 +329,15 @@ public class FSkin {
FILE_FONT = "font1.ttf", FILE_FONT = "font1.ttf",
FILE_SPLASH = "bg_splash.png", FILE_SPLASH = "bg_splash.png",
FILE_MATCH_BG = "bg_match.jpg", FILE_MATCH_BG = "bg_match.jpg",
FILE_TEXTURE_BG = "bg_texture.jpg"; FILE_TEXTURE_BG = "bg_texture.jpg",
DEFAULT_DIR = FILE_SKINS_DIR + "default/";
private final String notfound = "FSkin.java: Can't find "; private static String preferredDir;
private final String preferredDir; private static String preferredName;
private final String defaultDir; private static Font font;
private final String preferredName; private static BufferedImage bimDefaultSprite, bimPreferredSprite, bimFoils;
private Font font; private static int x0, y0, w0, h0, newW, newH, preferredW, preferredH;
private BufferedImage bimDefaultSprite, bimPreferredSprite, bimFoils; private static int[] tempCoords;
private int preferredH, preferredW;
private FProgressBar barProgress;
/**
* FSkin constructor. No arguments, will generate default skin settings,
* fonts, and backgrounds.
*/
public FSkin() {
this("default");
}
/** /**
* FSkin constructor, using skin name. Generates custom skin settings, * FSkin constructor, using skin name. Generates custom skin settings,
@@ -348,15 +346,21 @@ public class FSkin {
* @param skinName * @param skinName
* the skin name * the skin name
*/ */
public FSkin(final String skinName) { public static void loadLight(final String skinName) {
// No need for this method to be loaded while on the EDT.
GuiUtils.checkEDT("FSkin$constructor", false); GuiUtils.checkEDT("FSkin$constructor", false);
this.preferredName = skinName; // Non-default (preferred) skin name and dir.
this.preferredDir = FILE_SKINS_DIR + preferredName + "/"; FSkin.preferredName = skinName;
this.defaultDir = FILE_SKINS_DIR + "default/"; FSkin.preferredDir = FILE_SKINS_DIR + preferredName + "/";
this.icons = new HashMap<SkinProp, ImageIcon>();
this.images = new HashMap<SkinProp, Image>(); if (FSkin.icons != null) { FSkin.icons.clear(); }
this.colors = new HashMap<SkinProp, Color>(); if (FSkin.images != null) { FSkin.images.clear(); }
if (FSkin.colors != null) { FSkin.colors.clear(); }
FSkin.icons = new HashMap<SkinProp, ImageIcon>();
FSkin.images = new HashMap<SkinProp, Image>();
FSkin.colors = new HashMap<SkinProp, Color>();
final File f = new File(preferredDir + FILE_SPLASH); final File f = new File(preferredDir + FILE_SPLASH);
final BufferedImage img; final BufferedImage img;
@@ -366,15 +370,14 @@ public class FSkin {
final int h = img.getHeight(); final int h = img.getHeight();
final int w = img.getWidth(); final int w = img.getWidth();
this.setIcon(Backgrounds.BG_SPLASH, img.getSubimage(0, 0, w, h - 100)); FSkin.setIcon(Backgrounds.BG_SPLASH, img.getSubimage(0, 0, w, h - 100));
UIManager.put("ProgressBar.background", this.getColorFromPixel(img.getRGB(25, h - 75))); UIManager.put("ProgressBar.background", FSkin.getColorFromPixel(img.getRGB(25, h - 75)));
UIManager.put("ProgressBar.selectionBackground", this.getColorFromPixel(img.getRGB(75, h - 75))); UIManager.put("ProgressBar.selectionBackground", FSkin.getColorFromPixel(img.getRGB(75, h - 75)));
UIManager.put("ProgressBar.foreground", this.getColorFromPixel(img.getRGB(25, h - 25))); UIManager.put("ProgressBar.foreground", FSkin.getColorFromPixel(img.getRGB(25, h - 25)));
UIManager.put("ProgressBar.selectionForeground", this.getColorFromPixel(img.getRGB(75, h - 25))); UIManager.put("ProgressBar.selectionForeground", FSkin.getColorFromPixel(img.getRGB(75, h - 25)));
UIManager.put("ProgressBar.border", new LineBorder(Color.BLACK, 0)); UIManager.put("ProgressBar.border", new LineBorder(Color.BLACK, 0));
} catch (final IOException e) { } catch (final IOException e) {
System.err.println(this.notfound + preferredDir + FILE_SPLASH);
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -398,9 +401,16 @@ public class FSkin {
* preferred takes precedence over default, but if something is * preferred takes precedence over default, but if something is
* missing, the default picture is retrieved. * missing, the default picture is retrieved.
*/ */
public void load() { public static void loadFull() {
// No need for this method to be loaded while on the EDT.
GuiUtils.checkEDT("FSkin$load", false); GuiUtils.checkEDT("FSkin$load", false);
barProgress = Singletons.getView().getProgressBar();
// Preferred skin name must be called via loadLight() method,
// which does some cleanup and init work.
if (FSkin.preferredName.isEmpty()) { FSkin.loadLight("default"); }
// Everything OK?
final FProgressBar barProgress = Singletons.getView().getProgressBar();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
@@ -413,9 +423,9 @@ public class FSkin {
// Grab and test various sprite files. // Grab and test various sprite files.
barProgress.setMaximum(3); barProgress.setMaximum(3);
final File f1 = new File(defaultDir + FILE_ICON_SPRITE); final File f1 = new File(DEFAULT_DIR + FILE_ICON_SPRITE);
final File f2 = new File(preferredDir + FILE_ICON_SPRITE); final File f2 = new File(preferredDir + FILE_ICON_SPRITE);
final File f3 = new File(defaultDir + FILE_FOIL_SPRITE); final File f3 = new File(DEFAULT_DIR + FILE_FOIL_SPRITE);
try { try {
bimDefaultSprite = ImageIO.read(f1); bimDefaultSprite = ImageIO.read(f1);
@@ -429,7 +439,8 @@ public class FSkin {
preferredW = bimPreferredSprite.getWidth(); preferredW = bimPreferredSprite.getWidth();
} }
catch (Exception e) { catch (Exception e) {
System.err.println(this.notfound + " a sprite."); System.err.println("FSkin$loadFull: Missing a sprite (default icons, "
+ "preferred icons, or foils.");
e.printStackTrace(); e.printStackTrace();
} }
@@ -445,7 +456,7 @@ public class FSkin {
// Pre-derive most fonts (plain, bold, and italic). // Pre-derive most fonts (plain, bold, and italic).
// Exceptions handled inside method. // Exceptions handled inside method.
this.font = GuiUtils.newFont(FILE_SKINS_DIR + preferredName + "/" + FILE_FONT); FSkin.font = GuiUtils.newFont(FILE_SKINS_DIR + preferredName + "/" + FILE_FONT);
plainFonts = new HashMap<Integer, Font>(); plainFonts = new HashMap<Integer, Font>();
boldFonts = new HashMap<Integer, Font>(); boldFonts = new HashMap<Integer, Font>();
italicFonts = new HashMap<Integer, Font>(); italicFonts = new HashMap<Integer, Font>();
@@ -455,54 +466,44 @@ public class FSkin {
// Put various images into map (except sprite and splash). // Put various images into map (except sprite and splash).
// Exceptions handled inside method. // Exceptions handled inside method.
this.setIcon(Backgrounds.BG_TEXTURE, preferredDir + FILE_TEXTURE_BG); FSkin.setIcon(Backgrounds.BG_TEXTURE, preferredDir + FILE_TEXTURE_BG);
this.setIcon(Backgrounds.BG_MATCH, preferredDir + FILE_MATCH_BG); FSkin.setIcon(Backgrounds.BG_MATCH, preferredDir + FILE_MATCH_BG);
// Run through enums and load their coords. // Run through enums and load their coords.
for (Colors e : Colors.values()) { this.setColor(e); } for (Colors e : Colors.values()) { FSkin.setColor(e); }
for (ZoneImages e : ZoneImages.values()) { this.setImage(e); } for (ZoneImages e : ZoneImages.values()) { FSkin.setImage(e); }
for (DockIcons e : DockIcons.values()) { this.setIcon(e); } for (DockIcons e : DockIcons.values()) { FSkin.setIcon(e); }
for (ForgeIcons e : ForgeIcons.values()) { this.setIcon(e); } for (ForgeIcons e : ForgeIcons.values()) { FSkin.setIcon(e); }
for (ButtonImages e : ButtonImages.values()) { this.setIcon(e); } for (ButtonImages e : ButtonImages.values()) { FSkin.setIcon(e); }
for (QuestIcons e : QuestIcons.values()) { this.setIcon(e); } for (QuestIcons e : QuestIcons.values()) { FSkin.setIcon(e); }
for (ManaImages e : ManaImages.values()) { this.setImage(e); } for (ManaImages e : ManaImages.values()) { FSkin.setImage(e); }
for (ColorlessManaImages e : ColorlessManaImages.values()) { this.setImage(e); } for (ColorlessManaImages e : ColorlessManaImages.values()) { FSkin.setImage(e); }
for (GameplayImages e : GameplayImages.values()) { this.setImage(e); } for (GameplayImages e : GameplayImages.values()) { FSkin.setImage(e); }
// Foils have a separate sprite, so uses a specific method. // Foils have a separate sprite, so uses a specific method.
for (Foils e : Foils.values()) { this.setFoil(e); } for (Foils e : Foils.values()) { FSkin.setFoil(e); }
// Clear references to buffered images // Clear references to buffered images
this.bimDefaultSprite.flush(); FSkin.bimDefaultSprite.flush();
this.bimFoils.flush(); FSkin.bimFoils.flush();
this.bimPreferredSprite.flush(); FSkin.bimPreferredSprite.flush();
this.bimDefaultSprite = null; FSkin.bimDefaultSprite = null;
this.bimFoils = null; FSkin.bimFoils = null;
this.bimPreferredSprite = null; FSkin.bimPreferredSprite = null;
}
/** (Should) clear memory resources for this skin object. */
public void unloadSkin() {
this.icons.clear();
this.images.clear();
this.colors.clear();
this.plainFonts.clear();
this.boldFonts.clear();
this.italicFonts.clear();
} }
/** @return {@link java.awt.font} font */ /** @return {@link java.awt.font} font */
public Font getFont() { public static Font getFont() {
return this.font; return FSkin.font;
} }
/** /**
* @param size - integer, pixel size * @param size - integer, pixel size
* @return {@link java.awt.font} font1 * @return {@link java.awt.font} font1
*/ */
public Font getFont(int size) { public static Font getFont(int size) {
if (plainFonts.get(size) == null) { if (plainFonts.get(size) == null) {
plainFonts.put(size, getFont().deriveFont(Font.PLAIN, size)); plainFonts.put(size, getFont().deriveFont(Font.PLAIN, size));
} }
@@ -513,7 +514,7 @@ public class FSkin {
* @param size - integer, pixel size * @param size - integer, pixel size
* @return {@link java.awt.font} font1 * @return {@link java.awt.font} font1
*/ */
public Font getBoldFont(int size) { public static Font getBoldFont(int size) {
if (boldFonts.get(size) == null) { if (boldFonts.get(size) == null) {
boldFonts.put(size, getFont().deriveFont(Font.BOLD, size)); boldFonts.put(size, getFont().deriveFont(Font.BOLD, size));
} }
@@ -524,7 +525,7 @@ public class FSkin {
* @param size - integer, pixel size * @param size - integer, pixel size
* @return {@link java.awt.font} font1 * @return {@link java.awt.font} font1
*/ */
public Font getItalicFont(int size) { public static Font getItalicFont(int size) {
if (boldFonts.get(size) == null) { if (boldFonts.get(size) == null) {
italicFonts.put(size, getFont().deriveFont(Font.ITALIC, size)); italicFonts.put(size, getFont().deriveFont(Font.ITALIC, size));
} }
@@ -536,8 +537,8 @@ public class FSkin {
* *
* @return Name of the current skin. * @return Name of the current skin.
*/ */
public String getName() { public static String getName() {
return this.preferredName; return FSkin.preferredName;
} }
/** /**
@@ -546,8 +547,8 @@ public class FSkin {
* @param s0 &emsp; SkinProp enum * @param s0 &emsp; SkinProp enum
* @return Image * @return Image
*/ */
public Image getImage(final SkinProp s0) { public static Image getImage(final SkinProp s0) {
return this.images.get(s0); return FSkin.images.get(s0);
} }
/** /**
@@ -556,8 +557,8 @@ public class FSkin {
* @param s0 &emsp; SkinProp enum * @param s0 &emsp; SkinProp enum
* @return ImageIcon * @return ImageIcon
*/ */
public ImageIcon getIcon(final SkinProp s0) { public static ImageIcon getIcon(final SkinProp s0) {
return this.icons.get(s0); return FSkin.icons.get(s0);
} }
/** /**
@@ -571,11 +572,11 @@ public class FSkin {
* int new height * int new height
* @return Image * @return Image
*/ */
public Image getImage(final SkinProp s0, int w0, int h0) { public static Image getImage(final SkinProp s0, int w0, int h0) {
w0 = (w0 < 1) ? 1 : w0; w0 = (w0 < 1) ? 1 : w0;
h0 = (h0 < 1) ? 1 : h0; h0 = (h0 < 1) ? 1 : h0;
final Image original = this.images.get(s0); final Image original = FSkin.images.get(s0);
final BufferedImage scaled = new BufferedImage(w0, h0, BufferedImage.TYPE_INT_ARGB); final BufferedImage scaled = new BufferedImage(w0, h0, BufferedImage.TYPE_INT_ARGB);
@@ -593,8 +594,8 @@ public class FSkin {
* @param s0 &emsp; Skin property (from enum) * @param s0 &emsp; Skin property (from enum)
* @return Color * @return Color
*/ */
public Color getColor(final SkinProp s0) { public static Color getColor(final SkinProp s0) {
return this.colors.get(s0); return colors.get(s0);
} }
/** /**
@@ -627,7 +628,7 @@ public class FSkin {
* *
* @param {@link java.lang.Integer} pixel information * @param {@link java.lang.Integer} pixel information
*/ */
private Color getColorFromPixel(final int pixel) { private static Color getColorFromPixel(final int pixel) {
int r, g, b, a; int r, g, b, a;
a = (pixel >> 24) & 0x000000ff; a = (pixel >> 24) & 0x000000ff;
r = (pixel >> 16) & 0x000000ff; r = (pixel >> 16) & 0x000000ff;
@@ -636,12 +637,12 @@ public class FSkin {
return new Color(r, g, b, a); return new Color(r, g, b, a);
} }
private BufferedImage testPreferredSprite(SkinProp s0) { private static BufferedImage testPreferredSprite(SkinProp s0) {
int[] coords = ((Coords) s0).getCoords(); tempCoords = s0.getCoords();
int x0 = coords[0]; x0 = tempCoords[0];
int y0 = coords[1]; y0 = tempCoords[1];
int w0 = coords[2]; w0 = tempCoords[2];
int h0 = coords[3]; h0 = tempCoords[3];
// Test if requested sub-image in inside bounds of preferred sprite. // Test if requested sub-image in inside bounds of preferred sprite.
// (Height and width of preferred sprite were set in loadFontAndImages.) // (Height and width of preferred sprite were set in loadFontAndImages.)
@@ -658,68 +659,68 @@ public class FSkin {
// Center // Center
x = (int) (x0 + w0 / 2); x = (int) (x0 + w0 / 2);
y = (int) (y0 + h0 / 2); y = (int) (y0 + h0 / 2);
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y)); c = FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
if (c.getAlpha() != 0) { return bimPreferredSprite; } if (c.getAlpha() != 0) { return bimPreferredSprite; }
x += 2; x += 2;
y += 2; y += 2;
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y)); c = FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
if (c.getAlpha() != 0) { return bimPreferredSprite; } if (c.getAlpha() != 0) { return bimPreferredSprite; }
x -= 4; x -= 4;
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y)); c = FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
if (c.getAlpha() != 0) { return bimPreferredSprite; } if (c.getAlpha() != 0) { return bimPreferredSprite; }
y -= 4; y -= 4;
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y)); c = FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
if (c.getAlpha() != 0) { return bimPreferredSprite; } if (c.getAlpha() != 0) { return bimPreferredSprite; }
x += 4; x += 4;
c = this.getColorFromPixel(bimPreferredSprite.getRGB(x, y)); c = FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x, y));
if (c.getAlpha() != 0) { return bimPreferredSprite; } if (c.getAlpha() != 0) { return bimPreferredSprite; }
return bimDefaultSprite; return bimDefaultSprite;
} }
private void setFoil(final SkinProp s0) { private static void setFoil(final SkinProp s0) {
int[] coords = ((Coords) s0).getCoords(); tempCoords = s0.getCoords();
int x0 = coords[0]; x0 = tempCoords[0];
int y0 = coords[1]; y0 = tempCoords[1];
int w0 = coords[2]; w0 = tempCoords[2];
int h0 = coords[3]; h0 = tempCoords[3];
this.images.put(s0, bimFoils.getSubimage(x0, y0, w0, h0)); FSkin.images.put(s0, bimFoils.getSubimage(x0, y0, w0, h0));
} }
private void setColor(final SkinProp s0) { private static void setColor(final SkinProp s0) {
int[] coords = ((Coords) s0).getCoords(); tempCoords = s0.getCoords();
int x0 = coords[0]; x0 = tempCoords[0];
int y0 = coords[1]; y0 = tempCoords[1];
this.colors.put(s0, getColorFromPixel(bimPreferredSprite.getRGB(x0, y0))); FSkin.colors.put(s0, FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x0, y0)));
} }
private void setFont(int size) { private static void setFont(int size) {
plainFonts.put(size, font.deriveFont(Font.PLAIN, size)); plainFonts.put(size, font.deriveFont(Font.PLAIN, size));
} }
private void setBoldFont(int size) { private static void setBoldFont(int size) {
boldFonts.put(size, font.deriveFont(Font.BOLD, size)); boldFonts.put(size, font.deriveFont(Font.BOLD, size));
} }
private void setItalicFont(int size) { private static void setItalicFont(int size) {
italicFonts.put(size, font.deriveFont(Font.ITALIC, size)); italicFonts.put(size, FSkin.font.deriveFont(Font.ITALIC, size));
} }
private void setIcon(final SkinProp s0) { private static void setIcon(final SkinProp s0) {
int[] coords = ((Coords) s0).getCoords(); tempCoords = s0.getCoords();
int x0 = coords[0]; x0 = tempCoords[0];
int y0 = coords[1]; y0 = tempCoords[1];
int w0 = coords[2]; w0 = tempCoords[2];
int h0 = coords[3]; h0 = tempCoords[3];
BufferedImage img = testPreferredSprite(s0); BufferedImage img = testPreferredSprite(s0);
this.icons.put(s0, new ImageIcon(img.getSubimage(x0, y0, w0, h0))); FSkin.icons.put(s0, new ImageIcon(img.getSubimage(x0, y0, w0, h0)));
} }
/** /**
@@ -731,15 +732,14 @@ public class FSkin {
* @param s1 * @param s1
* &emsp; File address * &emsp; File address
*/ */
private void setIcon(final SkinProp s0, final String s1) { private static void setIcon(final SkinProp s0, final String s1) {
try { try {
final File file = new File(s1); final File file = new File(s1);
ImageIO.read(file); ImageIO.read(file);
} catch (IOException e) { } catch (IOException e) {
System.err.println(this.notfound + preferredDir + FILE_SPLASH);
e.printStackTrace(); e.printStackTrace();
} }
this.icons.put(s0, new ImageIcon(s1)); FSkin.icons.put(s0, new ImageIcon(s1));
} }
/** /**
@@ -748,8 +748,8 @@ public class FSkin {
* @param s0 &emsp; Skin property (from enum) * @param s0 &emsp; Skin property (from enum)
* @param bi0 &emsp; BufferedImage * @param bi0 &emsp; BufferedImage
*/ */
private void setIcon(final SkinProp s0, final BufferedImage bi0) { private static void setIcon(final SkinProp s0, final BufferedImage bi0) {
this.icons.put(s0, new ImageIcon(bi0)); FSkin.icons.put(s0, new ImageIcon(bi0));
} }
/** /**
@@ -757,8 +757,8 @@ public class FSkin {
* *
* @param s0 * @param s0
*/ */
private void setImage(final SkinProp s0) { private static void setImage(final SkinProp s0) {
setImage(s0, true); FSkin.setImage(s0, true);
} }
/** /**
@@ -772,23 +772,23 @@ public class FSkin {
* *
* @param s0 &emsp; An address in the hashmap, derived from SkinProp enum * @param s0 &emsp; An address in the hashmap, derived from SkinProp enum
*/ */
private void setImage(final SkinProp s0, boolean scale) { private static void setImage(final SkinProp s0, boolean scale) {
int[] coords = ((Coords) s0).getCoords(); tempCoords = s0.getCoords();
int x0 = coords[0]; x0 = tempCoords[0];
int y0 = coords[1]; y0 = tempCoords[1];
int w0 = coords[2]; w0 = tempCoords[2];
int h0 = coords[3]; h0 = tempCoords[3];
int newW = (coords.length == 6 ? coords[4] : 0); newW = (tempCoords.length == 6 ? tempCoords[4] : 0);
int newH = (coords.length == 6 ? coords[5] : 0); newH = (tempCoords.length == 6 ? tempCoords[5] : 0);
BufferedImage img = testPreferredSprite(s0); BufferedImage img = FSkin.testPreferredSprite(s0);
BufferedImage bi0 = img.getSubimage(x0, y0, w0, h0); BufferedImage bi0 = img.getSubimage(x0, y0, w0, h0);
if (scale && newW != 0) { if (scale && newW != 0) {
this.images.put(s0, bi0.getScaledInstance(newW, newH, Image.SCALE_AREA_AVERAGING)); FSkin.images.put(s0, bi0.getScaledInstance(newW, newH, Image.SCALE_AREA_AVERAGING));
} }
else { else {
this.images.put(s0, bi0); FSkin.images.put(s0, bi0);
} }
} }
} }

View File

@@ -2,20 +2,16 @@ package forge.view.toolbox;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import forge.Singletons;
/** /**
* A custom instance of JTextArea using Forge skin properties. * A custom instance of JTextArea using Forge skin properties.
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FTextArea extends JTextArea { public class FTextArea extends JTextArea {
private final FSkin skin;
/** */ /** */
public FTextArea() { public FTextArea() {
super(); super();
this.skin = Singletons.getView().getSkin(); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT));
this.setOpaque(false); this.setOpaque(false);
this.setWrapStyleWord(true); this.setWrapStyleWord(true);
this.setLineWrap(true); this.setLineWrap(true);

View File

@@ -33,7 +33,6 @@ import javax.swing.JPanel;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons;
/** /**
* TODO: Write javadoc for this type. * TODO: Write javadoc for this type.
@@ -44,10 +43,7 @@ public class FVerticalTabPanel extends FPanel {
private final CardLayout cards; private final CardLayout cards;
private final JPanel pnlContent; private final JPanel pnlContent;
private final List<VTab> allVTabs; private final List<VTab> allVTabs;
private int w, h; private int w, h, active;
private final FSkin skin;
private int active;
private final Color activeColor, inactiveColor, hoverColor; private final Color activeColor, inactiveColor, hoverColor;
private boolean tabsOnRightSide; private boolean tabsOnRightSide;
@@ -81,10 +77,9 @@ public class FVerticalTabPanel extends FPanel {
this.setLayout(new MigLayout("insets 0, gap 0, wrap 2")); this.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
this.setOpaque(false); this.setOpaque(false);
final int size = childPanels.size(); final int size = childPanels.size();
this.skin = Singletons.getView().getSkin(); this.hoverColor = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.hoverColor = this.skin.getColor(FSkin.Colors.CLR_HOVER); this.activeColor = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.activeColor = this.skin.getColor(FSkin.Colors.CLR_ACTIVE); this.inactiveColor = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
this.inactiveColor = this.skin.getColor(FSkin.Colors.CLR_INACTIVE);
final int pctTabH = ((100 - 2 - 2) / size); final int pctTabH = ((100 - 2 - 2) / size);
final int pctTabW = 11; final int pctTabW = 11;
@@ -101,7 +96,7 @@ public class FVerticalTabPanel extends FPanel {
// immediately to define grid. // immediately to define grid.
if (tabsOnRightSide) { if (tabsOnRightSide) {
this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!"); this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!");
this.pnlContent.setBorder(new MatteBorder(0, 0, 0, 1, this.skin.getColor(FSkin.Colors.CLR_BORDERS))); this.pnlContent.setBorder(new MatteBorder(0, 0, 0, 1, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
} }
// Add top spacer in any case. // Add top spacer in any case.
@@ -113,7 +108,7 @@ public class FVerticalTabPanel extends FPanel {
// must be added after spacer, which then defines the grid. // must be added after spacer, which then defines the grid.
if (!tabsOnRightSide) { if (!tabsOnRightSide) {
this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!"); this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!");
this.pnlContent.setBorder(new MatteBorder(0, 1, 0, 0, this.skin.getColor(FSkin.Colors.CLR_BORDERS))); this.pnlContent.setBorder(new MatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
} }
// Add all tabs // Add all tabs
@@ -227,7 +222,7 @@ public class FVerticalTabPanel extends FPanel {
// Careful with this font scale factor; the vertical tabs will be // Careful with this font scale factor; the vertical tabs will be
// unreadable // unreadable
// if small window, too big if large window. // if small window, too big if large window.
setFont(FVerticalTabPanel.this.skin.getFont((int) (h * 0.16))); setFont(FSkin.getFont((int) (h * 0.16)));
} }
}); });
} }
@@ -250,12 +245,12 @@ public class FVerticalTabPanel extends FPanel {
if (tabsOnRightSide) { if (tabsOnRightSide) {
at.rotate(Math.toRadians(90), 0, 0); at.rotate(Math.toRadians(90), 0, 0);
g2d.setTransform(at); g2d.setTransform(at);
g2d.setColor(skin.getColor(FSkin.Colors.CLR_TEXT)); g2d.setColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
g2d.drawString(this.msg, 5, -4); g2d.drawString(this.msg, 5, -4);
} else { } else {
at.rotate(Math.toRadians(-90), 0, 0); at.rotate(Math.toRadians(-90), 0, 0);
g2d.setTransform(at); g2d.setTransform(at);
g2d.setColor(skin.getColor(FSkin.Colors.CLR_TEXT)); g2d.setColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
// Rotated, so follows: (this.msg, vertical coord, horizontal coord) // Rotated, so follows: (this.msg, vertical coord, horizontal coord)
g2d.drawString(this.msg, 8 - h, w - 6); g2d.drawString(this.msg, 8 - h, w - 6);
} }

View File

@@ -9,14 +9,11 @@ import java.awt.event.MouseEvent;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import forge.Singletons;
/** Standardized tab for submenus in home screen. */ /** Standardized tab for submenus in home screen. */
public class SubTab extends JPanel { public class SubTab extends JPanel {
private static final long serialVersionUID = -2193833603356739321L; private static final long serialVersionUID = -2193833603356739321L;
private final Color clrBorders, clrHover; private final Color clrBorders, clrHover;
private final MouseAdapter madHover; private final MouseAdapter madHover;
private final FSkin skin;
private boolean enabled = false; private boolean enabled = false;
private boolean hovering = false; private boolean hovering = false;
@@ -26,9 +23,8 @@ public class SubTab extends JPanel {
public SubTab(String s0) { public SubTab(String s0) {
super(); super();
this.setOpaque(false); this.setOpaque(false);
this.skin = Singletons.getView().getSkin(); this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
this.clrBorders = skin.getColor(FSkin.Colors.CLR_BORDERS); this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrHover = skin.getColor(FSkin.Colors.CLR_HOVER);
this.setCursor(new Cursor(Cursor.HAND_CURSOR)); this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.madHover = new MouseAdapter() { this.madHover = new MouseAdapter() {
@@ -47,8 +43,8 @@ public class SubTab extends JPanel {
this.addMouseListener(madHover); this.addMouseListener(madHover);
final JLabel lbl = new JLabel(s0); final JLabel lbl = new JLabel(s0);
lbl.setForeground(skin.getColor(FSkin.Colors.CLR_TEXT)); lbl.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lbl.setFont(skin.getFont(12)); lbl.setFont(FSkin.getFont(12));
this.add(lbl); this.add(lbl);
} }