GUI updates:

1) remove LAF stuff
2) add a Chooser for Skin from the GuiHomeScreen (not fully functional yet)
3) hook up the GuiHomeScreen to use the New GUI (currently no option to use the old GUI)
This commit is contained in:
slapshot5
2011-12-08 04:15:32 +00:00
parent ce17eeafac
commit 2de0997e5f
16 changed files with 81 additions and 411 deletions

View File

@@ -303,20 +303,6 @@ public class UI {
}
}
/**
* <p>
* setSystemLookAndFeel.
* </p>
*/
public static void setSystemLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
System.err.println("Error setting look and feel:");
ex.printStackTrace();
}
}
/**
* <p>
* setDefaultFont.

View File

@@ -944,9 +944,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
private void initComponents() {
// Preparing the Frame
this.setTitle(ForgeProps.getLocalized(NewConstants.Lang.PROGRAM_NAME));
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.setFont(new Font("Times New Roman", 0, 16));
}
this.getContentPane().setLayout(new BorderLayout());
// I tried using the JavaBeanConverter with this, but I got a
@@ -1078,9 +1076,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
// adding the individual parts
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.initFonts(this.pane);
}
this.initMsgYesNo(this.pane);
this.initOpp(this.pane);
@@ -1276,17 +1272,13 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
this.oppPCLabel.setForeground(GuiDisplay.greenColor);
final JLabel oppHandLabel = new JLabel(ForgeProps.getLocalized(ComputerHand.BUTTON), SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
oppHandLabel.setFont(this.statFont);
}
final JButton oppGraveButton = new JButton(this.computerGraveyardAction);
oppGraveButton.setText((String) this.computerGraveyardAction.getValue("buttonText"));
oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
oppGraveButton.setFont(this.statFont);
}
final JPanel gravePanel = new JPanel(new BorderLayout());
gravePanel.add(oppGraveButton, BorderLayout.EAST);
@@ -1295,9 +1287,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
oppRemovedButton.setText((String) this.computerRemovedAction.getValue("buttonText"));
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
oppRemovedButton.setFont(this.statFont);
}
this.oppHandValue.setHorizontalAlignment(SwingConstants.LEADING);
this.oppLibraryValue.setHorizontalAlignment(SwingConstants.LEADING);
@@ -1373,14 +1363,10 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
final JLabel playerLibraryLabel = new JLabel(ForgeProps.getLocalized(HumanLibrary.BUTTON),
SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
playerLibraryLabel.setFont(this.statFont);
}
final JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HumanHand.TITLE), SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
playerHandLabel.setFont(this.statFont);
}
// JLabel playerGraveLabel = new JLabel("Grave:",
// SwingConstants.TRAILING);
@@ -1388,17 +1374,13 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
playerGraveButton.setText((String) this.humanGraveyardAction.getValue("buttonText"));
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
playerGraveButton.setFont(this.statFont);
}
final JButton playerFlashBackButton = new JButton(this.humanFlashbackAction);
playerFlashBackButton.setText((String) this.humanFlashbackAction.getValue("buttonText"));
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
playerFlashBackButton.setFont(this.statFont);
}
final JPanel gravePanel = new JPanel(new BorderLayout());
gravePanel.add(playerGraveButton, BorderLayout.EAST);
@@ -1410,9 +1392,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
playerRemovedButton.setText((String) this.humanRemovedAction.getValue("buttonText"));
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
playerRemovedButton.setFont(this.statFont);
}
this.playerHandValue.setHorizontalAlignment(SwingConstants.LEADING);
this.playerLibraryValue.setHorizontalAlignment(SwingConstants.LEADING);

View File

@@ -28,7 +28,6 @@ import arcane.ui.CardPanel;
import arcane.ui.ViewPanel;
import forge.Card;
import forge.GuiDisplayUtil;
import forge.Singletons;
import forge.gui.game.CardDetailPanel;
import forge.item.CardPrinted;
import forge.item.InventoryItem;
@@ -77,9 +76,7 @@ public class CardPanelHeavy extends CardPanelBase {
CardPanelHeavy.this.changeStateButtonActionPerformed(e);
}
});
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.changeStateButton.setFont(new java.awt.Font("Dialog", 0, 10));
}
/*
* Removed Oct 25 2011 - Hellfish

View File

@@ -24,7 +24,6 @@ import javax.swing.JButton;
import net.miginfocom.swing.MigLayout;
import forge.Card;
import forge.Singletons;
import forge.gui.game.CardDetailPanel;
import forge.gui.game.CardPicturePanel;
import forge.item.CardPrinted;
@@ -56,9 +55,7 @@ public class CardPanelLite extends CardPanelBase {
CardPanelLite.this.bChangeStateActionPerformed(e);
}
});
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.bChangeState.setFont(new java.awt.Font("Dialog", 0, 10));
}
this.setLayout(new MigLayout("fill, ins 0"));
this.add(this.detail, "w 239, h 303, grow, flowy, wrap");

View File

@@ -39,7 +39,6 @@ import net.miginfocom.swing.MigLayout;
import net.slightlymagic.maxmtg.Predicate;
import forge.AllZone;
import forge.Command;
import forge.Singletons;
import forge.error.ErrorViewer;
import forge.game.GameType;
import forge.item.CardDb;
@@ -168,14 +167,12 @@ public final class DeckEditorCommon extends DeckEditorBase {
private void jbInit() {
if (!Singletons.getModel().getPreferences().isLafFonts()) {
final Font fButtons = new java.awt.Font("Dialog", 0, 13);
this.removeButton.setFont(fButtons);
this.addButton.setFont(fButtons);
this.importButton.setFont(fButtons);
this.clearFilterButton.setFont(fButtons);
this.analysisButton.setFont(fButtons);
}
this.addButton.setText("Add to Deck");
this.removeButton.setText("Remove from Deck");
@@ -217,9 +214,7 @@ public final class DeckEditorCommon extends DeckEditorBase {
// Type filtering
final Font f = new Font("Tahoma", Font.PLAIN, 10);
for (final JCheckBox box : this.getFilterBoxes().getAllTypes()) {
if (!Singletons.getModel().getPreferences().isLafFonts()) {
box.setFont(f);
}
box.setOpaque(false);
}

View File

@@ -34,7 +34,6 @@ import javax.swing.JCheckBox;
import net.slightlymagic.maxmtg.Predicate;
import forge.Command;
import forge.Constant;
import forge.Singletons;
import forge.deck.Deck;
import forge.error.ErrorViewer;
import forge.game.GameType;
@@ -213,9 +212,7 @@ public final class DeckEditorQuest extends DeckEditorBase {
this.removeButton.setBounds(new Rectangle(180, 403, 146, 49));
// removeButton.setIcon(upIcon);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.removeButton.setFont(new java.awt.Font("Dialog", 0, 13));
}
this.removeButton.setText("Remove Card");
this.removeButton.addActionListener(new ActionListener() {
@Override
@@ -231,9 +228,7 @@ public final class DeckEditorQuest extends DeckEditorBase {
}
});
// addButton.setIcon(downIcon);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.addButton.setFont(new java.awt.Font("Dialog", 0, 13));
}
this.addButton.setBounds(new Rectangle(23, 403, 146, 49));
this.analysisButton.setText("Deck Analysis");
@@ -243,9 +238,7 @@ public final class DeckEditorQuest extends DeckEditorBase {
DeckEditorQuest.this.analysisButtonActionPerformed(e);
}
});
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.analysisButton.setFont(new java.awt.Font("Dialog", 0, 13));
}
this.analysisButton.setBounds(new Rectangle(578, 426, 166, 25));
/**
@@ -261,9 +254,7 @@ public final class DeckEditorQuest extends DeckEditorBase {
final Font f = new Font("Tahoma", Font.PLAIN, 10);
for (final JCheckBox box : this.getFilterBoxes().getAllTypes()) {
if (!Singletons.getModel().getPreferences().isLafFonts()) {
box.setFont(f);
}
box.setOpaque(false);
box.addItemListener(this.getItemListenerUpdatesDisplay());
}

View File

@@ -36,7 +36,6 @@ import javax.swing.JOptionPane;
import net.slightlymagic.braids.util.lambda.Lambda1;
import net.slightlymagic.maxmtg.Predicate;
import forge.Command;
import forge.Singletons;
import forge.deck.Deck;
import forge.error.ErrorViewer;
import forge.game.GameType;
@@ -227,9 +226,7 @@ public final class DeckEditorShop extends DeckEditorBase {
this.sellButton.setBounds(new Rectangle(180, 403, 146, 49));
// removeButton.setIcon(upIcon);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.sellButton.setFont(new java.awt.Font("Dialog", 0, 13));
}
this.sellButton.setText("Sell Card");
this.sellButton.addActionListener(new java.awt.event.ActionListener() {
@Override
@@ -245,9 +242,7 @@ public final class DeckEditorShop extends DeckEditorBase {
}
});
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.buyButton.setFont(new java.awt.Font("Dialog", 0, 13));
}
this.buyButton.setBounds(new Rectangle(23, 403, 146, 49));
this.getCardView().setBounds(new Rectangle(765, 23, 239, 710));
@@ -257,14 +252,10 @@ public final class DeckEditorShop extends DeckEditorBase {
this.creditsLabel.setBounds(new Rectangle(19, 365, 720, 31));
this.creditsLabel.setText("Total credits: " + this.questData.getCredits());
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.creditsLabel.setFont(new java.awt.Font("Dialog", 0, 14));
}
this.sellPercentageLabel.setBounds(new Rectangle(350, 403, 450, 31));
this.sellPercentageLabel.setText("(Sell percentage: " + this.multiplier + ")");
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.sellPercentageLabel.setFont(new java.awt.Font("Dialog", 0, 14));
}
this.jLabel1.setText("Click on the column name (like name or color) to sort the cards");
this.jLabel1.setBounds(new Rectangle(20, 1, 400, 19));

View File

@@ -40,7 +40,6 @@ import javax.swing.text.Element;
import javax.swing.text.ElementIterator;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.deck.Deck;
import forge.deck.DeckRecognizer;
import forge.deck.DeckRecognizer.TokenType;
@@ -106,14 +105,12 @@ public class DeckImport extends JDialog {
this.setResizable(false);
this.setTitle("Deck Import (wip)");
if (!Singletons.getModel().getPreferences().isLafFonts()) {
final Font fButtons = new java.awt.Font("Dialog", 0, 13);
this.cmdAccept.setFont(fButtons);
this.cmdCancel.setFont(fButtons);
this.txtInput.setFont(fButtons);
// htmlOutput.setFont(fButtons);
}
this.htmlOutput.setEditable(false);

View File

@@ -32,7 +32,6 @@ import javax.swing.table.TableCellRenderer;
import net.slightlymagic.maxmtg.Predicate;
import forge.Constant;
import forge.Singletons;
import forge.card.CardRules;
import forge.item.InventoryItem;
import forge.item.ItemPool;
@@ -133,9 +132,7 @@ public final class TableWithCards {
this.jScrollPane.setToolTipText(tableToolTip);
this.jScrollPane.getViewport().add(this.table, null);
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.statsLabel.setFont(new java.awt.Font("Dialog", 0, 13));
}
this.statsLabel.setText("Total: 0, Creatures: 0, Land: 0");
// class data

View File

@@ -41,7 +41,6 @@ import forge.Constant.Zone;
import forge.Counters;
import forge.GameEntity;
import forge.GuiDisplayUtil;
import forge.Singletons;
/**
* The class CardDetailPanel. Shows the details of a card.
@@ -121,7 +120,6 @@ public class CardDetailPanel extends JPanel implements CardContainer {
this.cdArea.setEditable(false);
this.cdArea.setBorder(new EmptyBorder(4, 4, 4, 4));
if (!Singletons.getModel().getPreferences().isLafFonts()) {
this.nameCostLabel.setFont(new java.awt.Font("Dialog", 0, 14));
this.typeLabel.setFont(new java.awt.Font("Dialog", 0, 14));
this.powerToughnessLabel.setFont(new java.awt.Font("Dialog", 0, 14));
@@ -133,7 +131,6 @@ public class CardDetailPanel extends JPanel implements CardContainer {
this.setInfoLabel.setFont(f);
this.cdArea.setFont(new java.awt.Font("Dialog", 0, 14));
}
this.setCard(card);
}

View File

@@ -67,12 +67,6 @@ public class ForgePreferences extends Preferences {
/** The skin. */
private String skin;
/** The laf. */
private String laf;
/** The laf fonts. */
private boolean lafFonts;
/** The stack offset. */
private StackOffsetType stackOffset;
@@ -158,8 +152,6 @@ public class ForgePreferences extends Preferences {
this.setRandCFoil(this.getBoolean("rand.C.Foil", true));
this.setLaf(this.get("gui.laf", ""));
this.setLafFonts(this.getBoolean("gui.laf.fonts", false));
this.setSkin(this.get("gui.skin", "default"));
this.setCardOverlay(this.getBoolean("card.overlay", true));
@@ -235,8 +227,6 @@ public class ForgePreferences extends Preferences {
this.set("rand.C.Foil", this.isRandCFoil());
this.set("gui.skin", this.getSkin());
this.set("gui.laf", this.getLaf());
this.set("gui.laf.fonts", this.isLafFonts());
this.set("card.overlay", this.isCardOverlay());
this.set("card.images.size", this.getCardSize());
@@ -511,25 +501,6 @@ public class ForgePreferences extends Preferences {
this.developerMode = developerMode; // TODO: Add 0 to parameter's name.
}
/**
* Gets the laf.
*
* @return the laf
*/
public String getLaf() {
return this.laf;
}
/**
* Sets the laf.
*
* @param laf
* the laf to set
*/
public void setLaf(final String laf) {
this.laf = laf; // TODO: Add 0 to parameter's name.
}
/**
* Gets the skin.
*
@@ -545,27 +516,8 @@ public class ForgePreferences extends Preferences {
* @param skin
* the skin to set
*/
public void setSkin(final String skin) {
this.skin = skin; // TODO: Add 0 to parameter's name.
}
/**
* Checks if is laf fonts.
*
* @return the lafFonts
*/
public boolean isLafFonts() {
return this.lafFonts;
}
/**
* Sets the laf fonts.
*
* @param lafFonts
* the lafFonts to set
*/
public void setLafFonts(final boolean lafFonts) {
this.lafFonts = lafFonts; // TODO: Add 0 to parameter's name.
public void setSkin(final String skin0) {
this.skin = skin0;
}
/**
@@ -583,11 +535,8 @@ public class ForgePreferences extends Preferences {
* @param scaleLargerThanOriginal
* the scaleLargerThanOriginal to set
*/
public void setScaleLargerThanOriginal(final boolean scaleLargerThanOriginal) {
this.scaleLargerThanOriginal = scaleLargerThanOriginal; // TODO: Add 0
// to
// parameter's
// name.
public void setScaleLargerThanOriginal(final boolean scaleLargerThanOriginal0) {
this.scaleLargerThanOriginal = scaleLargerThanOriginal0;
}
/**

View File

@@ -839,9 +839,6 @@ public final class NewConstants {
/** The TITLE. */
public static final String TITLE = "%s/NewGame/menu/title";
/** The LF. */
public static final String LF = "%s/NewGame/menu/lookAndFeel";
/** The DOWNLOADPRICE. */
public static final String DOWNLOADPRICE = "%s/NewGame/menu/downloadPrice";

View File

@@ -18,7 +18,6 @@
package forge.view.swing;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import net.slightlymagic.braids.util.UtilFunctions;
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
@@ -114,7 +113,6 @@ public class ApplicationView implements FView {
final ForgePreferences preferences = model.getPreferences();
OldGuiNewGame.getUseLAFFonts().setSelected(preferences.isLafFonts());
OldGuiNewGame.getOldGuiCheckBox().setSelected(preferences.isOldGui());
OldGuiNewGame.getSmoothLandCheckBox().setSelected(preferences.isStackAiLand());
OldGuiNewGame.getDevModeCheckBox().setSelected(preferences.isDeveloperMode());
@@ -134,25 +132,6 @@ public class ApplicationView implements FView {
Log.error("Error loading preferences: " + exn);
}
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11
// 1:07 PM: this isn't a web
// app
@Override
public void run() {
final ForgePreferences finalPreferences = model.getPreferences();
try {
if ("".equals(finalPreferences.getLaf())) {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} else {
UIManager.setLookAndFeel(finalPreferences.getLaf());
}
} catch (final Exception ex) {
ErrorViewer.showError(ex);
}
}
});
// For the following two blocks, check if user has cancelled
// SplashFrame.
// Note: Error thrown sometimes because log file cannot be accessed

View File

@@ -29,8 +29,6 @@ import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import javax.swing.DefaultListModel;
@@ -46,8 +44,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.border.BevelBorder;
import net.slightlymagic.braids.util.UtilFunctions;
@@ -64,6 +60,7 @@ import forge.GuiImportPicture;
import forge.MyRandom;
import forge.PlayerType;
import forge.Singletons;
import forge.control.ControlAllUI;
import forge.deck.Deck;
import forge.deck.DeckGeneration;
import forge.deck.DeckManager;
@@ -85,6 +82,7 @@ import forge.properties.ForgeProps;
import forge.properties.NewConstants.Lang;
import forge.properties.NewConstants.Lang.OldGuiNewGame.NewGameText;
import forge.quest.gui.QuestOptions;
import forge.view.toolbox.FSkin;
/**
* The Class Gui_HomeScreen.
@@ -191,8 +189,7 @@ public class GuiHomeScreen {
private final JCheckBox chkDeveloperMode = new JCheckBox("Developer Mode");
private final JCheckBox chkFoil = new JCheckBox("Random Foiling");
private final JCheckBox chkMana = new JCheckBox("Use Text and Mana Overlay");
private final JButton cmdLAF = new JButton("Choose Look and Feel");
private final JCheckBox chkLAF = new JCheckBox("Use Look and Feel Fonts");
private final JButton cmdChooseSkin = new JButton("Choose Skin");
private final JButton cmdSize = new JButton("Choose Card Size");
private final JCheckBox chkScale = new JCheckBox("Scale Card Image Larger");
private final JButton cmdStack = new JButton("Choose Stack Offset");
@@ -626,7 +623,7 @@ public class GuiHomeScreen {
this.pnlSettings.setLayout(null);
this.gHS.getContentPane().add(this.pnlSettings);
this.scrSettings.setPreferredSize(new Dimension(1, 3));
this.scrSettings.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.scrSettings.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
this.scrSettings.setBackground(this.clrScrollBackground);
this.scrSettings.setOpaque(false);
this.scrSettings.setBounds(10, 12, 305, 320);
@@ -692,28 +689,17 @@ public class GuiHomeScreen {
}
});
this.pnlSettingsA.add(this.chkFoil);
// cmdLAF.setBorderPainted(false);
// cmdLAF.setBorder(new BevelBorder(BevelBorder.RAISED, null,
// null, null, null));
this.cmdLAF.setOpaque(false);
this.cmdLAF.setBackground(this.clrScrollBackground);
this.cmdLAF.addActionListener(new ActionListener() {
this.cmdChooseSkin.setOpaque(false);
this.cmdChooseSkin.setBackground(this.clrScrollBackground);
this.cmdChooseSkin.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg0) {
GuiHomeScreen.this.doLAF();
GuiHomeScreen.this.doChooseSkin();
}
});
this.pnlSettingsA.add(this.cmdLAF);
this.chkLAF.setOpaque(false);
this.chkLAF.setBackground(this.clrScrollBackground);
this.chkLAF.setSelected(Singletons.getModel().getPreferences().isLafFonts());
this.chkLAF.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg0) {
Singletons.getModel().getPreferences().setLafFonts(GuiHomeScreen.this.chkLAF.isSelected());
}
});
this.pnlSettingsA.add(this.chkLAF);
this.pnlSettingsA.add(this.cmdChooseSkin);
this.cmdSize.setOpaque(false);
this.cmdSize.setBackground(this.clrScrollBackground);
this.cmdSize.addActionListener(new ActionListener() {
@@ -1211,7 +1197,15 @@ public class GuiHomeScreen {
return;
}
// Instantiate a new ControlAllUI if using new UI.
if (!Constant.Runtime.OLDGUI[0]) {
final ControlAllUI ui = new ControlAllUI();
AllZone.setDisplay(ui.getMatchView());
ui.getMatchController().initMatch();
} else {
AllZone.setDisplay(new GuiDisplay());
}
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
AllZone.getDisplay().setVisible(true);
}
@@ -1221,52 +1215,8 @@ public class GuiHomeScreen {
this.gHS.dispose();
}
private void doLAF() {
final LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
final HashMap<String, String> lafMap = new HashMap<String, String>();
for (final LookAndFeelInfo anInfo : info) {
lafMap.put(anInfo.getName(), anInfo.getClassName());
}
// add Substance LAFs:
lafMap.put("Autumn", "org.pushingpixels.substance.api.skin.SubstanceAutumnLookAndFeel");
lafMap.put("Business", "org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel");
lafMap.put("Business Black Steel",
"org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel");
lafMap.put("Business Blue Steel", "org.pushingpixels.substance.api.skin.SubstanceBusinessBlueSteelLookAndFeel");
lafMap.put("Challenger Deep", "org.pushingpixels.substance.api.skin.SubstanceChallengerDeepLookAndFeel");
lafMap.put("Creme", "org.pushingpixels.substance.api.skin.SubstanceCremeLookAndFeel");
lafMap.put("Creme Coffee", "org.pushingpixels.substance.api.skin.SubstanceCremeCoffeeLookAndFeel");
lafMap.put("Dust", "org.pushingpixels.substance.api.skin.SubstanceDustLookAndFeel");
lafMap.put("Dust Coffee", "org.pushingpixels.substance.api.skin.SubstanceDustCoffeeLookAndFeel");
lafMap.put("Emerald Dusk", "org.pushingpixels.substance.api.skin.SubstanceEmeraldDuskLookAndFeel");
lafMap.put("Gemini", "org.pushingpixels.substance.api.skin.SubstanceGeminiLookAndFeel");
lafMap.put("Graphite", "org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel");
lafMap.put("Graphite Aqua", "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel");
lafMap.put("Graphite Glass", "org.pushingpixels.substance.api.skin.SubstanceGraphiteGlassLookAndFeel");
lafMap.put("Magma", "org.pushingpixels.substance.api.skin.SubstanceMagmaLookAndFeel");
lafMap.put("Magellan", "org.pushingpixels.substance.api.skin.SubstanceMagellanLookAndFeel");
lafMap.put("Mist Aqua", "org.pushingpixels.substance.api.skin.SubstanceMistAquaLookAndFeel");
lafMap.put("Mist Silver", "org.pushingpixels.substance.api.skin.SubstanceMistSilverLookAndFeel");
lafMap.put("Moderate", "org.pushingpixels.substance.api.skin.SubstanceModerateLookAndFeel");
lafMap.put("Nebula", "org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel");
lafMap.put("Nebula Brick Wall", "org.pushingpixels.substance.api.skin.SubstanceNebulaBrickWallLookAndFeel");
lafMap.put("Office Blue 2007", "org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel");
lafMap.put("Office Silver 2007", "org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel");
lafMap.put("Raven", "org.pushingpixels.substance.api.skin.SubstanceRavenLookAndFeel");
lafMap.put("Raven Graphite", "org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteLookAndFeel");
lafMap.put("Sahara", "org.pushingpixels.substance.api.skin.SubstanceSaharaLookAndFeel");
lafMap.put("Twilight", "org.pushingpixels.substance.api.skin.SubstanceTwilightLookAndFeel");
final String[] keys = new String[lafMap.size()];
int count = 0;
for (final String s1 : lafMap.keySet()) {
keys[count++] = s1;
}
Arrays.sort(keys);
final ListChooser<String> ch = new ListChooser<String>("Choose one", 0, 1, keys);
private void doChooseSkin() {
final ListChooser<String> ch = new ListChooser<String>("Choose a skin", 0, 1, FSkin.getSkins());
if (ch.show()) {
try {
final String name = ch.getSelectedValue();
@@ -1274,11 +1224,7 @@ public class GuiHomeScreen {
if (index == -1) {
return;
}
// UIManager.setLookAndFeel(info[index].getClassName());
Singletons.getModel().getPreferences().setLaf(lafMap.get(name));
UIManager.setLookAndFeel(lafMap.get(name));
// SwingUtilities.updateComponentTreeUI(NG2);
Singletons.getModel().getPreferences().setSkin(name);
} catch (final Exception ex) {
ErrorViewer.showError(ex);
}

View File

@@ -19,7 +19,6 @@ package forge.view.swing;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -28,7 +27,6 @@ import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
@@ -52,8 +50,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.border.TitledBorder;
import net.miginfocom.swing.MigLayout;
@@ -165,9 +161,6 @@ public class OldGuiNewGame extends JFrame {
/** Constant <code>removeArtifacts</code>. */
private static JCheckBoxMenuItem removeArtifacts = new JCheckBoxMenuItem(
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.REMOVE_ARTIFACTS));
/** Constant <code>useLAFFonts</code>. */
private static JCheckBoxMenuItem useLAFFonts = new JCheckBoxMenuItem(
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.FONT));
/** Constant <code>cardOverlay</code>. */
private static JCheckBoxMenuItem cardOverlay = new JCheckBoxMenuItem(
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.CARD_OVERLAY));
@@ -176,7 +169,6 @@ public class OldGuiNewGame extends JFrame {
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.CARD_SCALE));
private final JButton questButton = new JButton();
private final Action lookAndFeelAction = new LookAndFeelAction(this);
// private Action DOWNLOAD_ACTION = new DownloadAction();
private final Action downloadActionLQ = new DownloadActionLQ();
private final Action downloadActionSetLQ = new DownloadActionSetLQ();
@@ -257,26 +249,24 @@ public class OldGuiNewGame extends JFrame {
*/
private void setupMenu() {
final Action[] actions = {
this.// Remove the option to download HQ pics since the HQ pics
// Remove the option to download HQ pics since the HQ pics
// server appears to be offline.
// LOOK_AND_FEEL_ACTION, DNLD_PRICES_ACTION, DOWNLOAD_ACTION,
// DNLD_PRICES_ACTION, DOWNLOAD_ACTION,
// DOWNLOAD_ACTION_LQ, DOWNLOAD_ACTION_SETLQ, IMPORT_PICTURE,
// CARD_SIZES_ACTION,
lookAndFeelAction, this.dnldPricesAction, this.downloadActionLQ, this.downloadActionSetLQ,
this.dnldPricesAction, this.downloadActionLQ, this.downloadActionSetLQ,
this.downloadActionQuest, this.importPicture, this.cardSizesAction, this.cardStackAction,
this.cardStackOffsetAction, this.bugzReporterAction, ErrorViewer.ALL_THREADS_ACTION, this.aboutAction,
this.exitAction };
final JMenu menu = new JMenu(ForgeProps.getLocalized(Menu.TITLE));
for (final Action a : actions) {
menu.add(a);
if (a.equals(this.lookAndFeelAction) || a.equals(this.importPicture)
if (a.equals(this.importPicture)
|| a.equals(this.cardStackOffsetAction) || a.equals(ErrorViewer.ALL_THREADS_ACTION)) {
menu.addSeparator();
}
}
// useLAFFonts.setSelected(false);
// new stuff
final JMenu generatedDeck = new JMenu(
ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Options.Generate.TITLE));
@@ -313,7 +303,6 @@ public class OldGuiNewGame extends JFrame {
final JMenu optionsMenu = new JMenu(ForgeProps.getLocalized(Options.TITLE));
optionsMenu.add(generatedDeck);
optionsMenu.add(OldGuiNewGame.getUseLAFFonts());
optionsMenu.addSeparator();
optionsMenu.add(OldGuiNewGame.getCardOverlay());
optionsMenu.add(OldGuiNewGame.getCardScale());
@@ -1038,107 +1027,6 @@ public class OldGuiNewGame extends JFrame {
this.updateDeckComboBoxes();
}
/**
* The Class LookAndFeelAction.
*
* @author dhudson
*/
public static class LookAndFeelAction extends AbstractAction {
private static final long serialVersionUID = -4447498333866711215L;
private final Component c;
/**
* Instantiates a new look and feel action.
*
* @param component
* the component
*/
public LookAndFeelAction(final Component component) {
super(ForgeProps.getLocalized(NewConstants.Lang.OldGuiNewGame.MenuBar.Menu.LF));
this.c = component;
}
/**
* Action performed.
*
* @param e
* the e
*/
@Override
public final void actionPerformed(final ActionEvent e) {
final LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
final HashMap<String, String> lafMap = new HashMap<String, String>();
for (final LookAndFeelInfo anInfo : info) {
lafMap.put(anInfo.getName(), anInfo.getClassName());
}
// add Substance LAFs:
lafMap.put("Autumn", "org.pushingpixels.substance.api.skin.SubstanceAutumnLookAndFeel");
lafMap.put("Business", "org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel");
lafMap.put("Business Black Steel",
"org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel");
lafMap.put("Business Blue Steel",
"org.pushingpixels.substance.api.skin.SubstanceBusinessBlueSteelLookAndFeel");
lafMap.put("Challenger Deep", "org.pushingpixels.substance.api.skin.SubstanceChallengerDeepLookAndFeel");
lafMap.put("Creme", "org.pushingpixels.substance.api.skin.SubstanceCremeLookAndFeel");
lafMap.put("Creme Coffee", "org.pushingpixels.substance.api.skin.SubstanceCremeCoffeeLookAndFeel");
lafMap.put("Dust", "org.pushingpixels.substance.api.skin.SubstanceDustLookAndFeel");
lafMap.put("Dust Coffee", "org.pushingpixels.substance.api.skin.SubstanceDustCoffeeLookAndFeel");
lafMap.put("Emerald Dusk", "org.pushingpixels.substance.api.skin.SubstanceEmeraldDuskLookAndFeel");
lafMap.put("Gemini", "org.pushingpixels.substance.api.skin.SubstanceGeminiLookAndFeel");
lafMap.put("Graphite", "org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel");
lafMap.put("Graphite Aqua", "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel");
lafMap.put("Graphite Glass", "org.pushingpixels.substance.api.skin.SubstanceGraphiteGlassLookAndFeel");
lafMap.put("Magma", "org.pushingpixels.substance.api.skin.SubstanceMagmaLookAndFeel");
lafMap.put("Magellan", "org.pushingpixels.substance.api.skin.SubstanceMagellanLookAndFeel");
// LAFMap.put("Mariner",
// "org.pushingpixels.substance.api.skin.SubstanceMarinerLookAndFeel");
lafMap.put("Mist Aqua", "org.pushingpixels.substance.api.skin.SubstanceMistAquaLookAndFeel");
lafMap.put("Mist Silver", "org.pushingpixels.substance.api.skin.SubstanceMistSilverLookAndFeel");
lafMap.put("Moderate", "org.pushingpixels.substance.api.skin.SubstanceModerateLookAndFeel");
lafMap.put("Nebula", "org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel");
lafMap.put("Nebula Brick Wall", "org.pushingpixels.substance.api.skin.SubstanceNebulaBrickWallLookAndFeel");
// LAFMap.put("Office Black 2007",
// "org.pushingpixels.substance.api.skin.SubstanceOfficeBlack2007LookAndFeel");
lafMap.put("Office Blue 2007", "org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel");
lafMap.put("Office Silver 2007",
"org.pushingpixels.substance.api.skin.SubstanceOfficeSilver2007LookAndFeel");
lafMap.put("Raven", "org.pushingpixels.substance.api.skin.SubstanceRavenLookAndFeel");
lafMap.put("Raven Graphite", "org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteLookAndFeel");
// LAFMap.put("Raven Graphite Glass",
// "org.pushingpixels.substance.api.skin.SubstanceRavenGraphiteGlassLookAndFeel");
lafMap.put("Sahara", "org.pushingpixels.substance.api.skin.SubstanceSaharaLookAndFeel");
lafMap.put("Twilight", "org.pushingpixels.substance.api.skin.SubstanceTwilightLookAndFeel");
final String[] keys = new String[lafMap.size()];
int count = 0;
for (final String s1 : lafMap.keySet()) {
keys[count++] = s1;
}
Arrays.sort(keys);
final ListChooser<String> ch = new ListChooser<String>("Choose one", 0, 1, keys);
if (ch.show()) {
try {
final String name = ch.getSelectedValue();
final int index = ch.getSelectedIndex();
if (index == -1) {
return;
}
// UIManager.setLookAndFeel(info[index].getClassName());
Singletons.getModel().getPreferences().setLaf(lafMap.get(name));
UIManager.setLookAndFeel(lafMap.get(name));
SwingUtilities.updateComponentTreeUI(this.c);
} catch (final Exception ex) {
ErrorViewer.showError(ex);
}
}
}
}
/**
* The Class DownloadPriceAction.
*
@@ -1678,11 +1566,6 @@ public class OldGuiNewGame extends JFrame {
public final void actionPerformed(final ActionEvent e) {
final JTextArea area = new JTextArea(12, 25);
if (OldGuiNewGame.getUseLAFFonts().isSelected()) {
final Font f = new Font(area.getFont().getName(), Font.PLAIN, 13);
area.setFont(f);
}
area.setText("The various people who have contributed to this project apologize with deep remorse"
+ " for any bugs that you may have noticed.\n\nThe development team.\n\nOriginal author: Forge\n\n"
+ "(Quest icons used created by Teekatas, from his Legendora set:\n"
@@ -1743,8 +1626,7 @@ public class OldGuiNewGame extends JFrame {
public final boolean exit() {
try {
final ForgePreferences preferences = Singletons.getModel().getPreferences();
preferences.setLaf(UIManager.getLookAndFeel().getClass().getName());
preferences.setLafFonts(OldGuiNewGame.getUseLAFFonts().isSelected());
preferences.setSkin(AllZone.getSkin().getName());
preferences.setOldGui(OldGuiNewGame.oldGuiCheckBox.isSelected());
preferences.setStackAiLand(OldGuiNewGame.getSmoothLandCheckBox().isSelected());
preferences.setMillingLossCondition(Constant.Runtime.MILL[0]);
@@ -1957,26 +1839,6 @@ public class OldGuiNewGame extends JFrame {
OldGuiNewGame.cardScale = cardScale; // TODO: Add 0 to parameter's name.
}
/**
* Gets the use laf fonts.
*
* @return the useLAFFonts
*/
public static JCheckBoxMenuItem getUseLAFFonts() {
return OldGuiNewGame.useLAFFonts;
}
/**
* Sets the use laf fonts.
*
* @param useLAFFonts
* the useLAFFonts to set
*/
public static void setUseLAFFonts(final JCheckBoxMenuItem useLAFFonts) {
OldGuiNewGame.useLAFFonts = useLAFFonts; // TODO: Add 0 to parameter's
// name.
}
/**
* Gets the smooth land check box.
*

View File

@@ -25,6 +25,7 @@ import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -52,6 +53,16 @@ public class FSkin {
private Font tempFont;
private final String notfound = "FSkin.java: Can't find ";
private final static String[] SKINS = {"default", "rebel", "smith"};
public static ArrayList<String> getSkins() {
ArrayList<String> mySkins = new ArrayList<String>();
for(int i = 0; i < SKINS.length; i++) {
mySkins.add(SKINS[i]);
}
return mySkins;
}
/**
* FSkin constructor. No arguments, will generate default skin settings,
* fonts, and backgrounds.
@@ -131,8 +142,6 @@ public class FSkin {
this.setIcon("dock.shortcuts", image.getSubimage(160, 0, 80, 80));
this.setIcon("dock.settings", image.getSubimage(160, 80, 80, 80));
this.setIcon("dock.decklist", image.getSubimage(60, 140, 20, 20));
this.setIcon("dock.concede", image.getSubimage(80, 80, 80, 80));
this.setIcon("dock.endturn", image.getSubimage(80, 0, 80, 80));
this.setIcon("dock.concede", image.getSubimage(80, 80, 80, 80));
this.setIcon("dock.decklist", image.getSubimage(80, 160, 80, 80));