mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Deprecated SubButton in favor of FLabel builder.
Fixed display bug in title bar of sealed/draft. Updated quest deck lister to recall previous deck if exists.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -11262,7 +11262,6 @@ src/main/java/forge/view/toolbox/FScrollPane.java -text
|
||||
src/main/java/forge/view/toolbox/FSkin.java -text
|
||||
src/main/java/forge/view/toolbox/FTextArea.java -text
|
||||
src/main/java/forge/view/toolbox/FVerticalTabPanel.java -text
|
||||
src/main/java/forge/view/toolbox/SubButton.java -text
|
||||
src/main/java/forge/view/toolbox/SubTab.java -text
|
||||
src/main/java/forge/view/toolbox/package-info.java svneol=native#text/plain
|
||||
src/main/java/net/slightlymagic/braids/LICENSE.txt svneol=native#text/plain
|
||||
|
||||
@@ -53,10 +53,10 @@ public class ControlQuest {
|
||||
|
||||
private final MouseAdapter madStartGame, madDuels, madChallenges,
|
||||
madQuests, madDecks, madPreferences;
|
||||
private final ActionListener actPetSelect, actPlantSelect,
|
||||
actSpellShop, actBazaar, actEmbark, actNewDeck, actCurrentDeck, actResetPrefs;
|
||||
private final Command cmdDeckExit, cmdDeckDelete, cmdDeckSelect,
|
||||
cmdQuestSelect, cmdQuestDelete;
|
||||
private final ActionListener actPetSelect, actPlantSelect;
|
||||
private final Command cmdSpellShop, cmdBazaar,
|
||||
cmdEmbark, cmdNewDeck, cmdCurrentDeck, cmdResetPrefs, cmdDeckExit,
|
||||
cmdDeckDelete, cmdDeckSelect, cmdQuestSelect, cmdQuestDelete;
|
||||
private Deck currentDeck;
|
||||
private Map<String, QuestData> arrQuests;
|
||||
|
||||
@@ -128,29 +128,29 @@ public class ControlQuest {
|
||||
}
|
||||
};
|
||||
|
||||
actSpellShop = new ActionListener() { @Override
|
||||
public void actionPerformed(ActionEvent e) { showSpellShop(); } };
|
||||
cmdSpellShop = new Command() { @Override
|
||||
public void execute() { showSpellShop(); } };
|
||||
|
||||
actBazaar = new ActionListener() { @Override
|
||||
public void actionPerformed(ActionEvent e) { showBazaar(); } };
|
||||
cmdBazaar = new Command() { @Override
|
||||
public void execute() { showBazaar(); } };
|
||||
|
||||
actEmbark = new ActionListener() { @Override
|
||||
public void actionPerformed(ActionEvent e) { newQuest(); } };
|
||||
cmdEmbark = new Command() { @Override
|
||||
public void execute() { newQuest(); } };
|
||||
|
||||
actCurrentDeck = new ActionListener() { @Override
|
||||
public void actionPerformed(ActionEvent e) { view.showDecksTab(); } };
|
||||
cmdCurrentDeck = new Command() { @Override
|
||||
public void execute() { view.showDecksTab(); } };
|
||||
|
||||
actNewDeck = new ActionListener() { @Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cmdNewDeck = new Command() { @Override
|
||||
public void execute() {
|
||||
final DeckEditorQuest editor = new DeckEditorQuest(qData);
|
||||
editor.show(cmdDeckExit);
|
||||
editor.setVisible(true);
|
||||
}
|
||||
};
|
||||
|
||||
actResetPrefs = new ActionListener() {
|
||||
cmdResetPrefs = new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
public void execute() {
|
||||
qPrefs.reset();
|
||||
qPrefs.save();
|
||||
view.resetPrefs();
|
||||
@@ -171,6 +171,7 @@ public class ControlQuest {
|
||||
@Override
|
||||
public void execute() {
|
||||
currentDeck = view.getLstDecks().getSelectedDeck();
|
||||
qPrefs.setPreference(QPref.CURRENT_DECK, currentDeck.toString());
|
||||
view.setCurrentDeckStatus();
|
||||
}
|
||||
};
|
||||
@@ -246,36 +247,27 @@ public class ControlQuest {
|
||||
view.getTabPreferences().removeMouseListener(madPreferences);
|
||||
view.getTabPreferences().addMouseListener(madPreferences);
|
||||
|
||||
view.getBtnEmbark().removeActionListener(actEmbark);
|
||||
view.getBtnEmbark().addActionListener(actEmbark);
|
||||
|
||||
view.getLstQuests().setSelectCommand(cmdQuestSelect);
|
||||
view.getLstQuests().setEditCommand(cmdQuestDelete);
|
||||
view.getLstQuests().setDeleteCommand(cmdQuestDelete);
|
||||
|
||||
view.getBtnResetPrefs().removeActionListener(actResetPrefs);
|
||||
view.getBtnResetPrefs().addActionListener(actResetPrefs);
|
||||
view.getBtnEmbark().setCommand(cmdEmbark);
|
||||
view.getBtnResetPrefs().setCommand(cmdResetPrefs);
|
||||
|
||||
if (this.qem != null) {
|
||||
view.getBtnStart().removeMouseListener(madStartGame);
|
||||
view.getBtnStart().addMouseListener(madStartGame);
|
||||
|
||||
view.getBtnBazaar().removeActionListener(actBazaar);
|
||||
view.getBtnBazaar().addActionListener(actBazaar);
|
||||
view.getBtnBazaar().setCommand(cmdBazaar);
|
||||
|
||||
view.getBtnNewDeck().removeActionListener(actNewDeck);
|
||||
view.getBtnNewDeck().addActionListener(actNewDeck);
|
||||
view.getBtnNewDeck().setCommand(cmdNewDeck);
|
||||
|
||||
view.getBtnCurrentDeck().removeActionListener(actCurrentDeck);
|
||||
view.getBtnCurrentDeck().addActionListener(actCurrentDeck);
|
||||
view.getBtnCurrentDeck().setCommand(cmdCurrentDeck);
|
||||
|
||||
view.getBtnSpellShop().removeActionListener(actSpellShop);
|
||||
view.getBtnSpellShop().addActionListener(actSpellShop);
|
||||
view.getBtnSpellShop().setCommand(cmdSpellShop);
|
||||
|
||||
view.getCbxPet().removeActionListener(actPetSelect);
|
||||
view.getCbxPet().addActionListener(actPetSelect);
|
||||
|
||||
view.getCbPlant().removeActionListener(actPlantSelect);
|
||||
view.getCbPlant().addActionListener(actPlantSelect);
|
||||
|
||||
view.getLstDecks().setSelectCommand(cmdDeckSelect);
|
||||
@@ -405,19 +397,23 @@ public class ControlQuest {
|
||||
|
||||
/** Resets decks, then retrieves and sets current deck. */
|
||||
public void refreshDecks() {
|
||||
// Retrieve and set all decks
|
||||
Deck[] temp = (qData == null ? new Deck[] {} : qData.getDecks().toArray(new Deck[0]));
|
||||
|
||||
view.getLstDecks().setDecks(temp);
|
||||
|
||||
if (!view.getLstDecks().setSelectedDeck(currentDeck)) {
|
||||
if (!view.getLstDecks().setSelectedIndex(0)) {
|
||||
// Look through list for preferred deck from prefs
|
||||
currentDeck = null;
|
||||
}
|
||||
else {
|
||||
currentDeck = view.getLstDecks().getSelectedDeck();
|
||||
final String cd = qPrefs.getPreference(QPref.CURRENT_DECK);
|
||||
for (Deck d : temp) {
|
||||
if (d.getName().equals(cd)) {
|
||||
currentDeck = d;
|
||||
view.getLstDecks().setSelectedDeck(d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Not found? Set first one. Still not found? OK, throw to setCurrentDeckStatus().
|
||||
if (currentDeck == null) { view.getLstDecks().setSelectedIndex(0); }
|
||||
view.setCurrentDeckStatus();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.properties.ForgePreferences;
|
||||
@@ -46,6 +47,7 @@ public class ControlSettings {
|
||||
}
|
||||
|
||||
/** */
|
||||
@SuppressWarnings("serial")
|
||||
public void addListeners() {
|
||||
this.view.getLstChooseSkin().addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
@@ -149,9 +151,9 @@ public class ControlSettings {
|
||||
}
|
||||
});
|
||||
|
||||
this.view.getBtnReset().addActionListener(new ActionListener() {
|
||||
this.view.getBtnReset().setCommand(new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
public void execute() {
|
||||
Singletons.getModel().getPreferences().reset();
|
||||
view.getParentView().resetSettings();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forge.control.home;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
@@ -32,8 +30,8 @@ import forge.view.toolbox.FSkin;
|
||||
public class ControlUtilities {
|
||||
private ViewUtilities view;
|
||||
private final MouseAdapter madLicensing;
|
||||
private final ActionListener actDeckEditor, actPicDownload, actSetDownload,
|
||||
actQuestImages, actReportBug, actImportPictures, actHowToPlay, actDownloadPrices;
|
||||
private final Command cmdDeckEditor, cmdPicDownload, cmdSetDownload,
|
||||
cmdQuestImages, cmdReportBug, cmdImportPictures, cmdHowToPlay, cmdDownloadPrices;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,6 +39,7 @@ public class ControlUtilities {
|
||||
*
|
||||
* @param v0   ViewUtilities
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public ControlUtilities(ViewUtilities v0) {
|
||||
this.view = v0;
|
||||
|
||||
@@ -59,53 +58,37 @@ public class ControlUtilities {
|
||||
}
|
||||
};
|
||||
|
||||
actDeckEditor = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
showDeckEditor(null, null);
|
||||
}
|
||||
};
|
||||
cmdDeckEditor = new Command() { @Override
|
||||
public void execute() { showDeckEditor(null, null); } };
|
||||
|
||||
actPicDownload = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
doDownloadPics();
|
||||
}
|
||||
};
|
||||
cmdPicDownload = new Command() { @Override
|
||||
public void execute() { doDownloadPics(); } };
|
||||
|
||||
actSetDownload = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
doDownloadSetPics();
|
||||
}
|
||||
};
|
||||
cmdSetDownload = new Command() { @Override
|
||||
public void execute() { doDownloadSetPics(); } };
|
||||
|
||||
actQuestImages = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
doDownloadQuestImages();
|
||||
}
|
||||
};
|
||||
cmdQuestImages = new Command() { @Override
|
||||
public void execute() { doDownloadQuestImages(); } };
|
||||
|
||||
actReportBug = new ActionListener() {
|
||||
cmdReportBug = new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
public void execute() {
|
||||
final BugzReporter br = new BugzReporter();
|
||||
br.setVisible(true);
|
||||
}
|
||||
};
|
||||
|
||||
actImportPictures = new ActionListener() {
|
||||
cmdImportPictures = new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
public void execute() {
|
||||
final GuiImportPicture ip = new GuiImportPicture(null);
|
||||
ip.setVisible(true);
|
||||
}
|
||||
};
|
||||
|
||||
actHowToPlay = new ActionListener() {
|
||||
cmdHowToPlay = new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
public void execute() {
|
||||
final String text = ForgeProps.getLocalized(Lang.HowTo.MESSAGE);
|
||||
|
||||
final JTextArea area = new JTextArea(text, 25, 40);
|
||||
@@ -119,9 +102,9 @@ public class ControlUtilities {
|
||||
}
|
||||
};
|
||||
|
||||
actDownloadPrices = new ActionListener() {
|
||||
cmdDownloadPrices = new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent arg0) {
|
||||
public void execute() {
|
||||
final GuiDownloadPrices gdp = new GuiDownloadPrices();
|
||||
gdp.setVisible(true);
|
||||
}
|
||||
@@ -137,22 +120,15 @@ public class ControlUtilities {
|
||||
|
||||
/** */
|
||||
public void addListeners() {
|
||||
this.view.getBtnDownloadPics().removeActionListener(actPicDownload);
|
||||
this.view.getBtnDownloadPics().addActionListener(actPicDownload);
|
||||
this.view.getBtnDownloadSetPics().removeActionListener(actSetDownload);
|
||||
this.view.getBtnDownloadSetPics().addActionListener(actSetDownload);
|
||||
this.view.getBtnDownloadQuestImages().removeActionListener(actQuestImages);
|
||||
this.view.getBtnDownloadQuestImages().addActionListener(actQuestImages);
|
||||
this.view.getBtnReportBug().removeActionListener(actReportBug);
|
||||
this.view.getBtnReportBug().addActionListener(actReportBug);
|
||||
this.view.getBtnImportPictures().removeActionListener(actImportPictures);
|
||||
this.view.getBtnImportPictures().addActionListener(actImportPictures);
|
||||
this.view.getBtnHowToPlay().removeActionListener(actHowToPlay);
|
||||
this.view.getBtnHowToPlay().addActionListener(actHowToPlay);
|
||||
this.view.getBtnDownloadPrices().removeActionListener(actDownloadPrices);
|
||||
this.view.getBtnDownloadPrices().addActionListener(actDownloadPrices);
|
||||
this.view.getBtnDeckEditor().removeActionListener(actDeckEditor);
|
||||
this.view.getBtnDeckEditor().addActionListener(actDeckEditor);
|
||||
this.view.getBtnDownloadPics().setCommand(cmdPicDownload);
|
||||
this.view.getBtnDownloadSetPics().setCommand(cmdSetDownload);
|
||||
this.view.getBtnDownloadQuestImages().setCommand(cmdQuestImages);
|
||||
this.view.getBtnReportBug().setCommand(cmdReportBug);
|
||||
this.view.getBtnImportPictures().setCommand(cmdImportPictures);
|
||||
this.view.getBtnHowToPlay().setCommand(cmdHowToPlay);
|
||||
this.view.getBtnDownloadPrices().setCommand(cmdDownloadPrices);
|
||||
this.view.getBtnDeckEditor().setCommand(cmdDeckEditor);
|
||||
|
||||
this.view.getLblLicensing().removeMouseListener(madLicensing);
|
||||
this.view.getLblLicensing().addMouseListener(madLicensing);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class QuestPreferences implements Serializable {
|
||||
|
||||
PENALTY_LOSS ("15"), /** */
|
||||
CURRENT_QUEST ("DEFAULT"), /** */
|
||||
CURRENT_DECK ("DEFAULT"), /** */
|
||||
|
||||
REWARDS_BASE ("25"), /** */
|
||||
REWARDS_UNDEFEATED ("25"), /** */
|
||||
|
||||
@@ -51,14 +51,11 @@ public class BazaarTopLevel extends FPanel {
|
||||
|
||||
private void populateStalls() {
|
||||
for (final String s : QuestStallManager.getStallNames()) {
|
||||
final FLabel lbl = new FLabel.Builder().text(s + " ").fontAlign(SwingConstants.RIGHT).build();
|
||||
final FLabel lbl = new FLabel.Builder().text(s + " ")
|
||||
.fontAlign(SwingConstants.RIGHT).iconInBackground(true)
|
||||
.fontScaleFactor(0.3).opaque(true).hoverable(true)
|
||||
.icon(QuestStallManager.getStall(s).getIcon()).selectable(true).build();
|
||||
|
||||
lbl.setIcon(QuestStallManager.getStall(s).getIcon());
|
||||
lbl.setIconInBackground(true);
|
||||
lbl.setFontScaleFactor(0.3);
|
||||
lbl.setOpaque(true);
|
||||
lbl.setHoverable(true);
|
||||
lbl.setSelectable(true);
|
||||
pnlAllStalls.add(lbl, "h 80px!, w 90%!, gap 0 0 10px 10px");
|
||||
|
||||
lbl.setCommand(new Command() {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package forge.view.bazaar;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||
import forge.view.GuiTopLevel;
|
||||
@@ -15,32 +14,24 @@ import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FRoundedPanel;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.FTextArea;
|
||||
import forge.view.toolbox.SubButton;
|
||||
|
||||
/** An update-able panel instance representing a single item. */
|
||||
@SuppressWarnings("serial")
|
||||
public class ViewItem extends FRoundedPanel {
|
||||
private final FLabel lblIcon, lblName, lblPrice;
|
||||
private final FLabel lblIcon, lblName, lblPrice, btnPurchase;
|
||||
private final FTextArea tarDesc;
|
||||
private final SubButton btnPurchase;
|
||||
private QuestStallPurchasable item;
|
||||
|
||||
/** An update-able panel instance representing a single item. */
|
||||
public ViewItem() {
|
||||
// Final inits
|
||||
lblIcon = new FLabel.Builder().build();
|
||||
lblName = new FLabel.Builder().build();
|
||||
lblPrice = new FLabel.Builder().build();
|
||||
lblIcon = new FLabel.Builder().iconScaleFactor(1).iconInBackground(true).build();
|
||||
lblName = new FLabel.Builder().fontStyle(Font.BOLD).build();
|
||||
lblPrice = new FLabel.Builder().fontStyle(Font.BOLD).fontScaleFactor(0.8).build();
|
||||
tarDesc = new FTextArea();
|
||||
btnPurchase = new SubButton("Buy");
|
||||
btnPurchase = new FLabel.Builder().text("Buy").opaque(true).fontScaleFactor(0.2).hoverable(true).build();
|
||||
|
||||
// Component styling
|
||||
this.setBackground(Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_THEME2));
|
||||
this.lblName.setFontStyle(Font.BOLD);
|
||||
this.lblPrice.setFontStyle(Font.BOLD);
|
||||
this.lblPrice.setFontScaleFactor(0.8);
|
||||
this.lblIcon.setIconInBackground(true);
|
||||
this.lblIcon.setIconScaleFactor(1);
|
||||
|
||||
// Layout
|
||||
this.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
@@ -52,9 +43,9 @@ public class ViewItem extends FRoundedPanel {
|
||||
this.add(tarDesc, "w 60%!, gap 0 0 0 10px, wrap");
|
||||
this.add(lblPrice, "w 60%!, h 20px!, gap 0 0 0 5px");
|
||||
|
||||
btnPurchase.addActionListener(new ActionListener() {
|
||||
btnPurchase.setCommand(new Command() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
public void execute() {
|
||||
AllZone.getQuestData().subtractCredits(getItem().getBuyingPrice());
|
||||
AllZone.getQuestData().addCredits(getItem().getSellingPrice());
|
||||
getItem().onPurchase();
|
||||
|
||||
@@ -68,7 +68,9 @@ public class ViewStall extends JPanel {
|
||||
this.lblEmpty = new FLabel.Builder()
|
||||
.text("The merchant does not have anything useful for sale.")
|
||||
.fontAlign(SwingConstants.CENTER).build();
|
||||
this.lblStats = new FLabel.Builder().build();
|
||||
this.lblStats = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.fontScaleFactor(0.9).build();
|
||||
|
||||
this.tpnFluff = new JTextPane();
|
||||
this.pnlInventory = new JPanel();
|
||||
this.scrInventory = new FScrollPane(pnlInventory);
|
||||
@@ -97,9 +99,6 @@ public class ViewStall extends JPanel {
|
||||
scrInventory.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
scrInventory.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
lblStats.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblStats.setFontScaleFactor(0.9);
|
||||
|
||||
// Layout
|
||||
this.setLayout(new MigLayout("insets 0, gap 0, wrap, ay center"));
|
||||
this.add(lblStallName, "w 90%!, h 40px!, gap 5% 0 10px 0");
|
||||
|
||||
@@ -59,7 +59,6 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
lblErrDifficulty.setForeground(Color.red);
|
||||
lblErrBooster.setForeground(Color.red);
|
||||
lblErrShop.setForeground(Color.red);
|
||||
lblErrShop.setFontStyle(Font.BOLD);
|
||||
|
||||
// Rewards panel
|
||||
pnlRewards.setOpaque(false);
|
||||
|
||||
@@ -11,11 +11,11 @@ import javax.swing.SwingConstants;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Singletons;
|
||||
import forge.control.home.ControlConstructed;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FList;
|
||||
import forge.view.toolbox.FProgressBar;
|
||||
import forge.view.toolbox.FScrollPane;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.SubButton;
|
||||
|
||||
/**
|
||||
* Assembles swing components for "Constructed" mode menu.
|
||||
@@ -29,7 +29,7 @@ public class ViewConstructed extends JPanel {
|
||||
private final JButton btnStart;
|
||||
private final FProgressBar barProgress;
|
||||
|
||||
private SubButton btnHumanRandomTheme, btnHumanRandomDeck, btnAIRandomTheme, btnAIRandomDeck;
|
||||
private FLabel btnHumanRandomTheme, btnHumanRandomDeck, btnAIRandomTheme, btnAIRandomDeck;
|
||||
private JList lstDecksAI;
|
||||
private FList lstColorsHuman, lstThemesHuman, lstDecksHuman, lstColorsAI, lstThemesAI;
|
||||
|
||||
@@ -107,8 +107,10 @@ public class ViewConstructed extends JPanel {
|
||||
lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
// Random theme and pre-constructed buttons
|
||||
btnHumanRandomTheme = new SubButton("Random Theme Deck");
|
||||
btnHumanRandomDeck = new SubButton("Random Deck");
|
||||
btnHumanRandomTheme = new FLabel.Builder().opaque(true)
|
||||
.hoverable(true).text("Random Theme Deck").build();
|
||||
btnHumanRandomDeck = new FLabel.Builder().opaque(true)
|
||||
.hoverable(true).text("Random Deck").build();
|
||||
|
||||
// Add components to human area
|
||||
JPanel colorsContainer = new JPanel();
|
||||
@@ -180,8 +182,10 @@ public class ViewConstructed extends JPanel {
|
||||
lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
// Random theme and pre-constructed deck buttons
|
||||
btnAIRandomTheme = new SubButton("Random Theme Deck");
|
||||
btnAIRandomDeck = new SubButton("Random Deck");
|
||||
btnAIRandomTheme = new FLabel.Builder().opaque(true)
|
||||
.hoverable(true).text("Random Theme Deck").build();
|
||||
btnAIRandomDeck = new FLabel.Builder().opaque(true)
|
||||
.hoverable(true).text("Random Deck").build();
|
||||
|
||||
// Add components to AI area
|
||||
JPanel colorsContainer = new JPanel();
|
||||
@@ -256,23 +260,23 @@ public class ViewConstructed extends JPanel {
|
||||
return lstDecksAI;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnHumanRandomTheme() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnHumanRandomTheme() {
|
||||
return btnHumanRandomTheme;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnAIRandomTheme() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnAIRandomTheme() {
|
||||
return btnAIRandomTheme;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnHumanRandomDeck() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnHumanRandomDeck() {
|
||||
return btnHumanRandomDeck;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnAIRandomDeck() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnAIRandomDeck() {
|
||||
return btnAIRandomDeck;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ import forge.control.home.ControlDraft;
|
||||
import forge.game.GameType;
|
||||
import forge.view.toolbox.DeckLister;
|
||||
import forge.view.toolbox.FButton;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FList;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
import forge.view.toolbox.FPanel;
|
||||
import forge.view.toolbox.FProgressBar;
|
||||
import forge.view.toolbox.FScrollPane;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.SubButton;
|
||||
|
||||
/**
|
||||
* Assembles swing components for "Draft" mode menu.
|
||||
@@ -45,7 +45,8 @@ public class ViewDraft extends JPanel {
|
||||
private final DeckLister lstHumanDecks;
|
||||
private final JTextPane tpnDirections;
|
||||
private final JLabel lblDirections;
|
||||
private final JButton btnBuildDeck, btnStart;
|
||||
private final JButton btnStart;
|
||||
private final FLabel btnBuildDeck;
|
||||
|
||||
private String[] opponentNames = new String[] {
|
||||
"Abigail", "Ada", "Adeline", "Adriana", "Agatha", "Agnes", "Aileen", "Alba", "Alcyon",
|
||||
@@ -174,7 +175,7 @@ public class ViewDraft extends JPanel {
|
||||
lstAI = new FList(ai);
|
||||
this.add(new FScrollPane(lstAI), "w 25%!, h 37%!, gap 0 0 2% 0, span 1 2, wrap");
|
||||
|
||||
btnBuildDeck = new SubButton("Build A New Deck");
|
||||
btnBuildDeck = new FLabel.Builder().opaque(true).hoverable(true).text("Build A New Deck").build();
|
||||
this.add(btnBuildDeck, "w 60%!, h 5%!, gap 5% 5% 0 0, wrap");
|
||||
|
||||
lblDirections = new JLabel("Click For Directions");
|
||||
@@ -244,8 +245,8 @@ public class ViewDraft extends JPanel {
|
||||
return lblDirections;
|
||||
}
|
||||
|
||||
/** @return JButton */
|
||||
public JButton getBtnBuildDeck() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnBuildDeck() {
|
||||
return btnBuildDeck;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import forge.view.toolbox.FRoundedPanel;
|
||||
import forge.view.toolbox.FScrollPane;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.FTextArea;
|
||||
import forge.view.toolbox.SubButton;
|
||||
import forge.view.toolbox.SubTab;
|
||||
|
||||
/**
|
||||
@@ -56,11 +55,11 @@ public class ViewQuest extends JScrollPane {
|
||||
pnlDecks, pnlLoadQuest, pnlPrefs,
|
||||
tabDuels, tabChallenges, tabDecks, tabQuests, tabPreferences;
|
||||
private final FLabel lblTitle, lblLife, lblCredits,
|
||||
lblWins, lblLosses, lblNextChallengeInWins, lblWinStreak;
|
||||
|
||||
private final JButton btnBazaar, btnSpellShop, btnStart, btnEmbark,
|
||||
lblWins, lblLosses, lblNextChallengeInWins, lblWinStreak, btnBazaar, btnSpellShop, btnEmbark,
|
||||
btnResetPrefs, btnNewDeck, btnCurrentDeck;
|
||||
|
||||
private final StartButton btnStart;
|
||||
|
||||
private final JCheckBox cbPlant, cbZep, cbStandardStart;
|
||||
private final JComboBox cbxPet;
|
||||
private final JRadioButton radEasy, radMedium, radHard, radExpert, radFantasy, radClassic;
|
||||
@@ -107,7 +106,8 @@ public class ViewQuest extends JScrollPane {
|
||||
pnlLoadQuest = new JPanel();
|
||||
pnlPrefs = new JPanel();
|
||||
|
||||
lblTitle = new FLabel.Builder().text("New Quest").fontAlign(SwingConstants.CENTER).build();
|
||||
lblTitle = new FLabel.Builder().text("New Quest").fontAlign(SwingConstants.CENTER)
|
||||
.fontScaleBy(SwingConstants.HORIZONTAL).fontScaleFactor(0.035).build();
|
||||
lblLife = new FLabel.Builder().build();
|
||||
lblCredits = new FLabel.Builder().build();
|
||||
lblWins = new FLabel.Builder().build();
|
||||
@@ -122,13 +122,17 @@ public class ViewQuest extends JScrollPane {
|
||||
radFantasy = new FRadioButton("Fantasy");
|
||||
radClassic = new FRadioButton("Classic");
|
||||
|
||||
btnCurrentDeck = new SubButton();
|
||||
btnBazaar = new SubButton("Bazaar");
|
||||
btnSpellShop = new SubButton("Spell Shop");
|
||||
btnCurrentDeck = new FLabel.Builder().opaque(true).hoverable(true).build();
|
||||
btnBazaar = new FLabel.Builder().selectable(true).opaque(true).hoverable(true).text("Bazaar")
|
||||
.fontScaleAuto(false).tooltip("Peruse the Bazaar").build();
|
||||
btnBazaar.setFont(Singletons.getView().getSkin().getFont(14));
|
||||
btnSpellShop = new FLabel.Builder().opaque(true).hoverable(true).text("Spell Shop")
|
||||
.fontScaleAuto(false).tooltip("Travel to the Spell Shop").build();
|
||||
btnSpellShop.setFont(Singletons.getView().getSkin().getFont(14));
|
||||
btnStart = new StartButton(parentView);
|
||||
btnEmbark = new SubButton("Embark!");
|
||||
btnNewDeck = new SubButton("Build a New Deck");
|
||||
btnResetPrefs = new SubButton("Reset to Defaults");
|
||||
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();
|
||||
btnResetPrefs = new FLabel.Builder().opaque(true).hoverable(true).text("Reset to Defaults").build();
|
||||
cbxPet = new JComboBox();
|
||||
cbStandardStart = new FCheckBox("Standard (Type 2) Starting Pool");
|
||||
cbPlant = new FCheckBox("Summon Plant");
|
||||
@@ -207,8 +211,6 @@ public class ViewQuest extends JScrollPane {
|
||||
pnlTitle.setBackground(skin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
((FRoundedPanel) pnlTitle).setBorderColor(clrBorders);
|
||||
|
||||
((FLabel) lblTitle).setFontScaleBy(SwingConstants.HORIZONTAL);
|
||||
((FLabel) lblTitle).setFontScaleFactor(0.035);
|
||||
pnlTitle.add(lblTitle, "w 98%!, h 70%!, gap 0 0 15%! 15%!");
|
||||
}
|
||||
|
||||
@@ -222,8 +224,6 @@ public class ViewQuest extends JScrollPane {
|
||||
lblWins.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_PLUS));
|
||||
lblLosses.setIcon(skin.getIcon(FSkin.QuestIcons.ICO_MINUS));
|
||||
lblNextChallengeInWins.setText("No challenges available.");
|
||||
btnBazaar.setToolTipText("Peruse the Bazaar");
|
||||
btnSpellShop.setToolTipText("Travel to the Spell Shop");
|
||||
}
|
||||
|
||||
/** Layout permanent parts of duels panel. */
|
||||
@@ -705,8 +705,8 @@ public class ViewQuest extends JScrollPane {
|
||||
return lblWinStreak;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnCurrentDeck() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnCurrentDeck() {
|
||||
return btnCurrentDeck;
|
||||
}
|
||||
|
||||
@@ -715,28 +715,28 @@ public class ViewQuest extends JScrollPane {
|
||||
return btnStart;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnBazaar() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnBazaar() {
|
||||
return btnBazaar;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnSpellShop() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnSpellShop() {
|
||||
return btnSpellShop;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnEmbark() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnEmbark() {
|
||||
return btnEmbark;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnResetPrefs() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnResetPrefs() {
|
||||
return btnResetPrefs;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnNewDeck() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnNewDeck() {
|
||||
return btnNewDeck;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ import forge.Singletons;
|
||||
import forge.control.home.ControlSealed;
|
||||
import forge.game.GameType;
|
||||
import forge.view.toolbox.DeckLister;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FProgressBar;
|
||||
import forge.view.toolbox.FScrollPane;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.SubButton;
|
||||
|
||||
/**
|
||||
* Assembles swing components for "Sealed" mode menu.
|
||||
@@ -25,7 +25,8 @@ public class ViewSealed extends JPanel {
|
||||
private final HomeTopLevel parentView;
|
||||
private final ControlSealed control;
|
||||
private DeckLister lstHumanDecks;
|
||||
private final JButton btnBuild, btnStart;
|
||||
private final JButton btnStart;
|
||||
private final FLabel btnBuild;
|
||||
private final FProgressBar barProgress;
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,7 @@ public class ViewSealed extends JPanel {
|
||||
lstHumanDecks = new DeckLister(GameType.Sealed, control.getExitCommand());
|
||||
|
||||
// Build button
|
||||
btnBuild = new SubButton("Build A New Deck");
|
||||
btnBuild = new FLabel.Builder().opaque(true).hoverable(true).text("Build A New Deck").build();
|
||||
|
||||
// Start button
|
||||
btnStart = new StartButton(parentView);
|
||||
@@ -84,8 +85,8 @@ public class ViewSealed extends JPanel {
|
||||
return control;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnBuild() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnBuild() {
|
||||
return btnBuild;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
@@ -43,7 +42,6 @@ import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FList;
|
||||
import forge.view.toolbox.FScrollPane;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.SubButton;
|
||||
|
||||
/**
|
||||
* Assembles swing components for "Settings" mode menu.
|
||||
@@ -54,7 +52,7 @@ public class ViewSettings extends JScrollPane {
|
||||
private final ControlSettings control;
|
||||
private final FSkin skin;
|
||||
private final JPanel viewport;
|
||||
private final JButton btnReset;
|
||||
private final FLabel btnReset;
|
||||
private HomeTopLevel parentView;
|
||||
|
||||
private JList lstChooseSkin;
|
||||
@@ -200,7 +198,7 @@ public class ViewSettings extends JScrollPane {
|
||||
final JLabel lblReset = new SectionLabel(" ");
|
||||
viewport.add(lblReset, sectionConstraints);
|
||||
|
||||
btnReset = new SubButton("Reset to defaults");
|
||||
btnReset = new FLabel.Builder().opaque(true).hoverable(true).text("Reset to defaults").build();
|
||||
viewport.add(btnReset, sectionConstraints);
|
||||
|
||||
this.control = new ControlSettings(this);
|
||||
@@ -467,8 +465,8 @@ public class ViewSettings extends JScrollPane {
|
||||
return parentView;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.home.HomeTopLevel} */
|
||||
public JButton getBtnReset() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnReset() {
|
||||
return btnReset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
import forge.view.toolbox.FPanel;
|
||||
import forge.view.toolbox.FSkin;
|
||||
import forge.view.toolbox.SubButton;
|
||||
|
||||
/**
|
||||
* Assembles swing components for "Utilities" mode menu.
|
||||
@@ -36,7 +35,7 @@ public class ViewUtilities extends JPanel {
|
||||
private final JTextPane tpnLicensing;
|
||||
private final JLabel lblLicensing;
|
||||
|
||||
private SubButton btnDownloadSetPics, btnDownloadPics, btnDownloadQuestImages, btnReportBug, btnImportPictures,
|
||||
private FLabel btnDownloadSetPics, btnDownloadPics, btnDownloadQuestImages, btnReportBug, btnImportPictures,
|
||||
btnHowToPlay, btnDownloadPrices, btnDeckEditor;
|
||||
|
||||
private final String license = "Forge License Information" + "\r\n\r\n"
|
||||
@@ -67,14 +66,16 @@ public class ViewUtilities extends JPanel {
|
||||
final String constraintsLBL = "w 90%!, h 20px!, gap 5% 0 3px 8px";
|
||||
final String constraintsBTN = "h 30px!, w 50%!, gap 25% 0 0 0";
|
||||
|
||||
btnDownloadPics = new SubButton("Download LQ Card Pictures");
|
||||
btnDownloadPics = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Download LQ Card Pictures").fontScaleFactor(0.5).build();
|
||||
final FLabel lblPics = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Download default card picture for each card.").fontStyle(Font.ITALIC).build();
|
||||
|
||||
this.add(btnDownloadPics, constraintsBTN);
|
||||
this.add(lblPics, constraintsLBL);
|
||||
|
||||
btnDownloadSetPics = new SubButton("Download LQ Set Pictures");
|
||||
btnDownloadSetPics = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Download LQ Set Pictures").fontScaleFactor(0.5).build();
|
||||
final FLabel lblSets = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Download full card picture sets for all cards from legacy releases of MTG.")
|
||||
.fontStyle(Font.ITALIC).build();
|
||||
@@ -82,14 +83,16 @@ public class ViewUtilities extends JPanel {
|
||||
this.add(btnDownloadSetPics, constraintsBTN);
|
||||
this.add(lblSets, constraintsLBL);
|
||||
|
||||
btnDownloadQuestImages = new SubButton("Download Quest Images");
|
||||
btnDownloadQuestImages = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Download Quest Images").fontScaleFactor(0.5).build();
|
||||
final FLabel lblQuest = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Download tokens and icons used in Quest mode.").fontStyle(Font.ITALIC).build();
|
||||
|
||||
this.add(btnDownloadQuestImages, constraintsBTN);
|
||||
this.add(lblQuest, constraintsLBL);
|
||||
|
||||
btnDownloadPrices = new SubButton("Download Card Prices");
|
||||
btnDownloadPrices = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Download Card Prices").fontScaleFactor(0.5).build();
|
||||
final FLabel lblPrices = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Download up-to-date price list for in-game card shops.")
|
||||
.fontStyle(Font.ITALIC).build();
|
||||
@@ -97,28 +100,31 @@ public class ViewUtilities extends JPanel {
|
||||
this.add(btnDownloadPrices, constraintsBTN);
|
||||
this.add(lblPrices, constraintsLBL);
|
||||
|
||||
btnImportPictures = new SubButton("Import Pictures");
|
||||
btnImportPictures = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Import Pictures").fontScaleFactor(0.5).build();
|
||||
final FLabel lblImport = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Import card pictures from a local version of Forge.")
|
||||
.fontStyle(Font.ITALIC).build();
|
||||
this.add(btnImportPictures, constraintsBTN);
|
||||
this.add(lblImport, constraintsLBL);
|
||||
|
||||
btnReportBug = new SubButton("Report a Bug");
|
||||
btnReportBug = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Report a Bug").fontScaleFactor(0.5).build();
|
||||
final FLabel lblReport = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Something broken?").fontStyle(Font.ITALIC).build();
|
||||
|
||||
this.add(btnReportBug, constraintsBTN);
|
||||
this.add(lblReport, constraintsLBL);
|
||||
|
||||
btnDeckEditor = new SubButton("Deck Editor");
|
||||
btnDeckEditor = new FLabel.Builder().opaque(true).hoverable(true)
|
||||
.text("Deck Editor").fontScaleFactor(0.5).build();
|
||||
final FLabel lblEditor = new FLabel.Builder().fontAlign(SwingConstants.CENTER)
|
||||
.text("Build or edit a deck using all cards available in Forge.")
|
||||
.fontStyle(Font.ITALIC).build();
|
||||
this.add(btnDeckEditor, constraintsBTN);
|
||||
this.add(lblEditor, constraintsLBL);
|
||||
|
||||
btnHowToPlay = new SubButton("How To Play");
|
||||
btnHowToPlay = new FLabel.Builder().opaque(true).hoverable(true).text("How To Play");
|
||||
this.add(btnHowToPlay, constraintsBTN);
|
||||
|
||||
tpnLicensing = new JTextPane();
|
||||
@@ -171,43 +177,43 @@ public class ViewUtilities extends JPanel {
|
||||
overlay.showOverlay();
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnDownloadPics() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnDownloadPics() {
|
||||
return btnDownloadPics;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnDownloadSetPics() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnDownloadSetPics() {
|
||||
return btnDownloadSetPics;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnDownloadQuestImages() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnDownloadQuestImages() {
|
||||
return btnDownloadQuestImages;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnReportBug() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnReportBug() {
|
||||
return btnReportBug;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnImportPictures() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnImportPictures() {
|
||||
return btnImportPictures;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnHowToPlay() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnHowToPlay() {
|
||||
return btnHowToPlay;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnDownloadPrices() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnDownloadPrices() {
|
||||
return btnDownloadPrices;
|
||||
}
|
||||
|
||||
/** @return SubButton */
|
||||
public SubButton getBtnDeckEditor() {
|
||||
/** @return {@link forge.view.toolbox.FLabel} */
|
||||
public FLabel getBtnDeckEditor() {
|
||||
return btnDeckEditor;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
@Override
|
||||
public final void startNextRound() {
|
||||
AllZone.getDisplay().savePrefs();
|
||||
this.model.qPrefs.save();
|
||||
|
||||
if (Constant.Quest.FANTASY_QUEST[0]) {
|
||||
int extraLife = 0;
|
||||
@@ -299,7 +300,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
AllZone.setQuestEvent(null);
|
||||
|
||||
this.model.qData.saveData();
|
||||
|
||||
this.model.qPrefs.save();
|
||||
AllZone.getDisplay().savePrefs();
|
||||
|
||||
FControl g = ((GuiTopLevel) AllZone.getDisplay()).getController();
|
||||
@@ -546,7 +547,6 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
|
||||
final GameFormat selected = ch.getSelectedValue();
|
||||
this.model.qPrefs.setPreference(QPref.BOOSTER_FORMAT, selected.toString());
|
||||
this.model.qPrefs.save();
|
||||
|
||||
final List<CardPrinted> cardsWon = this.model.qData.getCards().addCards(selected.getFilterPrinted());
|
||||
|
||||
|
||||
@@ -95,11 +95,15 @@ public class DeckLister extends JPanel {
|
||||
rowTitle.setBackground(skin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
|
||||
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER), "w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Edit").fontAlign(SwingConstants.CENTER), "w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Deck Name").fontAlign(SwingConstants.CENTER), "w 60%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Main").fontAlign(SwingConstants.CENTER), "w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Side").fontAlign(SwingConstants.CENTER), "w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(),
|
||||
"w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Edit").fontAlign(SwingConstants.CENTER).build(),
|
||||
"w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Deck Name").fontAlign(SwingConstants.CENTER).build(), "w 60%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Main").fontAlign(SwingConstants.CENTER).build(),
|
||||
"w 10%!, h 20px!, gaptop 5px");
|
||||
rowTitle.add(new FLabel.Builder().text("Side").fontAlign(SwingConstants.CENTER).build(),
|
||||
"w 10%!, h 20px!, gaptop 5px");
|
||||
this.add(rowTitle, "w 98%!, h 30px!, gapleft 1%");
|
||||
|
||||
RowPanel row;
|
||||
|
||||
@@ -24,7 +24,7 @@ import forge.Singletons;
|
||||
* Credit to Effective Java 2 (Joshua Bloch).
|
||||
* Methods in builder can be chained. To declare:
|
||||
* <code>new FLabel.Builder().method1(foo).method2(bar).method3(baz)...</code>
|
||||
* <br>and then call build() to make the label.
|
||||
* <br>and then call build() to make the label (don't forget that part).
|
||||
* <br><br>
|
||||
* Adjustable features of FLabel:<br>
|
||||
* - Automatic font scaling (60% size by default, can toggle on/off)<br>
|
||||
@@ -41,7 +41,7 @@ public class FLabel extends JLabel {
|
||||
* Credit to Effective Java 2 (Joshua Bloch), a fantastic book.
|
||||
* Methods in builder can be chained. To declare:
|
||||
* <code>new FLabel.Builder().method1(foo).method2(bar).method3(baz)...</code>
|
||||
* <br>and then call build() to make the label.
|
||||
* <br>and then call build() to make the label (don't forget that part).
|
||||
*/
|
||||
public static class Builder extends FLabel {
|
||||
//========== Default values for FLabel are set here.
|
||||
@@ -144,22 +144,24 @@ public class FLabel extends JLabel {
|
||||
// Init fields from builder
|
||||
this.fontScaleFactor = b0.bldFontScaleFactor;
|
||||
this.iconScaleFactor = b0.bldIconScaleFactor;
|
||||
this.fontScaleBy = b0.bldFontScaleBy;
|
||||
this.fontStyle = b0.bldFontStyle;
|
||||
|
||||
this.selectable = b0.bldSelectable;
|
||||
this.hoverable = b0.bldHoverable;
|
||||
this.opaque = b0.bldOpaque;
|
||||
this.iconInBackground = b0.bldIconInBackground;
|
||||
this.fontScaleAuto = b0.bldFontScaleAuto;
|
||||
this.iconScaleAuto = b0.bldIconScaleAuto;
|
||||
this.selectable = b0.bldSelectable;
|
||||
|
||||
this.setIcon(b0.bldIcon);
|
||||
this.setFontScaleBy(b0.bldFontScaleBy);
|
||||
this.setFontStyle(b0.bldFontStyle);
|
||||
this.setIconAlpha(b0.bldIconAlpha);
|
||||
this.setCommand(b0.bldCmd);
|
||||
this.setFontAlign(b0.bldFontAlign);
|
||||
this.setText(b0.bldText);
|
||||
this.setToolTipText(b0.bldToolTip);
|
||||
this.setHoverable(b0.bldHoverable);
|
||||
|
||||
// Call this last; to allow the properties which affect icons to already be in place.
|
||||
this.setIcon(b0.bldIcon);
|
||||
|
||||
// Non-custom display properties
|
||||
this.setForeground(clrText);
|
||||
@@ -176,8 +178,8 @@ public class FLabel extends JLabel {
|
||||
private final Color clrText = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_TEXT);
|
||||
private final Color clrBorders = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_BORDERS);
|
||||
private final Color clrHover = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final Color clrInactive = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
private final Color clrActive = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private final Color clrInactive = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private final Color clrActive = Singletons.getView().getSkin().getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
|
||||
// Custom properties, assigned either at realization (using builder)
|
||||
// or dynamically (using methods below).
|
||||
@@ -233,14 +235,15 @@ public class FLabel extends JLabel {
|
||||
public void mouseExited(MouseEvent e) { hovered = false; repaint(); }
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
cmdClick.execute();
|
||||
if (!selectable) { return; }
|
||||
if (selected) { setSelected(false); }
|
||||
else { setSelected(true); }
|
||||
cmdClick.execute();
|
||||
}
|
||||
};
|
||||
|
||||
/** @param b0   boolean */
|
||||
// Must be public.
|
||||
public void setHoverable(boolean b0) {
|
||||
this.hoverable = b0;
|
||||
if (!b0) { this.removeMouseListener(madEvents); }
|
||||
@@ -248,55 +251,23 @@ public class FLabel extends JLabel {
|
||||
}
|
||||
|
||||
/** @param b0   boolean */
|
||||
public void setSelectable(boolean b0) {
|
||||
this.selectable = b0;
|
||||
}
|
||||
|
||||
/** @param b0   boolean */
|
||||
// Must be public.
|
||||
public void setSelected(boolean b0) {
|
||||
this.selected = b0;
|
||||
repaint();
|
||||
}
|
||||
|
||||
/** @param d0   Scale factor for font size relative to label height, percent.
|
||||
* If your font is "blowing up", try setting an explicity height/width for this label. */
|
||||
public void setFontScaleFactor(final double d0) {
|
||||
this.fontScaleFactor = d0;
|
||||
}
|
||||
|
||||
/** @param b0   {@link java.lang.boolean} */
|
||||
public void setFontScaleAuto(final boolean b0) {
|
||||
this.fontScaleAuto = b0;
|
||||
}
|
||||
|
||||
/** @param d0   Scale factor for icon size relative to label height, percent. */
|
||||
public void setIconScaleFactor(final double d0) {
|
||||
this.iconScaleFactor = d0;
|
||||
}
|
||||
|
||||
/** @param b0   Font drawn in background, or positioned by default. */
|
||||
public void setIconInBackground(final boolean b0) {
|
||||
this.iconInBackground = b0;
|
||||
// Reset icon in case this method has been called after setIcon().
|
||||
if (b0 && img != null) { setIcon(new ImageIcon(img)); }
|
||||
}
|
||||
|
||||
/** @param b0   {@link java.lang.boolean} */
|
||||
public void setIconScaleAuto(final boolean b0) {
|
||||
this.iconScaleAuto = b0;
|
||||
// Reset icon in case this method has been called after setIcon().
|
||||
if (!b0 && img != null) { setIcon(new ImageIcon(img)); }
|
||||
}
|
||||
|
||||
/** Sets alpha if icon is in background.
|
||||
* @param f0   float */
|
||||
public void setIconAlpha(float f0) {
|
||||
// NOT public; must be set when label is built.
|
||||
private void setIconAlpha(float f0) {
|
||||
this.alphaDim = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, f0);
|
||||
this.alphaStrong = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f);
|
||||
}
|
||||
|
||||
/** @param i0   int, must be SwingConstants.HORIZONTAL or VERTICAL */
|
||||
public void setFontScaleBy(int i0) {
|
||||
// NOT public; must be set when label is built.
|
||||
private void setFontScaleBy(int i0) {
|
||||
if (i0 != SwingConstants.HORIZONTAL && i0 != SwingConstants.VERTICAL) {
|
||||
throw new IllegalArgumentException("FLabel$setScaleBy "
|
||||
+ "must be passed either SwingConstants.HORIZONTAL "
|
||||
@@ -307,7 +278,8 @@ public class FLabel extends JLabel {
|
||||
}
|
||||
|
||||
/** @param i0   Font.PLAIN, .BOLD, or .ITALIC */
|
||||
public void setFontStyle(int i0) {
|
||||
// NOT public; must be set when label is built.
|
||||
private void setFontStyle(int i0) {
|
||||
if (i0 != Font.PLAIN && i0 != Font.BOLD && i0 != Font.ITALIC) {
|
||||
throw new IllegalArgumentException("FLabel$setFontStyle "
|
||||
+ "must be passed either Font.PLAIN, Font.BOLD, or Font.ITALIC.");
|
||||
@@ -316,7 +288,8 @@ public class FLabel extends JLabel {
|
||||
}
|
||||
|
||||
/** @param i0   SwingConstants.CENTER, .LEFT or .RIGHT */
|
||||
public void setFontAlign(int i0) {
|
||||
// NOT public; must be set when label is built.
|
||||
private void setFontAlign(int i0) {
|
||||
if (i0 != SwingConstants.CENTER && i0 != SwingConstants.LEFT && i0 != SwingConstants.RIGHT) {
|
||||
throw new IllegalArgumentException("FLabel$setFontStyle "
|
||||
+ "must be passed either SwingConstants.CENTER, "
|
||||
@@ -326,6 +299,7 @@ public class FLabel extends JLabel {
|
||||
}
|
||||
|
||||
@Override
|
||||
// Must be public.
|
||||
public void setIcon(final Icon i0) {
|
||||
if (i0 == null) { this.img = null; return; }
|
||||
// Will need image (not icon) for scaled and non-scaled.
|
||||
@@ -347,11 +321,6 @@ public class FLabel extends JLabel {
|
||||
this.cmdClick = c0;
|
||||
}
|
||||
|
||||
/** @return {@link forge.Command} on click */
|
||||
public Command getCommand() {
|
||||
return this.cmdClick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOpaque(final boolean b0) {
|
||||
// Must be overridden to allow drawing order of background, icon, string
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
package forge.view.toolbox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* Standard button used for for submenus on the home screen.
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SubButton extends JButton {
|
||||
private FSkin skin;
|
||||
private final Color clrHover, clrInactive;
|
||||
|
||||
/** */
|
||||
public SubButton() {
|
||||
this("");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Standard button used for for submenus on the home screen.
|
||||
*
|
||||
* @param txt0   String
|
||||
*/
|
||||
public SubButton(String txt0) {
|
||||
super(txt0);
|
||||
this.skin = Singletons.getView().getSkin();
|
||||
this.clrHover = skin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
this.clrInactive = skin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
|
||||
setBorder(new LineBorder(skin.getColor(FSkin.Colors.CLR_BORDERS), 1));
|
||||
setBackground(clrInactive);
|
||||
setForeground(skin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
setVerticalTextPosition(SwingConstants.CENTER);
|
||||
setFocusPainted(false);
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (isEnabled() && !isSelected()) { setBackground(clrHover); }
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (isEnabled() && !isSelected()) { setBackground(clrInactive); }
|
||||
}
|
||||
});
|
||||
|
||||
this.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
int px = (int) (SubButton.this.getHeight() / 2);
|
||||
px = (px < 10 ? 10 : px);
|
||||
px = (px > 15 ? 15 : px);
|
||||
SubButton.this.setFont(Singletons.getView().getSkin().getFont(px));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean b0) {
|
||||
super.setEnabled(b0);
|
||||
|
||||
if (b0) { setBackground(skin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||
else { setBackground(new Color(220, 220, 220)); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean b0) {
|
||||
super.setSelected(b0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
g.setColor(getBackground());
|
||||
g.clearRect(0, 0, getWidth(), getHeight());
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
super.paintComponent(g);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user