Refactor skinning logic to avoid caching components, allowing memory to be cleared and improving performance

This commit is contained in:
drdev
2014-01-09 19:05:51 +00:00
parent c60c041012
commit 04248f0166
109 changed files with 1874 additions and 1471 deletions

View File

@@ -290,12 +290,6 @@ public enum FControl implements KeyEventDispatcher {
clearChildren(JLayeredPane.DEFAULT_LAYER);
SOverlayUtils.hideOverlay();
if (previousScreenClosed) { //dispose of all components on closed screen
for (final Component c : FView.SINGLETON_INSTANCE.getPnlInsets().getComponents()) {
FSkin.dispose(c);
}
}
ImageCache.clear(); //reduce memory usage by clearing image cache when switching screens
this.currentScreen = screen;

View File

@@ -27,7 +27,6 @@ import java.util.Iterator;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
@@ -52,6 +51,7 @@ import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FHtmlViewer;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.item.IPaperCard;
import forge.item.InventoryItemFromSet;
import forge.item.SealedProduct;
@@ -90,10 +90,9 @@ public class CardDetailPanel extends FPanel {
labelConstrains.gridy = 0;
labelConstrains.weightx = 1.0;
final JPanel cdLabels = new JPanel(new GridLayout(0, 1, 0, 5));
final FSkin.JComponentSkin<JPanel> cdLabelsSkin = FSkin.get(cdLabels);
cdLabelsSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
cdLabelsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
final SkinnedPanel cdLabels = new SkinnedPanel(new GridLayout(0, 1, 0, 5));
cdLabels.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
cdLabels.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.nameCostLabel = new FLabel.Builder().build();
this.typeLabel = new FLabel.Builder().build();
this.powerToughnessLabel = new FLabel.Builder().build();
@@ -101,10 +100,9 @@ public class CardDetailPanel extends FPanel {
cdLabels.add(this.typeLabel);
cdLabels.add(this.powerToughnessLabel);
final JPanel idr = new JPanel(new GridBagLayout());
FSkin.JComponentSkin<JPanel> idrSkin = FSkin.get(idr);
idrSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
idrSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
final SkinnedPanel idr = new SkinnedPanel(new GridBagLayout());
idr.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
idr.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
final GridBagConstraints c1 = new GridBagConstraints();
final GridBagConstraints c2 = new GridBagConstraints();

View File

@@ -27,8 +27,6 @@ import forge.ImageCache;
import forge.Singletons;
import forge.card.CardCharacteristicName;
import forge.game.card.Card;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.imaging.FImagePanel;
import forge.gui.toolbox.imaging.FImagePanel.AutoSizeImageMode;
import forge.gui.toolbox.imaging.FImageUtil;
@@ -48,14 +46,12 @@ public final class CardPicturePanel extends JPanel {
private Object displayed;
private final FImagePanel panel;
private final JComponentSkin<FImagePanel> panelSkin;
private BufferedImage currentImage;
public CardPicturePanel() {
super(new BorderLayout());
this.panel = new FImagePanel();
this.panelSkin = FSkin.get(this.panel);
this.add(this.panel);
}
@@ -71,7 +67,7 @@ public final class CardPicturePanel extends JPanel {
}
public void setCardImage(CardCharacteristicName flipState) {
BufferedImage image = FImageUtil.getImage((Card)displayed, flipState, this.panelSkin);
BufferedImage image = FImageUtil.getImage((Card)displayed, flipState);
if (image != null && image != this.currentImage) {
this.currentImage = image;
this.panel.setImage(image, getAutoSizeImageMode());
@@ -95,7 +91,7 @@ public final class CardPicturePanel extends JPanel {
image = ImageCache.getOriginalImage(ImageCache.getImageKey(item, false), true);
} else if (displayed instanceof Card) {
image = FImageUtil.getImage((Card)displayed, this.panelSkin);
image = FImageUtil.getImage((Card)displayed);
}
return image;

View File

@@ -7,10 +7,7 @@ import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import org.apache.commons.lang3.StringUtils;
@@ -19,6 +16,7 @@ import net.miginfocom.swing.MigLayout;
import forge.control.ChatArea;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.gui.toolbox.FTextArea;
import forge.gui.toolbox.FTextField;
import forge.gui.toolbox.SmartScroller;
@@ -32,14 +30,14 @@ import forge.net.Lobby;
public enum FNetOverlay {
SINGLETON_INSTANCE;
private final JPanel pnl = new OverlayPanel();
private final OverlayPanel pnl = new OverlayPanel();
/** @return {@link javax.swing.JPanel} */
public JPanel getPanel() {
public SkinnedPanel getPanel() {
return this.pnl;
}
private final JTextArea txtLog = new FTextArea();
private final JTextField txtInput = new FTextField.Builder().maxLength(60).build();
private final FTextArea txtLog = new FTextArea();
private final FTextField txtInput = new FTextField.Builder().maxLength(60).build();
private final FLabel cmdSend = new FLabel.ButtonBuilder().text("Send").build();
@@ -67,11 +65,10 @@ public enum FNetOverlay {
* Semi-transparent overlay panel. Should be used with layered panes.
*/
private FNetOverlay() {
FSkin.JComponentSkin<JPanel> pnlSkin = FSkin.get(pnl);
pnl.setOpaque(false);
pnl.setVisible(false);
pnlSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
pnlSkin.setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
pnl.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 2"));
// pnl.add(new FLabel.Builder().text("Loading new game...").fontSize(22).build(), "h 40px!, align center");
@@ -80,7 +77,7 @@ public enum FNetOverlay {
txtLog.setOpaque(true);
txtLog.setFocusable(true);
FSkin.get(txtLog).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
txtLog.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
JScrollPane _operationLogScroller = new JScrollPane(txtLog);
_operationLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
@@ -88,7 +85,7 @@ public enum FNetOverlay {
new SmartScroller(_operationLogScroller);
pnl.add(_operationLogScroller, "pushx, hmin 24, pushy, growy, growx, gap 2px 2px 2px 0, sx 2");
FSkin.get(txtInput).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
txtInput.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
pnl.add(txtInput, "pushx, growx, h 26px!, gap 2px 2px 2px 0");
pnl.add(cmdSend, "w 60px!, h 28px!, gap 0 0 2px 0");
@@ -101,7 +98,7 @@ public enum FNetOverlay {
pnl.setVisible(true);
}
private class OverlayPanel extends JPanel {
private class OverlayPanel extends SkinnedPanel {
private static final long serialVersionUID = -5056220798272120558L;
/**

View File

@@ -8,10 +8,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.FocusManager;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.gui.match.TargetingOverlay;
@@ -19,6 +18,8 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FOverlay;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedButton;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* All overlay interaction is handled here.
@@ -42,7 +43,7 @@ public final class SOverlayUtils {
// (which is preset with null layout and close button)
final FPanel pnl = new FPanel();
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap"));
FSkin.get(pnl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
pnl.setBounds(new Rectangle(((w - pnlW) / 2), ((h - pnlH) / 2), pnlW, pnlH));
pnl.add(new FLabel.Builder().icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_LOGO)).build(),
@@ -66,9 +67,9 @@ public final class SOverlayUtils {
final int w = overlay.getWidth();
final int h = overlay.getHeight();
final JLabel lblLoading = new JLabel("");
final SkinnedLabel lblLoading = new SkinnedLabel("");
lblLoading.setOpaque(true);
FSkin.get(lblLoading).setBackground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblLoading.setBackground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblLoading.setMinimumSize(new Dimension(0, 20));
pnlLoading.setBounds(((w - 170) / 2), ((h - 80) / 2), 170, 80);
@@ -101,11 +102,10 @@ public final class SOverlayUtils {
final JPanel overlay = FOverlay.SINGLETON_INSTANCE.getPanel();
final int w = overlay.getWidth();
final JButton btnCloseTopRight = new JButton("X");
final FSkin.JComponentSkin<JButton> btnCloseTopRightSkin = FSkin.get(btnCloseTopRight);
final SkinnedButton btnCloseTopRight = new SkinnedButton("X");
btnCloseTopRight.setBounds(w - 25, 10, 15, 15);
btnCloseTopRightSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
btnCloseTopRightSkin.setLineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT));
btnCloseTopRight.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
btnCloseTopRight.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT)));
btnCloseTopRight.setOpaque(false);
btnCloseTopRight.setBackground(new Color(0, 0, 0));
btnCloseTopRight.setFocusPainted(false);

View File

@@ -3,6 +3,7 @@ package forge.gui.bazaar;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Command;
@@ -107,9 +108,9 @@ public enum VBazaarUI implements IVTopLevelUI {
@Override
public void populate() {
FPanel pnl = FView.SINGLETON_INSTANCE.getPnlInsets();
pnl.setBorder(null);
pnl.setBorder((Border)null);
pnl.setLayout(new MigLayout("insets 0, gap 0"));
FSkin.get(pnl).setBackgroundTexture(FSkin.getIcon(FSkin.Backgrounds.BG_TEXTURE));
pnl.setBackgroundTexture(FSkin.getIcon(FSkin.Backgrounds.BG_TEXTURE));
pnl.add(pnlAllStalls, "w 25%!, h 100%!");
pnl.add(pnlSingleStall, "w 75%!, h 100%!");

View File

@@ -126,8 +126,8 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
txtInput.setEditable(true);
FSkin.SkinColor foreColor = FSkin.getColor(FSkin.Colors.CLR_TEXT);
FSkin.get(this.scrollInput).setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Paste or type a decklist", foreColor));
FSkin.get(this.scrollOutput).setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Expect the recognized lines to appear", foreColor));
this.scrollInput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Paste or type a decklist", foreColor));
this.scrollOutput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Expect the recognized lines to appear", foreColor));
this.scrollInput.setViewportBorder(BorderFactory.createLoweredBevelBorder());
this.scrollOutput.setViewportBorder(BorderFactory.createLoweredBevelBorder());

View File

@@ -5,13 +5,13 @@ import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import forge.gui.deckeditor.CDeckEditorUI;
import forge.gui.deckeditor.views.VCurrentDeck;
import forge.gui.menus.MenuUtil;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedMenuItem;
/**
* Returns a JMenu containing options associated with current game.
@@ -40,7 +40,7 @@ public final class DeckFileMenu {
return menu;
}
private static JMenuItem menuItem_Save, menuItem_SaveAs;
private static SkinnedMenuItem menuItem_Save, menuItem_SaveAs;
public static void updateSaveEnabled() {
if (menuItem_Save != null) {
@@ -51,9 +51,9 @@ public final class DeckFileMenu {
}
}
private static JMenuItem getMenuItem_New() {
JMenuItem menuItem = new JMenuItem("New Deck");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_NEW) : null);
private static SkinnedMenuItem getMenuItem_New() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("New Deck");
menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_NEW) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_N));
menuItem.addActionListener(getNewAction());
return menuItem;
@@ -68,9 +68,9 @@ public final class DeckFileMenu {
};
}
private static JMenuItem getMenuItem_Open() {
JMenuItem menuItem = new JMenuItem("Open Deck");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_OPEN) : null);
private static SkinnedMenuItem getMenuItem_Open() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Open Deck");
menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_OPEN) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_O));
menuItem.addActionListener(getOpenAction());
return menuItem;
@@ -85,8 +85,8 @@ public final class DeckFileMenu {
};
}
private static JMenuItem getMenuItem_Import() {
JMenuItem menuItem = new JMenuItem("Import Deck");
private static SkinnedMenuItem getMenuItem_Import() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Import Deck");
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_I));
menuItem.addActionListener(getImportAction());
return menuItem;
@@ -101,9 +101,9 @@ public final class DeckFileMenu {
};
}
private static JMenuItem getMenuItem_Save() {
JMenuItem menuItem = new JMenuItem("Save Deck");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVE) : null);
private static SkinnedMenuItem getMenuItem_Save() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Deck");
menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVE) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_S));
menuItem.addActionListener(getSaveAction());
menuItem_Save = menuItem;
@@ -119,9 +119,9 @@ public final class DeckFileMenu {
};
}
private static JMenuItem getMenuItem_SaveAs() {
JMenuItem menuItem = new JMenuItem("Save Deck As");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVEAS) : null);
private static SkinnedMenuItem getMenuItem_SaveAs() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Deck As");
menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVEAS) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_E));
menuItem.addActionListener(getSaveAsAction());
menuItem_SaveAs = menuItem;
@@ -137,9 +137,9 @@ public final class DeckFileMenu {
};
}
private static JMenuItem getMenuItem_Print() {
JMenuItem menuItem = new JMenuItem("Print to HTML file");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_PRINT) : null);
private static SkinnedMenuItem getMenuItem_Print() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Print to HTML file");
menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_PRINT) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_P));
menuItem.addActionListener(getPrintAction());
return menuItem;

View File

@@ -1,7 +1,6 @@
package forge.gui.deckeditor.views;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import net.miginfocom.swing.MigLayout;
@@ -27,82 +26,82 @@ public enum VEditorPreferences implements IVDoc<CEditorPreferences> {
private DragCell parentCell;
private final DragTab tab = new DragTab("Preferences");
private JLabel lblStats = new FLabel.Builder()
private FLabel lblStats = new FLabel.Builder()
.text("General").tooltip("Configure high-level UI components")
.fontSize(12).build();
private JLabel lblCatalog = new FLabel.Builder()
private FLabel lblCatalog = new FLabel.Builder()
.text("Card Catalog Columns").tooltip("Toggle columns in card catalog panel")
.fontSize(12).build();
private JLabel lblDeck = new FLabel.Builder()
private FLabel lblDeck = new FLabel.Builder()
.text("Current Deck Columns").tooltip("Toggle columns in current deck panel")
.fontSize(12).build();
private JLabel lblDisplay = new FLabel.Builder()
private FLabel lblDisplay = new FLabel.Builder()
.text("Card Catalog Options").tooltip("Toggle card catalog display options")
.fontSize(12).build();
private JCheckBox chbCatalogColor = new FCheckBox("Color");
private JCheckBox chbCatalogRarity = new FCheckBox("Rarity");
private JCheckBox chbCatalogCMC = new FCheckBox("CMC");
private JCheckBox chbCatalogSet = new FCheckBox("Set");
private JCheckBox chbCatalogAI = new FCheckBox("AI");
private JCheckBox chbCatalogRanking = new FCheckBox("Ranking");
private JCheckBox chbCatalogPower = new FCheckBox("Power");
private JCheckBox chbCatalogToughness = new FCheckBox("Toughness");
private JCheckBox chbCatalogFavorite = new FCheckBox("Favorite");
private JCheckBox chbCatalogOwned = new FCheckBox("Owned (Spell shop)");
private FCheckBox chbCatalogColor = new FCheckBox("Color");
private FCheckBox chbCatalogRarity = new FCheckBox("Rarity");
private FCheckBox chbCatalogCMC = new FCheckBox("CMC");
private FCheckBox chbCatalogSet = new FCheckBox("Set");
private FCheckBox chbCatalogAI = new FCheckBox("AI");
private FCheckBox chbCatalogRanking = new FCheckBox("Ranking");
private FCheckBox chbCatalogPower = new FCheckBox("Power");
private FCheckBox chbCatalogToughness = new FCheckBox("Toughness");
private FCheckBox chbCatalogFavorite = new FCheckBox("Favorite");
private FCheckBox chbCatalogOwned = new FCheckBox("Owned (Spell shop)");
private JCheckBox chbDeckColor = new FCheckBox("Color");
private JCheckBox chbDeckRarity = new FCheckBox("Rarity");
private JCheckBox chbDeckCMC = new FCheckBox("CMC");
private JCheckBox chbDeckSet = new FCheckBox("Set");
private JCheckBox chbDeckAI = new FCheckBox("AI");
private JCheckBox chbDeckRanking = new FCheckBox("Ranking");
private JCheckBox chbDeckPower = new FCheckBox("Power");
private JCheckBox chbDeckToughness = new FCheckBox("Toughness");
private FCheckBox chbDeckColor = new FCheckBox("Color");
private FCheckBox chbDeckRarity = new FCheckBox("Rarity");
private FCheckBox chbDeckCMC = new FCheckBox("CMC");
private FCheckBox chbDeckSet = new FCheckBox("Set");
private FCheckBox chbDeckAI = new FCheckBox("AI");
private FCheckBox chbDeckRanking = new FCheckBox("Ranking");
private FCheckBox chbDeckPower = new FCheckBox("Power");
private FCheckBox chbDeckToughness = new FCheckBox("Toughness");
private JCheckBox chbElasticColumns = new FCheckBox("Use elastic resizing when changing column widths");
private FCheckBox chbElasticColumns = new FCheckBox("Use elastic resizing when changing column widths");
private JCheckBox chbCardDisplayUnique = new FCheckBox("Show unique cards only (only affects Constructed)");
private FCheckBox chbCardDisplayUnique = new FCheckBox("Show unique cards only (only affects Constructed)");
private JPanel pnl = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax left"));
private JScrollPane scroller = new JScrollPane(pnl);
//========== Constructor
private VEditorPreferences() {
FSkin.get(lblStats).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
FSkin.get(lblCatalog).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
FSkin.get(lblDeck).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
FSkin.get(lblDisplay).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
lblStats.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblCatalog.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblDeck.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblDisplay.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
FSkin.SkinFont font = FSkin.getFont(12);
FSkin.get(chbCatalogColor).setFont(font);
FSkin.get(chbCatalogRarity).setFont(font);
FSkin.get(chbCatalogCMC).setFont(font);
FSkin.get(chbCatalogSet).setFont(font);
FSkin.get(chbCatalogAI).setFont(font);
FSkin.get(chbCatalogRanking).setFont(font);
FSkin.get(chbCatalogPower).setFont(font);
FSkin.get(chbCatalogToughness).setFont(font);
FSkin.get(chbCatalogFavorite).setFont(font);
FSkin.get(chbCatalogOwned).setFont(font);
chbCatalogColor.setFont(font);
chbCatalogRarity.setFont(font);
chbCatalogCMC.setFont(font);
chbCatalogSet.setFont(font);
chbCatalogAI.setFont(font);
chbCatalogRanking.setFont(font);
chbCatalogPower.setFont(font);
chbCatalogToughness.setFont(font);
chbCatalogFavorite.setFont(font);
chbCatalogOwned.setFont(font);
FSkin.get(chbDeckColor).setFont(font);
FSkin.get(chbDeckRarity).setFont(font);
FSkin.get(chbDeckCMC).setFont(font);
FSkin.get(chbDeckSet).setFont(font);
FSkin.get(chbDeckAI).setFont(font);
FSkin.get(chbDeckRanking).setFont(font);
FSkin.get(chbDeckPower).setFont(font);
FSkin.get(chbDeckToughness).setFont(font);
chbDeckColor.setFont(font);
chbDeckRarity.setFont(font);
chbDeckCMC.setFont(font);
chbDeckSet.setFont(font);
chbDeckAI.setFont(font);
chbDeckRanking.setFont(font);
chbDeckPower.setFont(font);
chbDeckToughness.setFont(font);
FSkin.get(chbElasticColumns).setFont(font);
chbElasticColumns.setFont(font);
chbElasticColumns.setSelected(false);
FSkin.get(chbCardDisplayUnique).setFont(font);
chbCardDisplayUnique.setFont(font);
chbCardDisplayUnique.setSelected(false);
pnl.add(lblStats, "h 25px!, gap 5px 5px 5px 5px, ax left, span 2 1");

View File

@@ -64,13 +64,11 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
scroller.getViewport().setBorder(null);
scroller.getVerticalScrollBar().setUnitIncrement(16);
FSkin.JLabelSkin<FLabel> labelSkin = FSkin.get(lblSampleHand);
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblSampleHand.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblSampleHand.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
labelSkin = FSkin.get(lblRemainingDraws);
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblRemainingDraws.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblRemainingDraws.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Core layout
pnlContent.add(lblReshuffle, "w 96%!, h 29px!, gap 2% 0 5px 5px");
@@ -160,7 +158,7 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
}
private <T extends InventoryItem, TModel extends DeckBase> JLabel buildLabel(final boolean zebra) {
final JLabel lbl = new FLabel.Builder().text("--")
final FLabel lbl = new FLabel.Builder().text("--")
.fontAlign(SwingConstants.CENTER).fontSize(13)
.build();
@@ -189,7 +187,7 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
if (zebra) {
lbl.setOpaque(true);
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
}
return lbl;

View File

@@ -2,7 +2,7 @@ package forge.gui.deckeditor.views;
import java.awt.Font;
import javax.swing.JLabel;
import forge.gui.toolbox.FLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -12,7 +12,6 @@ import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinImage;
import forge.gui.toolbox.itemmanager.SItemManagerUtil;
@@ -31,43 +30,43 @@ public enum VStatistics implements IVDoc<CStatistics> {
private final DragTab tab = new DragTab("Statistics");
// Global stats
private JLabel lblTotal = new FLabel.Builder()
private FLabel lblTotal = new FLabel.Builder()
.text("Total cards: 0").tooltip("TOTAL CARDS")
.fontStyle(Font.BOLD).fontSize(11).fontStyle(Font.BOLD).build();
private JLabel lblTMC = new FLabel.Builder()
private FLabel lblTMC = new FLabel.Builder()
.text("Total mana cost: 0").tooltip("TOTAL MANA COST")
.fontStyle(Font.BOLD).fontSize(11).fontStyle(Font.BOLD).build();
private JLabel lblAMC = new FLabel.Builder()
private FLabel lblAMC = new FLabel.Builder()
.text("Average mana cost: 0.00").tooltip("AVERAGE MANA COST")
.fontStyle(Font.BOLD).fontSize(11).fontStyle(Font.BOLD).build();
// Total and color count labels
private final JPanel pnlStats = new JPanel();
private final JLabel lblMulti = buildLabel(SItemManagerUtil.StatTypes.MULTICOLOR, true);
private final JLabel lblBlack = buildLabel(SItemManagerUtil.StatTypes.BLACK, false);
private final JLabel lblBlue = buildLabel(SItemManagerUtil.StatTypes.BLUE, true);
private final JLabel lblGreen = buildLabel(SItemManagerUtil.StatTypes.GREEN, false);
private final JLabel lblRed = buildLabel(SItemManagerUtil.StatTypes.RED, true);
private final JLabel lblWhite = buildLabel(SItemManagerUtil.StatTypes.WHITE, false);
private final JLabel lblColorless = buildLabel(SItemManagerUtil.StatTypes.COLORLESS, true);
private final FLabel lblMulti = buildLabel(SItemManagerUtil.StatTypes.MULTICOLOR, true);
private final FLabel lblBlack = buildLabel(SItemManagerUtil.StatTypes.BLACK, false);
private final FLabel lblBlue = buildLabel(SItemManagerUtil.StatTypes.BLUE, true);
private final FLabel lblGreen = buildLabel(SItemManagerUtil.StatTypes.GREEN, false);
private final FLabel lblRed = buildLabel(SItemManagerUtil.StatTypes.RED, true);
private final FLabel lblWhite = buildLabel(SItemManagerUtil.StatTypes.WHITE, false);
private final FLabel lblColorless = buildLabel(SItemManagerUtil.StatTypes.COLORLESS, true);
// Card type labels
private final JLabel lblArtifact = buildLabel(SItemManagerUtil.StatTypes.ARTIFACT, true);
private final JLabel lblCreature = buildLabel(SItemManagerUtil.StatTypes.CREATURE, false);
private final JLabel lblEnchantment = buildLabel(SItemManagerUtil.StatTypes.ENCHANTMENT, true);
private final JLabel lblInstant = buildLabel(SItemManagerUtil.StatTypes.INSTANT, false);
private final JLabel lblLand = buildLabel(SItemManagerUtil.StatTypes.LAND, true);
private final JLabel lblPlaneswalker = buildLabel(SItemManagerUtil.StatTypes.PLANESWALKER, false);
private final JLabel lblSorcery = buildLabel(SItemManagerUtil.StatTypes.SORCERY, true);
private final FLabel lblArtifact = buildLabel(SItemManagerUtil.StatTypes.ARTIFACT, true);
private final FLabel lblCreature = buildLabel(SItemManagerUtil.StatTypes.CREATURE, false);
private final FLabel lblEnchantment = buildLabel(SItemManagerUtil.StatTypes.ENCHANTMENT, true);
private final FLabel lblInstant = buildLabel(SItemManagerUtil.StatTypes.INSTANT, false);
private final FLabel lblLand = buildLabel(SItemManagerUtil.StatTypes.LAND, true);
private final FLabel lblPlaneswalker = buildLabel(SItemManagerUtil.StatTypes.PLANESWALKER, false);
private final FLabel lblSorcery = buildLabel(SItemManagerUtil.StatTypes.SORCERY, true);
// CMC labels
private final JLabel lblCMC0 = buildLabel(SItemManagerUtil.StatTypes.CMC_0, true);
private final JLabel lblCMC1 = buildLabel(SItemManagerUtil.StatTypes.CMC_1, false);
private final JLabel lblCMC2 = buildLabel(SItemManagerUtil.StatTypes.CMC_2, true);
private final JLabel lblCMC3 = buildLabel(SItemManagerUtil.StatTypes.CMC_3, false);
private final JLabel lblCMC4 = buildLabel(SItemManagerUtil.StatTypes.CMC_4, true);
private final JLabel lblCMC5 = buildLabel(SItemManagerUtil.StatTypes.CMC_5, false);
private final JLabel lblCMC6 = buildLabel(SItemManagerUtil.StatTypes.CMC_6, true);
private final FLabel lblCMC0 = buildLabel(SItemManagerUtil.StatTypes.CMC_0, true);
private final FLabel lblCMC1 = buildLabel(SItemManagerUtil.StatTypes.CMC_1, false);
private final FLabel lblCMC2 = buildLabel(SItemManagerUtil.StatTypes.CMC_2, true);
private final FLabel lblCMC3 = buildLabel(SItemManagerUtil.StatTypes.CMC_3, false);
private final FLabel lblCMC4 = buildLabel(SItemManagerUtil.StatTypes.CMC_4, true);
private final FLabel lblCMC5 = buildLabel(SItemManagerUtil.StatTypes.CMC_5, false);
private final FLabel lblCMC6 = buildLabel(SItemManagerUtil.StatTypes.CMC_6, true);
// Layout containers
private final JScrollPane scroller = new JScrollPane(pnlStats);
@@ -199,73 +198,73 @@ public enum VStatistics implements IVDoc<CStatistics> {
//========== Retrieval methods
/** @return {@link javax.swing.JLabel} */
public JLabel getLblMulti() { return lblMulti; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblBlack() { return lblBlack; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblBlue() { return lblBlue; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblGreen() { return lblGreen; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblRed() { return lblRed; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblWhite() { return lblWhite; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblColorless() { return lblColorless; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblMulti() { return lblMulti; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblBlack() { return lblBlack; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblBlue() { return lblBlue; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblGreen() { return lblGreen; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblRed() { return lblRed; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblWhite() { return lblWhite; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblColorless() { return lblColorless; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblArtifact() { return lblArtifact; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblEnchantment() { return lblEnchantment; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCreature() { return lblCreature; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblSorcery() { return lblSorcery; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblInstant() { return lblInstant; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblPlaneswalker() { return lblPlaneswalker; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblLand() { return lblLand; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblArtifact() { return lblArtifact; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblEnchantment() { return lblEnchantment; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCreature() { return lblCreature; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblSorcery() { return lblSorcery; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblInstant() { return lblInstant; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblPlaneswalker() { return lblPlaneswalker; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblLand() { return lblLand; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC0() { return lblCMC0; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC1() { return lblCMC1; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC2() { return lblCMC2; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC3() { return lblCMC3; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC4() { return lblCMC4; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC5() { return lblCMC5; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblCMC6() { return lblCMC6; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblTotal() { return lblTotal; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblTMC() { return lblTMC; }
/** @return {@link javax.swing.JLabel} */
public JLabel getLblAMC() { return lblAMC; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC0() { return lblCMC0; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC1() { return lblCMC1; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC2() { return lblCMC2; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC3() { return lblCMC3; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC4() { return lblCMC4; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC5() { return lblCMC5; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblCMC6() { return lblCMC6; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblTotal() { return lblTotal; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblTMC() { return lblTMC; }
/** @return {@link forge.gui.toolbox.FLabel} */
public FLabel getLblAMC() { return lblAMC; }
//========== Other methods
private JLabel buildLabel(SkinImage icon, boolean zebra) {
final JLabel lbl = new FLabel.Builder().text("0")
private FLabel buildLabel(SkinImage icon, boolean zebra) {
final FLabel lbl = new FLabel.Builder().text("0")
.icon(icon).iconScaleAuto(false)
.fontSize(11).build();
if (zebra) {
lbl.setOpaque(true);
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
}
return lbl;
}
private JLabel buildLabel(SItemManagerUtil.StatTypes statType, boolean zebra) {
private FLabel buildLabel(SItemManagerUtil.StatTypes statType, boolean zebra) {
return buildLabel(statType.img, zebra);
}
}

View File

@@ -130,8 +130,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
radProxySocks.addChangeListener(new ProxyHandler(2));
radProxyNone.setSelected(true);
FSkin.get(btnClose).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT));
FSkin.get(btnStart).setFont(FSkin.getFont(18));
btnClose.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT)));
btnStart.setFont(FSkin.getFont(18));
btnStart.setVisible(false);
barProgress.reset();

View File

@@ -3,10 +3,10 @@ package forge.gui.framework;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JLabel;
import javax.swing.border.EmptyBorder;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* The tab label object in drag layout.
@@ -14,7 +14,7 @@ import forge.gui.toolbox.FSkin;
* Simply call the constructor with a title string argument.
*/
@SuppressWarnings("serial")
public final class DragTab extends JLabel implements ILocalRepaint {
public final class DragTab extends SkinnedLabel implements ILocalRepaint {
private boolean selected = false;
private int priority = 10;
@@ -31,7 +31,7 @@ public final class DragTab extends JLabel implements ILocalRepaint {
setOpaque(false);
setSelected(false);
setBorder(new EmptyBorder(2, 5, 2, 5));
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(SRearrangingUtil.getRearrangeClickEvent());
this.addMouseMotionListener(SRearrangingUtil.getRearrangeDragEvent());

View File

@@ -14,6 +14,7 @@ import javax.swing.JPanel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinCursor;
import forge.gui.toolbox.FSkin.SkinnedLayeredPane;
import forge.view.FView;
/**
@@ -42,7 +43,7 @@ public final class SRearrangingUtil {
private static int tempH;
private static JPanel pnlPreview = FView.SINGLETON_INSTANCE.getPnlPreview();
private static FView.DocumentPane pnlDocument = FView.SINGLETON_INSTANCE.getLpnDocument();
private static SkinnedLayeredPane pnlDocument = FView.SINGLETON_INSTANCE.getLpnDocument();
private static DragCell cellTarget = null;
private static DragCell cellSrc = null;
private static DragCell cellNew = null;

View File

@@ -7,12 +7,11 @@ import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import forge.Singletons;
import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.properties.ForgePreferences.FPref;
/**
@@ -20,8 +19,7 @@ import forge.properties.ForgePreferences.FPref;
* Handles repainting and listening for hover and click events.
*/
@SuppressWarnings("serial")
public class LblGroup extends JLabel implements ILocalRepaint {
public class LblGroup extends SkinnedLabel implements ILocalRepaint {
private static final boolean isCompactMenu = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_COMPACT_MAIN_MENU);
private static EMenuGroup activeMenuGroup = null;
@@ -41,11 +39,10 @@ public class LblGroup extends JLabel implements ILocalRepaint {
* @param e0 {@link forge.gui.home.EMenuGroup}
*/
public LblGroup(final EMenuGroup e0) {
super(" " + e0.getTitle());
FSkin.get(this).setFont(FSkin.getBoldFont(14));
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getBoldFont(14));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(new MouseAdapter() {
@Override

View File

@@ -3,17 +3,17 @@ package forge.gui.home;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JLabel;
import javax.swing.border.EmptyBorder;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Standardized header label for top of menu display panel.
*/
@SuppressWarnings("serial")
public class LblHeader extends JLabel {
public class LblHeader extends SkinnedLabel {
private final SkinColor clr = FSkin.getColor(FSkin.Colors.CLR_THEME).stepColor(0);
private final SkinColor a100 = clr.alphaColor(100);
private final SkinColor d40 = clr.stepColor(-40);
@@ -25,8 +25,8 @@ public class LblHeader extends JLabel {
*/
public LblHeader(final String txt0) {
super(txt0);
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
FSkin.get(this).setFont(FSkin.getFont(18));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getFont(18));
this.setBorder(new EmptyBorder(5, 30, 0, 0));
}

View File

@@ -6,19 +6,18 @@ import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import forge.gui.framework.ICDoc;
import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Custom JLabel for an item in the menu. Handles listening
* and repainting for hover and select events.
*/
@SuppressWarnings("serial")
public class LblMenuItem extends JLabel implements ILocalRepaint {
public class LblMenuItem extends SkinnedLabel implements ILocalRepaint {
private boolean selected = false;
private boolean hovered = false;
@@ -39,8 +38,8 @@ public class LblMenuItem extends JLabel implements ILocalRepaint {
public LblMenuItem(final IVSubmenu<? extends ICDoc> doc0) {
super(" " + doc0.getMenuTitle());
FSkin.get(this).setFont(FSkin.getFont(14));
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getFont(14));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(new MouseAdapter() {
@Override

View File

@@ -4,20 +4,17 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/**
* Custom JPanel for containing LblMenuItem components.
* Mostly just handles repainting.
*/
@SuppressWarnings("serial")
public class PnlGroup extends JPanel {
private final JComponentSkin<PnlGroup> skin;
public class PnlGroup extends SkinnedPanel {
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
private final SkinColor l00 = clrTheme.stepColor(0);
private final SkinColor l10 = clrTheme.stepColor(10);
@@ -30,9 +27,8 @@ public class PnlGroup extends JPanel {
* Mostly just handles repainting.
*/
public PnlGroup() {
this.skin = FSkin.get(this);
this.setLayout(new MigLayout("insets 10px 0 10px 0, gap 0, wrap"));
this.skin.setBackground(d20);
this.setBackground(d20);
this.setOpaque(false);
}

View File

@@ -5,33 +5,33 @@ import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JButton;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedButton;
@SuppressWarnings("serial")
public class StartButton extends JButton {
public class StartButton extends SkinnedButton {
public StartButton() {
final FSkin.AbstractButtonSkin<StartButton> skin = FSkin.get(this);
setOpaque(false);
setContentAreaFilled(false);
setBorder(null);
setBorder((Border)null);
setBorderPainted(false);
setRolloverEnabled(true);
skin.setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
skin.setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN));
setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN));
addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent arg0) {
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
}
@Override
public void focusGained(FocusEvent arg0) {
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
}
});

View File

@@ -62,8 +62,8 @@ import forge.gui.home.variant.VSubmenuVanguard;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPanel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.properties.NewConstants;
import forge.properties.ForgePreferences.FPref;
import forge.view.FView;
@@ -185,7 +185,7 @@ public enum VHomeUI implements IVTopLevelUI {
}
pnlMenu.add(pnlSubmenus, "w 100%!, h 100% - " + pnlMainMenuHeight + "px!");
FSkin.get(pnlDisplay).setBackground(l00.alphaColor(100));
pnlDisplay.setBackground(l00.alphaColor(100));
}
public final FLabel getLblStartServer() {
@@ -241,12 +241,9 @@ public enum VHomeUI implements IVTopLevelUI {
}
/** */
public class PnlDisplay extends JPanel implements ILocalRepaint {
private final JComponentSkin<PnlDisplay> skin;
public class PnlDisplay extends SkinnedPanel implements ILocalRepaint {
/** Constructor. */
public PnlDisplay() {
this.skin = FSkin.get(this);
this.setOpaque(false);
}
@@ -261,7 +258,7 @@ public enum VHomeUI implements IVTopLevelUI {
super.paintComponent(g);
final Graphics2D g2d = (Graphics2D) g.create();
FSkin.setGraphicsColor(g2d, skin.getBackground());
g2d.setColor(this.getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.dispose();

View File

@@ -12,12 +12,14 @@ import java.util.List;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout;
import forge.Command;
import forge.gauntlet.GauntletData;
import forge.gauntlet.GauntletIO;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/**
* Creates file list/table for quick deleting, editing, and basic info.
@@ -59,8 +61,8 @@ public class ContestGauntletLister extends JPanel {
// Title row
// Note: careful with the widths of the rows here;
// scroll panes will have difficulty dynamically resizing if 100% width is set.
final JPanel rowTitle = new JPanel();
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
final SkinnedPanel rowTitle = new SkinnedPanel();
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
rowTitle.add(new FLabel.Builder().build(),
"w 30px!, h 20px!, gap 1% 0 5px 0");
@@ -119,7 +121,7 @@ public class ContestGauntletLister extends JPanel {
}
}
private class RowPanel extends JPanel {
private class RowPanel extends SkinnedPanel {
private boolean selected = false;
private GauntletData gauntletData;
@@ -128,27 +130,27 @@ public class ContestGauntletLister extends JPanel {
setOpaque(false);
setBackground(new Color(0, 0, 0, 0));
setLayout(new MigLayout("insets 0, gap 0"));
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, clrBorders));
gauntletData = gd0;
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (!selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
((RowPanel) e.getSource()).setOpaque(true);
RowPanel.this.setBackground(clrHover);
RowPanel.this.setOpaque(true);
}
}
@Override
public void mouseExited(MouseEvent e) {
if (!selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
((RowPanel) e.getSource()).setOpaque(false);
RowPanel.this.setBackground(clrDefault);
RowPanel.this.setOpaque(false);
}
}
@Override
public void mousePressed(MouseEvent e) {
selectHandler((RowPanel) e.getSource());
selectHandler(RowPanel.this);
}
});
}
@@ -156,7 +158,7 @@ public class ContestGauntletLister extends JPanel {
public void setSelected(boolean b0) {
selected = b0;
setOpaque(b0);
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
this.setBackground(b0 ? clrActive : clrHover);
}
public boolean isSelected() {

View File

@@ -9,9 +9,9 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Command;
@@ -21,6 +21,8 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FOptionPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinIcon;
import forge.gui.toolbox.FSkin.SkinnedButton;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/**
* Creates file list/table for quick deleting, editing, and basic info.
@@ -67,8 +69,8 @@ public class QuickGauntletLister extends JPanel {
// Title row
// Note: careful with the widths of the rows here;
// scroll panes will have difficulty dynamically resizing if 100% width is set.
final JPanel rowTitle = new JPanel();
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
final SkinnedPanel rowTitle = new SkinnedPanel();
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
rowTitle.add(new FLabel.Builder().build(),
"w 30px!, h 20px!, gap 1% 0 5px 0");
@@ -121,17 +123,16 @@ public class QuickGauntletLister extends JPanel {
}
}
private class DeleteButton extends JButton {
private class DeleteButton extends SkinnedButton {
public DeleteButton(final RowPanel r0) {
super();
FSkin.AbstractButtonSkin<DeleteButton> skin = FSkin.get(this);
setRolloverEnabled(true);
skin.setPressedIcon(icoDeleteOver);
skin.setRolloverIcon(icoDeleteOver);
skin.setIcon(icoDelete);
setPressedIcon(icoDeleteOver);
setRolloverIcon(icoDeleteOver);
setIcon(icoDelete);
setOpaque(false);
setContentAreaFilled(false);
setBorder(null);
setBorder((Border)null);
setBorderPainted(false);
setToolTipText("Delete this deck");
@@ -139,14 +140,14 @@ public class QuickGauntletLister extends JPanel {
@Override
public void mouseEntered(MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(clrHover);
r0.setBackground(clrHover);
r0.setOpaque(true);
}
}
@Override
public void mouseExited(MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(clrDefault);
r0.setBackground(clrDefault);
r0.setOpaque(false);
}
}
@@ -158,7 +159,7 @@ public class QuickGauntletLister extends JPanel {
}
}
private class RowPanel extends JPanel {
private class RowPanel extends SkinnedPanel {
private boolean selected = false;
private GauntletData gauntletData;
@@ -167,27 +168,27 @@ public class QuickGauntletLister extends JPanel {
setOpaque(false);
setBackground(new Color(0, 0, 0, 0));
setLayout(new MigLayout("insets 0, gap 0"));
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, clrBorders));
gauntletData = gd0;
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (!selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
((RowPanel) e.getSource()).setOpaque(true);
RowPanel.this.setBackground(clrHover);
RowPanel.this.setOpaque(true);
}
}
@Override
public void mouseExited(MouseEvent e) {
if (!selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
((RowPanel) e.getSource()).setOpaque(false);
RowPanel.this.setBackground(clrDefault);
RowPanel.this.setOpaque(false);
}
}
@Override
public void mousePressed(MouseEvent e) {
selectHandler((RowPanel) e.getSource());
selectHandler(RowPanel.this);
}
});
}
@@ -195,7 +196,7 @@ public class QuickGauntletLister extends JPanel {
public void setSelected(boolean b0) {
selected = b0;
setOpaque(b0);
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
this.setBackground(b0 ? clrActive : clrHover);
}
public boolean isSelected() {

View File

@@ -115,7 +115,7 @@ public enum VSubmenuGauntletBuild implements IVSubmenu<CSubmenuGauntletBuild> {
.text(" ").hoverable(true).build();
private VSubmenuGauntletBuild() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// File handling panel

View File

@@ -4,7 +4,6 @@ import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
@@ -21,6 +20,7 @@ import forge.gui.home.VHomeUI;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/**
* Assembles Swing components of "build gauntlet" submenu singleton.
@@ -43,8 +43,7 @@ public enum VSubmenuGauntletContests implements IVSubmenu<CSubmenuGauntletContes
private final StartButton btnStart = new StartButton();
private final JPanel pnlLoad = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
private final SkinnedPanel pnlLoad = new SkinnedPanel(new MigLayout("insets 0, gap 0, wrap"));
private final ContestGauntletLister gauntletList = new ContestGauntletLister();
private final FDeckChooser lstDecks = new FDeckChooser("Deck", false);
@@ -59,11 +58,10 @@ public enum VSubmenuGauntletContests implements IVSubmenu<CSubmenuGauntletContes
.text("A gauntlet that has been started will keep the same deck until it is finished.").build();
private VSubmenuGauntletContests() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlLoad.setLayout(new MigLayout("insets 0, gap 0, wrap"));
FSkin.get(pnlLoad).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlLoad.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlLoad.add(lblLoad, "h 30px!, w 94%!, gap 1% 0 0 5px, ax center");
// pnlLoad.add(new FLabel.Builder().text("If a gauntlet has been started, its deck is frozen.").build(),
// "gap 0 0 0 5px, ax center");

View File

@@ -47,7 +47,7 @@ public enum VSubmenuGauntletLoad implements IVSubmenu<CSubmenuGauntletLoad> {
private final StartButton btnStart = new StartButton();
private VSubmenuGauntletLoad() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
scrLoad.setBorder(null);
}

View File

@@ -23,7 +23,7 @@ import forge.gui.toolbox.FCheckBox;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinnedSlider;
/**
* Assembles Swing components of "quick gauntlet" submenu singleton.
@@ -49,8 +49,8 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
.text("Double click a non-random deck for its decklist.")
.fontSize(12).build();
private final JSlider sliOpponents = new JSlider(SwingConstants.HORIZONTAL, 5, 50, 20);
//private JSlider sliGamesPerMatch = new JSlider(JSlider.HORIZONTAL, 1, 7, 3);
private final SkinnedSlider sliOpponents = new SkinnedSlider(SwingConstants.HORIZONTAL, 5, 50, 20);
//private SkinnedSlider sliGamesPerMatch = new SkinnedSlider(JSlider.HORIZONTAL, 1, 7, 3);
private final JCheckBox boxUserDecks = new FCheckBox("Custom User Decks");
private final JCheckBox boxQuestDecks = new FCheckBox("Quest Decks");
@@ -82,28 +82,27 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
private final StartButton btnStart = new StartButton();
private VSubmenuGauntletQuick() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
boxUserDecks.setSelected(true);
boxQuestDecks.setSelected(true);
boxThemeDecks.setSelected(true);
boxColorDecks.setSelected(true);
JComponentSkin<JSlider> sliOpponentsSkin = FSkin.get(sliOpponents);
sliOpponents.setMajorTickSpacing(5);
sliOpponents.setMinorTickSpacing(0);
sliOpponents.setPaintTicks(false);
sliOpponents.setPaintLabels(true);
sliOpponents.setSnapToTicks(true);
sliOpponents.setOpaque(false);
sliOpponentsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
sliOpponentsSkin.setFont(FSkin.getFont(12));
sliOpponents.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
sliOpponents.setFont(FSkin.getFont(12));
scrLoad.setOpaque(false);
scrLoad.getViewport().setOpaque(false);
scrLoad.setBorder(null);
FSkin.get(pnlOptions).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlOptions.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlOptions.add(lblOptions, "h 30px!, w 96%!, gap 2% 0 0 5px");
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");

View File

@@ -1,59 +1,57 @@
package forge.gui.home.quest;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import forge.gui.toolbox.FCheckBox;
import forge.gui.toolbox.FComboBoxWrapper;
import forge.gui.toolbox.FLabel;
/** Dictates methods required for a panel with stats/pet display. */
public interface IVQuestStats {
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getBtnBazaar();
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getBtnSpellShop();
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getBtnUnlock();
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getBtnTravel();
/** @return {@link javax.swing.JLabel} */
JLabel getLblCredits();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblCredits();
/** @return {@link javax.swing.JLabel} */
JLabel getLblLife();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblLife();
/** @return {@link javax.swing.JLabel} */
JLabel getLblWorld();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblWorld();
/** @return {@link javax.swing.JLabel} */
JLabel getLblWins();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblWins();
/** @return {@link javax.swing.JLabel} */
JLabel getLblLosses();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblLosses();
/** @return {@link javax.swing.JLabel} */
JLabel getLblNextChallengeInWins();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblNextChallengeInWins();
/** @return {@link javax.swing.JLabel} */
JLabel getLblCurrentDeck();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblCurrentDeck();
/** @return {@link javax.swing.JLabel} */
JLabel getLblWinStreak();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblWinStreak();
/** @return {@link javax.swing.FComboBoxWrapper} */
FComboBoxWrapper<String> getCbxPet();
/** @return {@link javax.swing.JCheckBox} */
JCheckBox getCbPlant();
/** @return {@link forge.gui.toolbox.FCheckBox} */
FCheckBox getCbPlant();
/** @return {@link javax.swing.JCheckBox} */
JCheckBox getCbCharm();
/** @return {@link forge.gui.toolbox.FCheckBox} */
FCheckBox getCbCharm();
/** @return {@link javax.swing.JLabel} */
JLabel getLblZep();
/** @return {@link forge.gui.toolbox.FLabel} */
FLabel getLblZep();
}

View File

@@ -30,7 +30,7 @@ import forge.quest.QuestEvent;
@SuppressWarnings("serial")
class PnlEvent extends JPanel {
private final QuestEvent event;
private final JRadioButton rad;
private final FRadioButton rad;
private final SkinImage img;
private final int wImg = 100;
@@ -55,11 +55,11 @@ class PnlEvent extends JPanel {
// Title and description
this.rad = new FRadioButton(event.getTitle() + " (" + event.getDifficulty().getTitle() + ")");
FSkin.get(this.rad).setFont(FSkin.getBoldFont(16));
this.rad.setFont(FSkin.getBoldFont(16));
final FTextArea tarDesc = new FTextArea();
tarDesc.setText(event.getDescription());
FSkin.get(tarDesc).setFont(FSkin.getItalicFont(12));
tarDesc.setFont(FSkin.getItalicFont(12));
// Change listener for radio button
this.rad.addChangeListener(new ChangeListener() {

View File

@@ -8,9 +8,9 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Command;
@@ -18,6 +18,8 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FOptionPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedButton;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.properties.NewConstants;
import forge.quest.data.QuestData;
@@ -79,8 +81,8 @@ public class QuestFileLister extends JPanel {
// Title row
// Note: careful with the widths of the rows here;
// scroll panes will have difficulty dynamically resizing if 100% width is set.
final JPanel rowTitle = new JPanel();
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
final SkinnedPanel rowTitle = new SkinnedPanel();
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
rowTitle.add(new FLabel.Builder().text("Name").fontAlign(SwingConstants.LEFT).build(), "w 85%-112px!, h 20px!, gaptop 5px, gapleft 48px");
rowTitle.add(new FLabel.Builder().text("Mode").fontAlign(SwingConstants.LEFT).build(), "w 15%!, h 20px!, gaptop 5px, gapleft 4px");
@@ -111,17 +113,16 @@ public class QuestFileLister extends JPanel {
return previousSelect.getQuestData();
}
private class DeleteButton extends JButton {
private class DeleteButton extends SkinnedButton {
public DeleteButton(final RowPanel r0) {
super();
FSkin.AbstractButtonSkin<DeleteButton> skin = FSkin.get(this);
setRolloverEnabled(true);
skin.setPressedIcon(icoDeleteOver);
skin.setRolloverIcon(icoDeleteOver);
skin.setIcon(icoDelete);
setPressedIcon(icoDeleteOver);
setRolloverIcon(icoDeleteOver);
setIcon(icoDelete);
setOpaque(false);
setContentAreaFilled(false);
setBorder(null);
setBorder((Border)null);
setBorderPainted(false);
setToolTipText("Delete this quest");
@@ -129,14 +130,14 @@ public class QuestFileLister extends JPanel {
@Override
public void onMouseEnter(MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(clrHover);
r0.setBackground(clrHover);
r0.setOpaque(true);
}
}
@Override
public void onMouseExit(MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(clrDefault);
r0.setBackground(clrDefault);
r0.setOpaque(false);
}
}
@@ -148,17 +149,16 @@ public class QuestFileLister extends JPanel {
}
}
private class EditButton extends JButton {
private class EditButton extends SkinnedButton {
public EditButton(final RowPanel r0) {
super();
FSkin.AbstractButtonSkin<EditButton> skin = FSkin.get(this);
setRolloverEnabled(true);
skin.setPressedIcon(icoEditOver);
skin.setRolloverIcon(icoEditOver);
skin.setIcon(icoEdit);
setPressedIcon(icoEditOver);
setRolloverIcon(icoEditOver);
setIcon(icoEdit);
setOpaque(false);
setContentAreaFilled(false);
setBorder(null);
setBorder((Border)null);
setBorderPainted(false);
setToolTipText("Rename this quest");
@@ -166,14 +166,14 @@ public class QuestFileLister extends JPanel {
@Override
public void onMouseEnter(MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(clrHover);
r0.setBackground(clrHover);
r0.setOpaque(true);
}
}
@Override
public void onMouseExit(MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(clrDefault);
r0.setBackground(clrDefault);
r0.setOpaque(false);
}
}
@@ -185,7 +185,7 @@ public class QuestFileLister extends JPanel {
}
}
private class RowPanel extends JPanel {
private class RowPanel extends SkinnedPanel {
private boolean selected = false;
private boolean hovered = false;
private QuestData questData;
@@ -195,7 +195,7 @@ public class QuestFileLister extends JPanel {
setOpaque(false);
setBackground(new Color(0, 0, 0, 0));
setLayout(new MigLayout("insets 0, gap 0"));
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, clrBorders));
questData = qd0;
this.addMouseListener(new FMouseAdapter() {
@@ -203,8 +203,8 @@ public class QuestFileLister extends JPanel {
public void onMouseEnter(final MouseEvent e) {
RowPanel.this.hovered = true;
if (!RowPanel.this.selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(QuestFileLister.this.clrHover);
((RowPanel) e.getSource()).setOpaque(true);
RowPanel.this.setBackground(QuestFileLister.this.clrHover);
RowPanel.this.setOpaque(true);
}
}
@@ -212,15 +212,15 @@ public class QuestFileLister extends JPanel {
public void onMouseExit(final MouseEvent e) {
RowPanel.this.hovered = false;
if (!RowPanel.this.selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(QuestFileLister.this.clrDefault);
((RowPanel) e.getSource()).setOpaque(false);
RowPanel.this.setBackground(QuestFileLister.this.clrDefault);
RowPanel.this.setOpaque(false);
}
}
@Override
public void onLeftMouseDown(final MouseEvent e) {
if (e.getClickCount() == 1) {
QuestFileLister.this.selectHandler((RowPanel) e.getSource());
QuestFileLister.this.selectHandler(RowPanel.this);
}
}
});
@@ -229,9 +229,9 @@ public class QuestFileLister extends JPanel {
public void setSelected(final boolean b0) {
this.selected = b0;
this.setOpaque(b0);
if (b0) { FSkin.get(this).setBackground(QuestFileLister.this.clrActive); }
else if (this.hovered) { FSkin.get(this).setBackground(QuestFileLister.this.clrHover); }
else { FSkin.get(this).setBackground(QuestFileLister.this.clrDefault); }
if (b0) { this.setBackground(QuestFileLister.this.clrActive); }
else if (this.hovered) { this.setBackground(QuestFileLister.this.clrHover); }
else { this.setBackground(QuestFileLister.this.clrDefault); }
}
public boolean isSelected() {

View File

@@ -8,14 +8,15 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.gui.toolbox.FSkin.SkinnedTextField;
import forge.quest.data.QuestPreferences;
import forge.quest.data.QuestPreferences.QPref;
@@ -24,7 +25,7 @@ import forge.quest.data.QuestPreferences.QPref;
*
*/
@SuppressWarnings("serial")
public class QuestPreferencesHandler extends JPanel {
public class QuestPreferencesHandler extends SkinnedPanel {
private final QuestPreferences prefs;
private final JPanel pnlDifficulty, pnlBooster, pnlRewards, pnlShop;
private final FLabel lblErrRewards, lblErrBooster, lblErrDifficulty, lblErrShop;
@@ -240,10 +241,9 @@ public class QuestPreferencesHandler extends JPanel {
resetErrors();
}
private class PrefInput extends JTextField {
private class PrefInput extends SkinnedTextField {
private final QPref qpref;
private final ErrType err;
private final JTextComponentSkin<PrefInput> skin;
private final FSkin.SkinColor clrHover, clrActive, clrText;
private boolean isFocus = false;
private String previousText = "";
@@ -259,17 +259,16 @@ public class QuestPreferencesHandler extends JPanel {
this.qpref = qp0;
this.err = e0;
this.skin = FSkin.get(this);
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
this.setOpaque(false);
this.setBorder(null);
this.skin.setFont(FSkin.getFont(13));
this.skin.setForeground(clrText);
this.skin.setCaretColor(clrText);
this.skin.setBackground(clrHover);
this.setBorder((Border)null);
this.setFont(FSkin.getFont(13));
this.setForeground(clrText);
this.setCaretColor(clrText);
this.setBackground(clrHover);
this.setHorizontalAlignment(SwingConstants.CENTER);
this.setText(prefs.getPref(qpref));
this.setPreviousText(prefs.getPref(qpref));
@@ -295,14 +294,14 @@ public class QuestPreferencesHandler extends JPanel {
public void focusGained(FocusEvent e) {
isFocus = true;
setOpaque(true);
skin.setBackground(clrActive);
setBackground(clrActive);
}
@Override
public void focusLost(FocusEvent e) {
isFocus = false;
setOpaque(false);
skin.setBackground(clrHover);
setBackground(clrHover);
// TODO for slight performance improvement
// check if value has changed before validating

View File

@@ -4,7 +4,6 @@ import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
@@ -25,6 +24,7 @@ import forge.gui.deckeditor.controllers.CEditorQuestCardShop;
import forge.gui.framework.FScreen;
import forge.gui.toolbox.FOptionPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.net.FServer;
import forge.net.Lobby;
import forge.properties.ForgePreferences.FPref;
@@ -134,11 +134,11 @@ public class SSubmenuQuestUtil {
view.getLblZep().setVisible(qCtrl.getAssets().hasItem(QuestItemType.ZEPPELIN));
if (qCtrl.getAssets().getItemLevel(QuestItemType.ZEPPELIN) == 2) {
view.getLblZep().setEnabled(false);
FSkin.get(view.getLblZep()).setForeground(Color.gray);
view.getLblZep().setForeground(Color.gray);
}
else {
view.getLblZep().setEnabled(true);
FSkin.get(view.getLblZep()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
view.getLblZep().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
}
else {
@@ -199,13 +199,13 @@ public class SSubmenuQuestUtil {
+ "<br>&nbsp; (Best: " + qA.getWinStreakBest() + ")</html>");
// Current deck message
final JLabel lblCurrentDeck = view0.getLblCurrentDeck();
final SkinnedLabel lblCurrentDeck = view0.getLblCurrentDeck();
if (SSubmenuQuestUtil.getCurrentDeck() == null) {
lblCurrentDeck.setForeground(Color.red.darker());
lblCurrentDeck.setText("Build, then select a deck in the \"Decks\" submenu. ");
}
else {
FSkin.get(lblCurrentDeck).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblCurrentDeck.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblCurrentDeck.setText("Your current deck is \""
+ SSubmenuQuestUtil.getCurrentDeck().getName() + "\".");
}

View File

@@ -3,11 +3,11 @@ package forge.gui.home.quest;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell;
@@ -45,11 +45,11 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
private final FScrollPane scrChallenges = new FScrollPane(pnlChallenges,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
private final JButton btnStart = new StartButton();
private final StartButton btnStart = new StartButton();
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
private final JCheckBox cbPlant = new FCheckBox("Summon Plant");
private final JCheckBox cbCharm = new FCheckBox("Use Charm of Vigor");
private final JLabel lblZep = new FLabel.Builder().text("<html>Launch<br>Zeppelin</html>")
private final FCheckBox cbPlant = new FCheckBox("Summon Plant");
private final FCheckBox cbCharm = new FCheckBox("Use Charm of Vigor");
private final FLabel lblZep = new FLabel.Builder().text("<html>Launch<br>Zeppelin</html>")
.hoverable(true).icon(FSkin.getIcon(FSkin.QuestIcons.ICO_ZEP))
.fontSize(16).build();
private final FLabel lblWorld = new FLabel.Builder()
@@ -72,7 +72,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
.fontSize(15).build();
private final LblHeader lblTitle = new LblHeader("Quest Mode: Challenges");
private final JLabel lblInfo = new FLabel.Builder().text("Which challenge will you attempt?")
private final FLabel lblInfo = new FLabel.Builder().text("Which challenge will you attempt?")
.fontStyle(Font.BOLD).fontSize(16)
.fontAlign(SwingConstants.LEFT).build();
@@ -93,7 +93,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
* Constructor.
*/
private VSubmenuChallenges() {
scrChallenges.setBorder(null);
scrChallenges.setBorder((Border)null);
pnlChallenges.setOpaque(false);
pnlChallenges.setLayout(new MigLayout("insets 0, gap 0, wrap"));
@@ -206,7 +206,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
}
@Override
public JLabel getLblCurrentDeck() {
public FLabel getLblCurrentDeck() {
return lblCurrentDeck;
}
@@ -240,12 +240,12 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
}
@Override
public JCheckBox getCbPlant() {
public FCheckBox getCbPlant() {
return cbPlant;
}
@Override
public JLabel getLblZep() {
public FLabel getLblZep() {
return lblZep;
}
@@ -304,7 +304,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
/**
* @return the cbCharm
*/
public JCheckBox getCbCharm() {
public FCheckBox getCbCharm() {
return cbCharm;
}
}

View File

@@ -3,11 +3,11 @@ package forge.gui.home.quest;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell;
@@ -44,11 +44,11 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
private final FScrollPane scrDuels = new FScrollPane(pnlDuels,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
private final JButton btnStart = new StartButton();
private final StartButton btnStart = new StartButton();
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
private final JCheckBox cbCharm = new FCheckBox("Use Charm of Vigor");
private final JCheckBox cbPlant = new FCheckBox("Summon Plant");
private final JLabel lblZep = new FLabel.Builder().text("Launch Zeppelin").fontSize(14).build();
private final FCheckBox cbCharm = new FCheckBox("Use Charm of Vigor");
private final FCheckBox cbPlant = new FCheckBox("Summon Plant");
private final FLabel lblZep = new FLabel.Builder().text("Launch Zeppelin").fontSize(14).build();
private final FLabel lblWorld = new FLabel.Builder()
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_MAP))
@@ -91,7 +91,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
* Constructor.
*/
private VSubmenuDuels() {
scrDuels.setBorder(null);
scrDuels.setBorder((Border)null);
pnlDuels.setOpaque(false);
pnlDuels.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
@@ -198,7 +198,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
}
@Override
public JLabel getLblNextChallengeInWins() {
public FLabel getLblNextChallengeInWins() {
return lblNextChallengeInWins;
}
@@ -208,7 +208,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
}
@Override
public JLabel getLblCurrentDeck() {
public FLabel getLblCurrentDeck() {
return lblCurrentDeck;
}
@@ -233,12 +233,12 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
}
@Override
public JCheckBox getCbPlant() {
public FCheckBox getCbPlant() {
return cbPlant;
}
@Override
public JLabel getLblZep() {
public FLabel getLblZep() {
return lblZep;
}
@@ -297,7 +297,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
/**
* @return the cbCharm
*/
public JCheckBox getCbCharm() {
public FCheckBox getCbCharm() {
return cbCharm;
}
}

View File

@@ -6,12 +6,10 @@ import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import net.miginfocom.swing.MigLayout;
@@ -61,10 +59,10 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
.text("Load Quest Data").fontAlign(SwingConstants.CENTER)
.opaque(true).fontSize(16).build();
private final JLabel lblTitleNew = new FLabel.Builder().text("Start a new Quest")
private final FLabel lblTitleNew = new FLabel.Builder().text("Start a new Quest")
.opaque(true).fontSize(16).build();
private final JLabel lblOldQuests = new FLabel.Builder().text("Old quest data? Put into "
private final FLabel lblOldQuests = new FLabel.Builder().text("Old quest data? Put into "
+ "res/quest/data, and restart Forge.")
.fontAlign(SwingConstants.CENTER).fontSize(12).build();
@@ -73,16 +71,16 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
private final JPanel pnlOptions = new JPanel();
/* Fist column */
private final JRadioButton radEasy = new FRadioButton("Easy");
private final JRadioButton radMedium = new FRadioButton("Medium");
private final JRadioButton radHard = new FRadioButton("Hard");
private final JRadioButton radExpert = new FRadioButton("Expert");
private final JCheckBox boxFantasy = new FCheckBox("Fantasy Mode");
private final FRadioButton radEasy = new FRadioButton("Easy");
private final FRadioButton radMedium = new FRadioButton("Medium");
private final FRadioButton radHard = new FRadioButton("Hard");
private final FRadioButton radExpert = new FRadioButton("Expert");
private final FCheckBox boxFantasy = new FCheckBox("Fantasy Mode");
private final JLabel lblStartingWorld = new FLabel.Builder().text("Starting world:").build();
private final FLabel lblStartingWorld = new FLabel.Builder().text("Starting world:").build();
private final FComboBoxWrapper<QuestWorld> cbxStartingWorld = new FComboBoxWrapper<QuestWorld>();
private final JLabel lblPreferredColor = new FLabel.Builder().text("Starting pool colors:").build();
private final FLabel lblPreferredColor = new FLabel.Builder().text("Starting pool colors:").build();
private final FComboBoxWrapper<String> cbxPreferredColor = new FComboBoxWrapper<String>();
private final String stringBalancedDistribution = new String("balanced distribution");
private final String stringRandomizedDistribution = new String("randomized distribution");
@@ -90,33 +88,33 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
/* Second column */
private final JLabel lblStartingPool = new FLabel.Builder().text("Starting pool:").build();
private final FLabel lblStartingPool = new FLabel.Builder().text("Starting pool:").build();
private final FComboBoxWrapper<StartingPoolType> cbxStartingPool = new FComboBoxWrapper<StartingPoolType>();
private final JLabel lblUnrestricted = new FLabel.Builder().text("All cards will be available to play.").build();
private final FLabel lblUnrestricted = new FLabel.Builder().text("All cards will be available to play.").build();
private final JLabel lblPreconDeck = new FLabel.Builder().text("Starter/Event deck:").build();
private final FLabel lblPreconDeck = new FLabel.Builder().text("Starter/Event deck:").build();
private final FComboBoxWrapper<String> cbxPreconDeck = new FComboBoxWrapper<String>();
private final JLabel lblFormat = new FLabel.Builder().text("Sanctioned format:").build();
private final FLabel lblFormat = new FLabel.Builder().text("Sanctioned format:").build();
private final FComboBoxWrapper<GameFormat> cbxFormat = new FComboBoxWrapper<GameFormat>();
private final JLabel lblCustomDeck = new FLabel.Builder().text("Custom deck:").build();
private final FLabel lblCustomDeck = new FLabel.Builder().text("Custom deck:").build();
private final FComboBoxWrapper<Deck> cbxCustomDeck = new FComboBoxWrapper<Deck>();
private final FLabel btnDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
private final FLabel btnPrizeDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
private final JLabel lblPrizedCards = new FLabel.Builder().text("Prized cards:").build();
private final FLabel lblPrizedCards = new FLabel.Builder().text("Prized cards:").build();
private final FComboBoxWrapper<Object> cbxPrizedCards = new FComboBoxWrapper<Object>();
private final JLabel lblPrizeFormat = new FLabel.Builder().text("Sanctioned format:").build();
private final FLabel lblPrizeFormat = new FLabel.Builder().text("Sanctioned format:").build();
private final FComboBoxWrapper<GameFormat> cbxPrizeFormat = new FComboBoxWrapper<GameFormat>();
private final JLabel lblPrizeUnrestricted = new FLabel.Builder().text("All cards will be available to win.").build();
private final JLabel lblPrizeSameAsStarting = new FLabel.Builder().text("Only sets found in starting pool will be available.").build();
private final FLabel lblPrizeUnrestricted = new FLabel.Builder().text("All cards will be available to win.").build();
private final FLabel lblPrizeSameAsStarting = new FLabel.Builder().text("Only sets found in starting pool will be available.").build();
private final JCheckBox cboAllowUnlocks = new FCheckBox("Allow unlock of additional editions");
private final FCheckBox cboAllowUnlocks = new FCheckBox("Allow unlock of additional editions");
private final FLabel btnEmbark = new FLabel.Builder().opaque(true)
.fontSize(16).hoverable(true).text("Embark!").build();
@@ -206,10 +204,10 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
*/
@SuppressWarnings("unchecked")
private VSubmenuQuestData() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
FSkin.get(lblTitleNew).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitleNew.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
scrQuests.setBorder(null);
scrQuests.setBorder((Border)null);
final JXButtonPanel difficultyPanel = new JXButtonPanel();
final String difficulty_constraints = "h 27px!, gapbottom 5";

View File

@@ -1,6 +1,7 @@
package forge.gui.home.quest;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.game.GameType;
@@ -44,9 +45,9 @@ public enum VSubmenuQuestDecks implements IVSubmenu<CSubmenuQuestDecks> {
* Constructor.
*/
private VSubmenuQuestDecks() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
scr.setBorder(null);
scr.setBorder((Border)null);
scr.getViewport().setBorder(null);
}

View File

@@ -9,9 +9,9 @@ import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
@@ -25,8 +25,8 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedTextField;
import forge.quest.data.QuestPreferences;
import forge.quest.data.QuestPreferences.QPref;
@@ -78,7 +78,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
* Constructor.
*/
private VSubmenuQuestPrefs() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlContent.setOpaque(false);
pnlContent.setLayout(new MigLayout("insets 0, gap 0, wrap"));
@@ -91,7 +91,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
// Rewards panel
final FPanel pnlTitleRewards = new FPanel();
pnlTitleRewards.setLayout(new MigLayout("insets 0, align center"));
FSkin.get(pnlTitleRewards).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleRewards.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleRewards.add(new FLabel.Builder().text("Rewards")
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
@@ -103,7 +103,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
// Booster panel
final FPanel pnlTitleBooster = new FPanel();
pnlTitleBooster.setLayout(new MigLayout("insets 0, align center"));
FSkin.get(pnlTitleBooster).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleBooster.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOOK))
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
@@ -114,7 +114,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
// Difficulty table panel
final FPanel pnlTitleDifficulty = new FPanel();
pnlTitleDifficulty.setLayout(new MigLayout("insets 0, align center"));
FSkin.get(pnlTitleDifficulty).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleDifficulty.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments")
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_NOTES))
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
@@ -125,7 +125,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
// Shop panel
final FPanel pnlTitleShop = new FPanel();
pnlTitleShop.setLayout(new MigLayout("insets 0, align center"));
FSkin.get(pnlTitleShop).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleShop.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnlTitleShop.add(new FLabel.Builder().text("Shop Preferences")
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
@@ -133,7 +133,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
pnlContent.add(pnlShop, "w 96%!, gap 2% 0 10px 20px");
populateShop();
scrContent.setBorder(null);
scrContent.setBorder((Border)null);
}
@@ -375,10 +375,9 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
/** */
@SuppressWarnings("serial")
public class PrefInput extends JTextField {
public class PrefInput extends SkinnedTextField {
private final QPref qpref;
private final QuestPreferencesErrType err;
private final JTextComponentSkin<PrefInput> skin;
private final SkinColor clrHover, clrActive, clrText;
private boolean isFocus = false;
private String previousText = "";
@@ -394,17 +393,16 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
this.qpref = qp0;
this.err = e0;
this.skin = FSkin.get(this);
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
this.setOpaque(false);
this.setBorder(null);
this.skin.setFont(FSkin.getFont(13));
this.skin.setForeground(clrText);
this.skin.setCaretColor(clrText);
this.skin.setBackground(clrHover);
this.setBorder((Border)null);
this.setFont(FSkin.getFont(13));
this.setForeground(clrText);
this.setCaretColor(clrText);
this.setBackground(clrHover);
this.setHorizontalAlignment(SwingConstants.CENTER);
this.setText(prefs.getPref(qpref));
this.setPreviousText(prefs.getPref(qpref));
@@ -430,14 +428,14 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
public void focusGained(FocusEvent e) {
isFocus = true;
setOpaque(true);
skin.setBackground(clrActive);
setBackground(clrActive);
}
@Override
public void focusLost(FocusEvent e) {
isFocus = false;
setOpaque(false);
skin.setBackground(clrHover);
setBackground(clrHover);
CSubmenuQuestPrefs.validateAndSave(PrefInput.this);
}

View File

@@ -61,7 +61,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
// CTR
private VSubmenuConstructed() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
//This listener will look for any of the radio buttons being selected
//and call the method that shows/hides tabs appropriately.

View File

@@ -79,7 +79,7 @@ public enum VSubmenuDraft implements IVSubmenu<CSubmenuDraft> {
lstAI.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
btnStart.setEnabled(false);
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
JXButtonPanel grpPanel = new JXButtonPanel();
grpPanel.add(radSingle, "w 200px!, h 30px!");

View File

@@ -7,8 +7,8 @@ import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@@ -29,7 +29,7 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin;
import forge.gui.toolbox.FSkin.SkinnedTextPane;
import forge.gui.toolbox.special.DeckLister;
/**
@@ -79,7 +79,7 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
private VSubmenuSealed() {
btnStart.setEnabled(false);
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
}
/* (non-Javadoc)
@@ -164,15 +164,14 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
+ "Credit: Wikipedia";
// Init directions text pane
final JTextPane tpnDirections = new JTextPane();
JTextComponentSkin<JTextPane> tpnDirectionsSkin = FSkin.get(tpnDirections);
final SkinnedTextPane tpnDirections = new SkinnedTextPane();
tpnDirections.setOpaque(false);
tpnDirectionsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnDirectionsSkin.setFont(FSkin.getFont(15));
tpnDirections.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnDirections.setFont(FSkin.getFont(15));
tpnDirections.setAlignmentX(SwingConstants.CENTER);
tpnDirections.setFocusable(false);
tpnDirections.setEditable(false);
tpnDirections.setBorder(null);
tpnDirections.setBorder((Border)null);
tpnDirections.setText(instructions);
final StyledDocument doc = tpnDirections.getStyledDocument();

View File

@@ -10,6 +10,7 @@ import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Command;
@@ -90,7 +91,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
pnlContent.add(btnLicensing, constraintsBTN);
pnlContent.add(_makeLabel("Forge legal."), constraintsLBL);
scrContent.setBorder(null);
scrContent.setBorder((Border)null);
}
/* (non-Javadoc)
@@ -178,7 +179,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
FTextArea directions = new FTextArea(FileUtil.readFileToString(NewConstants.TEXT_HOWTO_FILE));
final FScrollPane scr = new FScrollPane(directions, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scr.setBorder(null);
scr.setBorder((Border)null);
_showDialog(scr, new Runnable() {
@Override public void run() { scr.getViewport().setViewPosition(new Point(0, 0)); }

View File

@@ -15,9 +15,9 @@ import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
@@ -39,6 +39,8 @@ import forge.gui.toolbox.FComboBoxPanel;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.gui.toolbox.FSkin.SkinnedTextField;
import forge.properties.ForgePreferences.FPref;
/**
@@ -226,7 +228,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
shortcutFields.put(s.getPrefKey(), field);
}
scrContent.setBorder(null);
scrContent.setBorder((Border)null);
}
public void reloadShortcuts() {
@@ -278,41 +280,39 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private class OptionsCheckBox extends FCheckBox {
public OptionsCheckBox(final String txt0) {
super(txt0);
FSkin.get(this).setFont(FSkin.getBoldFont(12));
this.setFont(FSkin.getBoldFont(12));
}
}
/** Consolidates section title label styling in one place. */
@SuppressWarnings("serial")
private class SectionLabel extends JLabel {
private class SectionLabel extends SkinnedLabel {
public SectionLabel(final String txt0) {
super(txt0);
FSkin.JLabelSkin<SectionLabel> skin = FSkin.get(this);
skin.setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
setHorizontalAlignment(SwingConstants.CENTER);
skin.setFont(FSkin.getBoldFont(16));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getBoldFont(16));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
}
/** Consolidates notation label styling in one place. */
@SuppressWarnings("serial")
private class NoteLabel extends JLabel {
private class NoteLabel extends SkinnedLabel {
public NoteLabel(final String txt0) {
super(txt0);
FSkin.JLabelSkin<NoteLabel> skin = FSkin.get(this);
skin.setFont(FSkin.getItalicFont(12));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getItalicFont(12));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
}
/**
* A JTextField plus a "codeString" property, that stores keycodes for the
* A FTextField plus a "codeString" property, that stores keycodes for the
* shortcut. Also, an action listener that handles translation of keycodes
* into characters and (dis)assembly of keycode stack.
*/
@SuppressWarnings("serial")
public class KeyboardShortcutField extends JTextField {
public class KeyboardShortcutField extends SkinnedTextField {
private String codeString;
/**
@@ -325,7 +325,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
public KeyboardShortcutField(final Shortcut shortcut0) {
super();
this.setEditable(false);
FSkin.get(this).setFont(FSkin.getFont(14));
this.setFont(FSkin.getFont(14));
final FPref prefKey = shortcut0.getPrefKey();
reload(prefKey);
@@ -339,7 +339,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
this.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(final FocusEvent evt) {
FSkin.get(KeyboardShortcutField.this).setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
KeyboardShortcutField.this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
}
@Override
@@ -347,7 +347,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
Singletons.getModel().getPreferences().setPref(prefKey, getCodeString());
Singletons.getModel().getPreferences().save();
shortcut0.attach();
FSkin.get(KeyboardShortcutField.this).setBackground(Color.white);
KeyboardShortcutField.this.setBackground(Color.white);
}
});
}

View File

@@ -21,11 +21,9 @@ package forge.gui.home.settings;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID;
@@ -33,6 +31,7 @@ import forge.gui.home.EMenuGroup;
import forge.gui.home.IVSubmenu;
import forge.gui.home.VHomeUI;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
/**
* Displays contents of CHANGES.txt file.
@@ -49,7 +48,7 @@ public enum VSubmenuReleaseNotes implements IVSubmenu<CSubmenuReleaseNotes> {
private final DragTab tab = new DragTab("Release Notes");
private final JPanel pnlMain = new JPanel();
private JTextArea tar;
private SkinnedTextArea tar;
private final JScrollPane scroller;
/**
@@ -60,17 +59,16 @@ public enum VSubmenuReleaseNotes implements IVSubmenu<CSubmenuReleaseNotes> {
pnlMain.setOpaque(false);
pnlMain.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
tar = new JTextArea();
tar = new SkinnedTextArea();
tar.setOpaque(true);
tar.setLineWrap(true);
tar.setWrapStyleWord(true);
tar.setEditable(false);
tar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
tar.setFont(FSkin.getFixedFont(16));
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tarSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
scroller = new JScrollPane(tar);
pnlMain.add(scroller, "w 100%!, h 100%!");

View File

@@ -76,8 +76,7 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
//////////////////////////////
private VSubmenuArchenemy() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
//This listener will look for any of the radio buttons being selected
//and call the method that shows/hides tabs appropriately.

View File

@@ -72,7 +72,7 @@ public enum VSubmenuCommander implements IVSubmenu<CSubmenuCommander> {
private VSubmenuCommander() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
Vector<Object> cmdDeckListData = new Vector<Object>();
if(Singletons.getModel().getDecks().getCommander().size() > 0) {

View File

@@ -76,7 +76,7 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
private VSubmenuPlanechase() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
//This listener will look for any of the radio buttons being selected
//and call the method that shows/hides tabs appropriately.

View File

@@ -89,7 +89,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
private VSubmenuVanguard() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
Vector<Object> humanListData = new Vector<Object>();
Vector<Object> aiListData = new Vector<Object>();

View File

@@ -23,8 +23,8 @@ import net.miginfocom.swing.MigLayout;
import forge.gui.MouseUtil;
import forge.gui.MouseUtil.MouseCursor;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin;
import forge.gui.toolbox.FSkin.SkinFont;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
@SuppressWarnings("serial")
public class GameLogPanel extends JPanel {
@@ -150,20 +150,19 @@ public class GameLogPanel extends JPanel {
}
private JTextArea createNewLogEntryJTextArea(String text, boolean useAlternateBackColor) {
final JTextArea tar = new JTextArea(text);
final JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
tarSkin.setFont(textFont);
final SkinnedTextArea tar = new SkinnedTextArea(text);
tar.setFont(textFont);
tar.setBorder(new EmptyBorder(3, 4, 3, 4));
tar.setFocusable(false);
tar.setEditable(false);
tar.setLineWrap(true);
tar.setWrapStyleWord(true);
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
FSkin.SkinColor skinColor = FSkin.getColor(FSkin.Colors.CLR_THEME2);
if (useAlternateBackColor) { skinColor = skinColor.darker(); }
tar.setOpaque(true);
tarSkin.setBackground(skinColor);
tar.setBackground(skinColor);
return tar;
}

View File

@@ -38,6 +38,7 @@ import forge.gauntlet.GauntletData;
import forge.gauntlet.GauntletIO;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.net.FServer;
import forge.net.Lobby;
@@ -178,10 +179,10 @@ public class GauntletWinLose extends ControlWinLose {
pnlResults.add(lblTemp, "w 50%!, h 25px!, gap 0 0 5px 0");
}
final JPanel pnl = this.getView().getPnlCustom();
final SkinnedPanel pnl = this.getView().getPnlCustom();
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
pnl.setOpaque(true);
FSkin.get(pnl).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
pnl.add(lblTitle, "gap 0 0 20px 10px, ax center");
pnl.add(pnlResults, "w 96%!, growy, pushy, gap 2% 0 0 0");

View File

@@ -21,13 +21,13 @@ import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import forge.Singletons;
import forge.game.Game;
import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.limited.GauntletMini;
import forge.net.FServer;
@@ -46,8 +46,8 @@ public class LimitedWinLose extends ControlWinLose {
private static final String CONSTRAINTS_TITLE = "w 95%!, gap 0 0 20px 10px";
private static final String CONSTRAINTS_TEXT = "w 95%!,, h 180px!, gap 0 0 0 20px";
private JLabel lblTemp1;
private JLabel lblTemp2;
private SkinnedLabel lblTemp1;
private SkinnedLabel lblTemp2;
/**
* Instantiates a new limited mode win/lose handler.
@@ -125,11 +125,11 @@ public class LimitedWinLose extends ControlWinLose {
private void showTournamentInfo(final String newTitle) {
this.lblTemp1 = new TitleLabel(newTitle);
this.lblTemp2 = new JLabel("Round: " + gauntlet.getCurrentRound() + "/" + gauntlet.getRounds());
this.lblTemp2 = new SkinnedLabel("Round: " + gauntlet.getCurrentRound() + "/" + gauntlet.getRounds());
// + " Total Wins: " + gauntlet.getWins()
// + " Total Losses: " + gauntlet.getLosses());
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
FSkin.get(this.lblTemp2).setFont(FSkin.getFont(17));
this.lblTemp2.setFont(FSkin.getFont(17));
this.lblTemp2.setForeground(Color.white);
this.lblTemp2.setIconTextGap(50);
this.getView().getPnlCustom().add(this.lblTemp1, LimitedWinLose.CONSTRAINTS_TITLE);
@@ -204,10 +204,10 @@ public class LimitedWinLose extends ControlWinLose {
*
*/
@SuppressWarnings("serial")
private class TitleLabel extends JLabel {
private class TitleLabel extends SkinnedLabel {
TitleLabel(final String msg) {
super(msg);
FSkin.get(this).setFont(FSkin.getFont(18));
this.setFont(FSkin.getFont(18));
this.setPreferredSize(new Dimension(200, 40));
this.setHorizontalAlignment(SwingConstants.CENTER);
this.setForeground(Color.white);

View File

@@ -16,7 +16,6 @@
*/
package forge.gui.match;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
@@ -25,7 +24,6 @@ import java.util.List;
import java.util.Map.Entry;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import org.apache.commons.lang3.StringUtils;
@@ -52,6 +50,7 @@ import forge.gui.home.quest.CSubmenuChallenges;
import forge.gui.home.quest.CSubmenuDuels;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinIcon;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.item.BoosterPack;
import forge.item.PaperCard;
import forge.item.InventoryItem;
@@ -83,8 +82,8 @@ public class QuestWinLose extends ControlWinLose {
private final transient boolean wonMatch;
private final transient ViewWinLose view;
private transient SkinIcon icoTemp;
private transient JLabel lblTemp1;
private transient JLabel lblTemp2;
private transient TitleLabel lblTemp1;
private transient SkinnedLabel lblTemp2;
private final transient boolean isAnte;
/** String constraint parameters for title blocks and cardviewer blocks. */
@@ -448,12 +447,11 @@ public class QuestWinLose extends ControlWinLose {
this.lblTemp1 = new TitleLabel("Gameplay Results");
this.lblTemp2 = new JLabel(sb.toString());
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(this.lblTemp2);
this.lblTemp2 = new SkinnedLabel(sb.toString());
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
labelSkin.setFont(FSkin.getFont(14));
this.lblTemp2.setFont(FSkin.getFont(14));
this.lblTemp2.setForeground(Color.white);
labelSkin.setIcon(this.icoTemp);
this.lblTemp2.setIcon(this.icoTemp);
this.lblTemp2.setIconTextGap(50);
this.getView().getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
@@ -600,13 +598,12 @@ public class QuestWinLose extends ControlWinLose {
this.icoTemp = FSkin.getIcon(FSkin.QuestIcons.ICO_BOX).scale(0.5);
this.lblTemp1 = new TitleLabel("Challenge Rewards for \"" + ((QuestEventChallenge) qEvent).getTitle() + "\"");
this.lblTemp2 = new JLabel(sb.toString());
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(this.lblTemp2);
labelSkin.setFont(FSkin.getFont(14));
this.lblTemp2 = new SkinnedLabel(sb.toString());
this.lblTemp2.setFont(FSkin.getFont(14));
this.lblTemp2.setForeground(Color.white);
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
this.lblTemp2.setIconTextGap(50);
labelSkin.setIcon(this.icoTemp);
this.lblTemp2.setIcon(this.icoTemp);
this.getView().getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
this.getView().getPnlCustom().add(this.lblTemp2, QuestWinLose.CONSTRAINTS_TEXT);
@@ -675,13 +672,12 @@ public class QuestWinLose extends ControlWinLose {
this.lblTemp1 = new TitleLabel("Gameplay Results");
this.lblTemp2 = new JLabel("You lose! You have lost " + x + " credits.");
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(this.lblTemp2);
labelSkin.setFont(FSkin.getFont(14));
this.lblTemp2 = new SkinnedLabel("You lose! You have lost " + x + " credits.");
this.lblTemp2.setFont(FSkin.getFont(14));
this.lblTemp2.setForeground(Color.white);
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
this.lblTemp2.setIconTextGap(50);
labelSkin.setIcon(this.icoTemp);
this.lblTemp2.setIcon(this.icoTemp);
this.getView().getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
this.getView().getPnlCustom().add(this.lblTemp2, QuestWinLose.CONSTRAINTS_TEXT);
@@ -763,10 +759,10 @@ public class QuestWinLose extends ControlWinLose {
*
*/
@SuppressWarnings("serial")
private class TitleLabel extends JLabel {
private class TitleLabel extends SkinnedLabel {
TitleLabel(final String msg) {
super(msg);
FSkin.get(this).setFont(FSkin.getFont(16));
this.setFont(FSkin.getFont(16));
this.setPreferredSize(new Dimension(200, 40));
this.setHorizontalAlignment(SwingConstants.CENTER);
this.setForeground(Color.white);

View File

@@ -22,6 +22,7 @@ import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.JList;
import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
@@ -68,9 +69,9 @@ public class QuestWinLoseCardViewer extends FPanel {
this.setCornerDiameter(20);
this.setBorderToggle(false);
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
picture.setOpaque(false);
scroller.setBorder(null);
scroller.setBorder((Border)null);
this.setLayout(new MigLayout("insets 0, gap 0"));
this.add(scroller, "w 32%!, h 98%!, gap 1% 1% 1% 1%");

View File

@@ -40,6 +40,7 @@ import forge.gui.framework.FScreen;
import forge.gui.match.controllers.CDock;
import forge.gui.match.views.VField;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.view.FView;
import forge.view.arcane.CardPanel;
@@ -53,7 +54,7 @@ public enum TargetingOverlay {
/** */
SINGLETON_INSTANCE;
private final JPanel pnl = new OverlayPanel();
private final OverlayPanel pnl = new OverlayPanel();
private final List<CardPanel> cardPanels = new ArrayList<CardPanel>();
private final List<Point[]> arcs = new ArrayList<Point[]>();
@@ -66,7 +67,7 @@ public enum TargetingOverlay {
pnl.setOpaque(false);
pnl.setVisible(false);
pnl.setFocusTraversalKeysEnabled(false);
FSkin.get(pnl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
}
/** @return {@link javax.swing.JPanel} */
@@ -255,7 +256,7 @@ public enum TargetingOverlay {
endpoints.clear();
}
private class OverlayPanel extends JPanel {
private class OverlayPanel extends SkinnedPanel {
/**
* For some reason, the alpha channel background doesn't work properly on
* Windows 7, so the paintComponent override is required for a

View File

@@ -32,6 +32,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.game.GameEntity;
@@ -44,6 +45,7 @@ import forge.gui.toolbox.FButton;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.view.FDialog;
import forge.view.arcane.CardPanel;
@@ -112,12 +114,12 @@ public class VAssignDamage {
if (!damage.containsKey(source)) source = null; // to get player instead of fake card
FSkin.Colors brdrColor = VAssignDamage.this.canAssignTo(source) ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE;
FSkin.get((CardPanel) evt.getSource()).setLineBorder(FSkin.getColor(brdrColor), 2);
((CardPanel) evt.getSource()).setBorder(new FSkin.LineSkinBorder(FSkin.getColor(brdrColor), 2));
}
@Override
public void mouseExited(final MouseEvent evt) {
((CardPanel) evt.getSource()).setBorder(null);
((CardPanel) evt.getSource()).setBorder((Border)null);
}
@Override
@@ -153,8 +155,8 @@ public class VAssignDamage {
// Top-level UI stuff
final JPanel overlay = SOverlayUtils.genericOverlay();
final JPanel pnlMain = new JPanel();
FSkin.get(pnlMain).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
final SkinnedPanel pnlMain = new SkinnedPanel();
pnlMain.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Attacker area
final CardPanel pnlAttacker = new CardPanel(attacker0);
@@ -175,7 +177,7 @@ public class VAssignDamage {
pnlDefenders.setLayout(new MigLayout("insets 0, gap 0, ax center, " + wrap));
final FScrollPane scrDefenders = new FScrollPane(pnlDefenders);
scrDefenders.setBorder(null);
scrDefenders.setBorder((Border)null);
// Top row of cards...
for (final Card c : defenderCards) {

View File

@@ -6,11 +6,11 @@ import java.awt.Point;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Command;
@@ -26,6 +26,8 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FOverlay;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.gui.toolbox.FTextArea;
/**
@@ -34,10 +36,10 @@ import forge.gui.toolbox.FTextArea;
*/
public class ViewWinLose {
private final FButton btnContinue, btnRestart, btnQuit;
private final JPanel pnlCustom;
private final SkinnedPanel pnlCustom;
private final JLabel lblTitle = new JLabel("WinLoseFrame > lblTitle needs updating.");
private final JLabel lblStats = new JLabel("WinLoseFrame > lblStats needs updating.");
private final SkinnedLabel lblTitle = new SkinnedLabel("WinLoseFrame > lblTitle needs updating.");
private final SkinnedLabel lblStats = new SkinnedLabel("WinLoseFrame > lblStats needs updating.");
private final JPanel pnlOutcomes = new JPanel(new MigLayout("wrap, align center"));
private final Game game;
@@ -52,7 +54,7 @@ public class ViewWinLose {
final JPanel pnlLeft = new JPanel();
final JPanel pnlRight = new JPanel();
final JScrollPane scrCustom = new JScrollPane();
pnlCustom = new JPanel();
pnlCustom = new SkinnedPanel();
btnContinue = new FButton();
btnRestart = new FButton();
@@ -93,24 +95,24 @@ public class ViewWinLose {
lblTitle.setForeground(Color.white);
lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
FSkin.get(lblTitle).setFont(FSkin.getBoldFont(30));
lblTitle.setFont(FSkin.getBoldFont(30));
lblStats.setForeground(Color.white);
lblStats.setHorizontalAlignment(SwingConstants.CENTER);
FSkin.get(lblStats).setFont(FSkin.getFont(26));
lblStats.setFont(FSkin.getFont(26));
btnContinue.setText("Next Game");
FSkin.get(btnContinue).setFont(FSkin.getFont(22));
btnContinue.setFont(FSkin.getFont(22));
btnRestart.setText("Start New Match");
FSkin.get(btnRestart).setFont(FSkin.getFont(22));
btnRestart.setFont(FSkin.getFont(22));
btnQuit.setText("Quit Match");
FSkin.get(btnQuit).setFont(FSkin.getFont(22));
btnQuit.setFont(FSkin.getFont(22));
btnContinue.setEnabled(!game0.getMatch().isMatchOver());
// Assemble game log scroller.
final FTextArea txtLog = new FTextArea();
txtLog.setText(game.getGameLog().getLogText(null).replace("[COMPUTER]", "[AI]"));
FSkin.get(txtLog).setFont(FSkin.getFont(14));
txtLog.setFont(FSkin.getFont(14));
txtLog.setFocusable(true); // allow highlighting and copying of log
FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build();
@@ -158,7 +160,7 @@ public class ViewWinLose {
final JPanel pnlLog = new JPanel(new MigLayout("insets 0, wrap, ax center"));
final FScrollPane scrLog = new FScrollPane(txtLog);
scrLog.setBorder(null);
scrLog.setBorder((Border)null);
pnlLog.setOpaque(false);
pnlLog.add(
@@ -215,7 +217,7 @@ public class ViewWinLose {
}
/** @return {@link javax.swing.JPanel} */
public JPanel getPnlCustom() {
public SkinnedPanel getPnlCustom() {
return this.pnlCustom;
}

View File

@@ -5,11 +5,8 @@ import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import forge.Singletons;
import forge.gui.match.CMatchUI;
@@ -18,6 +15,10 @@ import forge.gui.menus.MenuUtil;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinIcon;
import forge.gui.toolbox.FSkin.SkinProp;
import forge.gui.toolbox.FSkin.SkinnedCheckBoxMenuItem;
import forge.gui.toolbox.FSkin.SkinnedMenu;
import forge.gui.toolbox.FSkin.SkinnedMenuItem;
import forge.gui.toolbox.FSkin.SkinnedRadioButtonMenuItem;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
@@ -50,8 +51,8 @@ public final class GameMenu {
return menu;
}
private static JMenuItem getMenuItem_GameSoundEffects() {
JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem("Sound Effects");
private static SkinnedCheckBoxMenuItem getMenuItem_GameSoundEffects() {
SkinnedCheckBoxMenuItem menuItem = new SkinnedCheckBoxMenuItem("Sound Effects");
menuItem.setState(prefs.getPrefBoolean(FPref.UI_ENABLE_SOUNDS));
menuItem.addActionListener(getSoundEffectsAction());
return menuItem;
@@ -70,8 +71,8 @@ public final class GameMenu {
prefs.save();
}
private static JMenuItem getMenuItem_Undo() {
JMenuItem menuItem = new JMenuItem("Undo");
private static SkinnedMenuItem getMenuItem_Undo() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Undo");
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_Z));
menuItem.addActionListener(getUndoAction());
return menuItem;
@@ -86,9 +87,9 @@ public final class GameMenu {
};
}
private static JMenuItem getMenuItem_Concede() {
JMenuItem menuItem = new JMenuItem("Concede");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_CONCEDE) : null));
private static SkinnedMenuItem getMenuItem_Concede() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Concede");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_CONCEDE) : null));
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_Q));
menuItem.addActionListener(getConcedeAction());
return menuItem;
@@ -103,9 +104,9 @@ public final class GameMenu {
};
}
private static JMenuItem getMenuItem_AlphaStrike() {
JMenuItem menuItem = new JMenuItem("Alpha Strike");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ALPHASTRIKE) : null));
private static SkinnedMenuItem getMenuItem_AlphaStrike() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Alpha Strike");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ALPHASTRIKE) : null));
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_A));
menuItem.addActionListener(getAlphaStrikeAction());
return menuItem;
@@ -120,9 +121,9 @@ public final class GameMenu {
};
}
private static JMenuItem getMenuItem_EndTurn() {
JMenuItem menuItem = new JMenuItem("End Turn");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ENDTURN) : null));
private static SkinnedMenuItem getMenuItem_EndTurn() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("End Turn");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ENDTURN) : null));
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_E));
menuItem.addActionListener(getEndTurnAction());
return menuItem;
@@ -137,14 +138,13 @@ public final class GameMenu {
};
}
private static JMenu getMenuItem_TargetingArcs() {
JMenu menu = new JMenu("Targeting Arcs");
private static SkinnedMenu getMenuItem_TargetingArcs() {
SkinnedMenu menu = new SkinnedMenu("Targeting Arcs");
ButtonGroup group = new ButtonGroup();
SkinIcon menuIcon = MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ARCSOFF);
JRadioButtonMenuItem menuItem;
SkinnedRadioButtonMenuItem menuItem;
menuItem = getTargetingArcRadioButton("Off", FSkin.DockIcons.ICO_ARCSOFF, 0);
if (menuItem.isSelected()) { menuIcon = MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ARCSOFF); }
group.add(menuItem);
@@ -157,15 +157,15 @@ public final class GameMenu {
if (menuItem.isSelected()) { menuIcon = MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ARCSON); }
group.add(menuItem);
FSkin.get(menu).setIcon((showIcons ? menuIcon : null));
menu.setIcon((showIcons ? menuIcon : null));
menu.add(menuItem);
return menu;
}
private static JRadioButtonMenuItem getTargetingArcRadioButton(String caption, SkinProp icon, final int arcState) {
final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(caption);
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(icon) : null));
private static SkinnedRadioButtonMenuItem getTargetingArcRadioButton(String caption, SkinProp icon, final int arcState) {
final SkinnedRadioButtonMenuItem menuItem = new SkinnedRadioButtonMenuItem(caption);
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(icon) : null));
menuItem.setSelected(arcState == controller.getArcState());
menuItem.addActionListener(getTargetingRadioButtonAction(arcState));
return menuItem;
@@ -178,20 +178,20 @@ public final class GameMenu {
prefs.setPref(FPref.UI_TARGETING_OVERLAY, String.valueOf(arcState));
prefs.save();
controller.setArcState(arcState);
setTargetingArcMenuIcon((JMenuItem)e.getSource());
setTargetingArcMenuIcon((SkinnedMenuItem)e.getSource());
}
};
}
private static void setTargetingArcMenuIcon(JMenuItem item) {
private static void setTargetingArcMenuIcon(SkinnedMenuItem item) {
JPopupMenu pop = (JPopupMenu)item.getParent();
JMenu menu = (JMenu)pop.getInvoker();
menu.setIcon(item.getIcon());
}
private static JMenuItem getMenuItem_ViewDeckList() {
JMenuItem menuItem = new JMenuItem("Deck List");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_DECKLIST) : null));
private static SkinnedMenuItem getMenuItem_ViewDeckList() {
SkinnedMenuItem menuItem = new SkinnedMenuItem("Deck List");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_DECKLIST) : null));
menuItem.addActionListener(getViewDeckListAction());
return menuItem;
}

View File

@@ -17,7 +17,6 @@
*/
package forge.gui.match.views;
import javax.swing.JTextArea;
import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
@@ -25,6 +24,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CCombat;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
/**
* Assembles Swing components of combat report.
@@ -39,13 +39,12 @@ public enum VCombat implements IVDoc<CCombat> {
private DragCell parentCell;
private final DragTab tab = new DragTab("Combat");
final JTextArea tar = new JTextArea();
final SkinnedTextArea tar = new SkinnedTextArea();
private VCombat() {
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
tar.setOpaque(false);
tarSkin.setMatteBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setBorder(new FSkin.MatteSkinBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setFocusable(false);
tar.setLineWrap(true);
}

View File

@@ -71,7 +71,7 @@ public class VCommand implements IVDoc<CCommand> {
control = new CCommand(player, this);
FSkin.get(tabletop).setMatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
tabletop.setBorder(new FSkin.MatteSkinBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
tabletop.setOpaque(false);
scroller.setViewportView(this.tabletop);

View File

@@ -27,6 +27,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CDetail;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Assembles Swing components of card detail area.
@@ -43,11 +44,11 @@ public enum VDetail implements IVDoc<CDetail> {
// Top-level containers
private final CardDetailPanel pnlDetail = new CardDetailPanel(null);
private final JLabel lblFlipcard = new JLabel();
private final SkinnedLabel lblFlipcard = new SkinnedLabel();
//========= Constructor
private VDetail() {
FSkin.get(lblFlipcard).setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
lblFlipcard.setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
lblFlipcard.setVisible(false);
}

View File

@@ -37,6 +37,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CDev;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Assembles Swing components of players report.
@@ -235,7 +236,7 @@ public enum VDev implements IVDoc<CDev> {
* Labels that act as buttons which control dev mode functions. Labels are
* used to support multiline text.
*/
public class DevLabel extends JLabel {
public class DevLabel extends SkinnedLabel {
private static final long serialVersionUID = 7917311680519060700L;
private FSkin.SkinColor defaultBG = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
@@ -284,27 +285,27 @@ public enum VDev implements IVDoc<CDev> {
this.r = 6; // Radius (for paintComponent)
this.i = 2; // Insets (for paintComponent)
this.setEnabled(true);
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.pressedBG);
DevLabel.this.setBackground(DevLabel.this.pressedBG);
}
@Override
public void mouseReleased(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.defaultBG);
DevLabel.this.setBackground(DevLabel.this.defaultBG);
}
@Override
public void mouseEntered(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.hoverBG);
DevLabel.this.setBackground(DevLabel.this.hoverBG);
}
@Override
public void mouseExited(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.defaultBG);
DevLabel.this.setBackground(DevLabel.this.defaultBG);
}
});
}
@@ -329,7 +330,7 @@ public enum VDev implements IVDoc<CDev> {
this.enabled = b;
this.setText(s);
this.setToolTipText(s);
FSkin.get(this).setBackground(this.defaultBG);
this.setBackground(this.defaultBG);
}
/**

View File

@@ -23,7 +23,6 @@ import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import forge.Command;
@@ -38,6 +37,7 @@ import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinImage;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Assembles Swing components of button dock area.
@@ -177,7 +177,7 @@ public enum VDock implements IVDoc<CDock> {
* Buttons in Dock. JLabels are used to allow hover effects.
*/
@SuppressWarnings("serial")
public class DockButton extends JLabel implements ILocalRepaint {
public class DockButton extends SkinnedLabel implements ILocalRepaint {
private final SkinImage img;
private final SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
private final Color defaultBG = new Color(0, 0, 0, 0);
@@ -215,12 +215,12 @@ public enum VDock implements IVDoc<CDock> {
@Override
public void onMouseEnter(final MouseEvent e) {
FSkin.get(DockButton.this).setBackground(DockButton.this.hoverBG);
DockButton.this.setBackground(DockButton.this.hoverBG);
}
@Override
public void onMouseExit(final MouseEvent e) {
FSkin.get(DockButton.this).setBackground(DockButton.this.defaultBG);
DockButton.this.setBackground(DockButton.this.defaultBG);
}
});
}
@@ -247,7 +247,7 @@ public enum VDock implements IVDoc<CDock> {
g.setColor(this.getBackground());
g.fillRect(0, 0, this.w, this.h);
if (FSkin.get(this).getBackground() == this.hoverBG) {
if (this.getSkin().getBackground() == this.hoverBG) {
FSkin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
}
else {

View File

@@ -40,6 +40,7 @@ import forge.gui.match.CMatchUI;
import forge.gui.match.controllers.CField;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.gui.toolbox.special.PhaseIndicator;
import forge.gui.toolbox.special.PlayerDetailsPanel;
import forge.view.arcane.PlayArea;
@@ -62,7 +63,7 @@ public class VField implements IVDoc<CField> {
// Top-level containers
private final JScrollPane scroller = new JScrollPane();
private final PlayArea tabletop;
private final JPanel avatarArea = new JPanel();
private final SkinnedPanel avatarArea = new SkinnedPanel();
private final PlayerDetailsPanel detailsPanel;
@@ -100,7 +101,7 @@ public class VField implements IVDoc<CField> {
control = new CField(player, this, playerViewer);
avatarArea.setOpaque(false);
FSkin.get(avatarArea).setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
avatarArea.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
avatarArea.setLayout(new MigLayout("insets 0, gap 0"));
avatarArea.add(lblAvatar, "w 100%!, h 70%!, wrap, gaptop 4%");
avatarArea.add(lblLife, "w 100%!, h 30%!, gaptop 4%");
@@ -111,7 +112,7 @@ public class VField implements IVDoc<CField> {
public void mouseEntered(final MouseEvent e) {
avatarArea.setOpaque(true);
if (!isHighlighted())
FSkin.get(avatarArea).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
avatarArea.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
}
@Override
@@ -122,7 +123,7 @@ public class VField implements IVDoc<CField> {
}
});
FSkin.get(tabletop).setMatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
tabletop.setBorder(new FSkin.MatteSkinBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
tabletop.setOpaque(false);
scroller.setViewportView(this.tabletop);
@@ -258,10 +259,10 @@ public class VField implements IVDoc<CField> {
this.getLblLife().setText("" + player.getLife());
if (player.getLife() > 5) {
FSkin.get(this.getLblLife()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.getLblLife().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
else {
FSkin.get(this.getLblLife()).setForeground(Color.red);
this.getLblLife().setForeground(Color.red);
}
boolean highlighted = isHighlighted();

View File

@@ -27,6 +27,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CPicture;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Assembles Swing components of card picture area.
@@ -43,11 +44,11 @@ public enum VPicture implements IVDoc<CPicture> {
// Top-level containers
private final CardPicturePanel pnlPicture = new CardPicturePanel();
private final JLabel lblFlipcard = new JLabel();
private final SkinnedLabel lblFlipcard = new SkinnedLabel();
//========= Constructor
private VPicture() {
FSkin.get(lblFlipcard).setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
lblFlipcard.setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
pnlPicture.setOpaque(false);
lblFlipcard.setVisible(false);
}

View File

@@ -24,6 +24,7 @@ import java.util.Map.Entry;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
import forge.game.Game;
@@ -38,6 +39,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CPlayers;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.properties.ForgePreferences.FPref;
/**
@@ -94,7 +96,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
this.infoLBLs.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords, antes, cmd });
// Set border on bottom label, and larger font on player name
FSkin.get(cmd).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
cmd.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
name.setText(p.getName());
}
}
@@ -190,10 +192,10 @@ public enum VPlayers implements IVDoc<CPlayers> {
/** A quick JLabel for info in "players" panel, to consolidate styling. */
@SuppressWarnings("serial")
private class InfoLabel extends JLabel {
private class InfoLabel extends SkinnedLabel {
public InfoLabel() {
super();
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
}
}

View File

@@ -87,7 +87,7 @@ public enum VPrompt implements IVDoc<CPrompt> {
btnOK.addKeyListener(buttonKeyAdapter);
btnCancel.addKeyListener(buttonKeyAdapter);
FSkin.get(tarMessage).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tarMessage.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tarMessage.setMargin(new Insets(3, 3, 3, 3));
}
@@ -104,11 +104,11 @@ public enum VPrompt implements IVDoc<CPrompt> {
// wrap : 2 columns required for btnOk and btnCancel.
container.setLayout(new MigLayout("wrap 2, gap 0px!, insets 1px 1px 3px 1px"));
if (prefs.getPrefBoolean(FPref.UI_COMPACT_PROMPT)) { //hide header and use smaller font if compact prompt
FSkin.get(tarMessage).setFont(FSkin.getFont(12));
tarMessage.setFont(FSkin.getFont(12));
}
else {
container.add(lblGames, "span 2, w 10:100%, h 22px!");
FSkin.get(tarMessage).setFont(FSkin.getFont(14));
tarMessage.setFont(FSkin.getFont(14));
}
lblGames.setText("Game Setup");

View File

@@ -54,6 +54,7 @@ import forge.gui.match.controllers.CStack;
import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FScrollPanel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
import forge.properties.ForgePreferences.FPref;
import forge.view.arcane.CardArea;
import forge.view.arcane.CardPanel;
@@ -186,7 +187,7 @@ public enum VStack implements IVDoc<CStack> {
Animation.moveCard(stackArea.addCard(spell.getSourceCard()));
}
else {
JTextArea tar = new JTextArea(txt);
SkinnedTextArea tar = new SkinnedTextArea(txt);
tar.setToolTipText(txt);
tar.setOpaque(true);
tar.setBorder(border);
@@ -249,10 +250,10 @@ public enum VStack implements IVDoc<CStack> {
}
}
private void setSpellColor(JTextArea tar, SpellAbilityStackInstance s0) {
private void setSpellColor(SkinnedTextArea tar, SpellAbilityStackInstance s0) {
if (s0.getStackDescription().startsWith("Morph ")) {
tar.setBackground(new Color(0, 0, 0, 0));
FSkin.get(tar).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
else if (CardUtil.getColors(s0.getSourceCard()).isMulticolor()) {
tar.setBackground(new Color(253, 175, 63));
@@ -284,7 +285,7 @@ public enum VStack implements IVDoc<CStack> {
}
else {
tar.setBackground(new Color(0, 0, 0, 0));
FSkin.get(tar).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
}

View File

@@ -19,6 +19,7 @@ import forge.gui.MouseUtil.MouseCursor;
import forge.gui.framework.FScreen;
import forge.gui.match.controllers.CDock;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedMenuItem;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
import forge.view.FFrame;
@@ -77,8 +78,7 @@ public final class LayoutMenu {
JRadioButtonMenuItem menuItem;
ButtonGroup group = new ButtonGroup();
String currentSkin = prefs.getPref(FPref.UI_SKIN);
String[] skins = FSkin.getSkinNamesArray(true);
for (String skin : skins) {
for (String skin : FSkin.getAllSkins()) {
menuItem = new JRadioButtonMenuItem(skin);
group.add(menuItem);
if (skin.equals(currentSkin)) {
@@ -143,8 +143,8 @@ public final class LayoutMenu {
}
private static JMenuItem getMenuItem_SaveLayout() {
JMenuItem menuItem = new JMenuItem("Save Current Layout");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_SAVELAYOUT) : null));
SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Current Layout");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_SAVELAYOUT) : null));
menuItem.addActionListener(getSaveLayoutAction());
return menuItem;
}
@@ -159,8 +159,8 @@ public final class LayoutMenu {
}
private static JMenuItem getMenuItem_OpenLayout() {
JMenuItem menuItem = new JMenuItem("Open...");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_OPENLAYOUT) : null));
SkinnedMenuItem menuItem = new SkinnedMenuItem("Open...");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_OPENLAYOUT) : null));
menuItem.addActionListener(getOpenLayoutAction());
return menuItem;
}
@@ -175,8 +175,8 @@ public final class LayoutMenu {
}
private static JMenuItem getMenuItem_RevertLayout() {
JMenuItem menuItem = new JMenuItem("Refresh");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_REVERTLAYOUT) : null));
SkinnedMenuItem menuItem = new SkinnedMenuItem("Refresh");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_REVERTLAYOUT) : null));
menuItem.addActionListener(getRevertLayoutAction());
return menuItem;
}

View File

@@ -26,7 +26,6 @@ import com.esotericsoftware.minlog.Log;
import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostShard;
import forge.gui.toolbox.FSkin.ComponentSkin;
import forge.gui.toolbox.FSkin.SkinImage;
/**
@@ -132,7 +131,7 @@ public class CardFaceSymbols {
* @param y
* a int.
*/
public static void draw(final ComponentSkin<?> skin, Graphics g, ManaCost manaCost, int x, int y) {
public static void draw(Graphics g, ManaCost manaCost, int x, int y) {
if (manaCost.isNoCost()) {
return;
}
@@ -145,25 +144,25 @@ public class CardFaceSymbols {
if (hasGeneric) {
for (final ManaCostShard s : manaCost) { //render X shards before generic
if (s == ManaCostShard.X) {
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y);
CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
xpos += offset;
}
}
final String sGeneric = Integer.toString(genericManaCost);
CardFaceSymbols.drawSymbol(sGeneric, skin, g, xpos, y);
CardFaceSymbols.drawSymbol(sGeneric, g, xpos, y);
xpos += offset;
for (final ManaCostShard s : manaCost) { //render non-X shards after generic
if (s != ManaCostShard.X) {
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y);
CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
xpos += offset;
}
}
}
else { //if no generic, just render shards in order
for (final ManaCostShard s : manaCost) {
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y);
CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
xpos += offset;
}
}
@@ -179,7 +178,7 @@ public class CardFaceSymbols {
* @param w an int
* @param h and int
*/
public static void drawOther(final ComponentSkin<?> skin, final Graphics g, String s, int x, final int y, final int w, final int h) {
public static void drawOther(final Graphics g, String s, int x, final int y, final int w, final int h) {
if (s.length() == 0) {
return;
}
@@ -209,7 +208,7 @@ public class CardFaceSymbols {
* @param y
* a int.
*/
public static void drawAttack(final ComponentSkin<?> skin, final Graphics g, final int x, final int y) {
public static void drawAttack(final Graphics g, final int x, final int y) {
FSkin.drawImage(g, MANA_IMAGES.get("attack"), x, y);
}
@@ -227,7 +226,7 @@ public class CardFaceSymbols {
* @param y
* a int.
*/
public static void drawSymbol(final String imageName, final ComponentSkin<?> skin, final Graphics g, final int x, final int y) {
public static void drawSymbol(final String imageName, final Graphics g, final int x, final int y) {
FSkin.drawImage(g, MANA_IMAGES.get(imageName), x, y);
}

View File

@@ -32,11 +32,9 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinImage;
import forge.gui.toolbox.FSkin.SkinnedButton;
/**
* The core JButton used throughout the Forge project. Follows skin font and
@@ -44,10 +42,9 @@ import forge.gui.toolbox.FSkin.SkinImage;
*
*/
@SuppressWarnings("serial")
public class FButton extends JButton implements ILocalRepaint {
public class FButton extends SkinnedButton implements ILocalRepaint {
/** The img r. */
private final JComponentSkin<FButton> skin;
private SkinImage imgL;
private SkinImage imgM;
private SkinImage imgR;
@@ -68,14 +65,13 @@ public class FButton extends JButton implements ILocalRepaint {
public FButton(final String label) {
super(label);
this.setOpaque(false);
skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setBackground(Color.red);
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setBackground(Color.red);
this.setFocusPainted(false);
this.setBorder(BorderFactory.createEmptyBorder());
this.setContentAreaFilled(false);
this.setMargin(new Insets(0, 25, 0, 25));
skin.setFont(FSkin.getBoldFont(14));
this.setFont(FSkin.getBoldFont(14));
this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT);
this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER);
this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT);

View File

@@ -1,23 +1,20 @@
package forge.gui.toolbox;
import javax.swing.JCheckBox;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinnedCheckBox;
/**
* A custom instance of JCheckBox using Forge skin properties.
*/
@SuppressWarnings("serial")
public class FCheckBox extends JCheckBox {
public class FCheckBox extends SkinnedCheckBox {
public FCheckBox() {
this("");
}
public FCheckBox(final String s0) {
super(s0);
JComponentSkin<FCheckBox> skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setFont(FSkin.getFont(14));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getFont(14));
this.setOpaque(false);
}

View File

@@ -10,7 +10,6 @@ import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
@@ -23,9 +22,10 @@ import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.ComboPopup;
import forge.gui.toolbox.FSkin.SkinFont;
import forge.gui.toolbox.FSkin.SkinnedComboBox;
@SuppressWarnings("serial")
public class FComboBox<E> extends JComboBox<E> {
public class FComboBox<E> extends SkinnedComboBox<E> {
public enum TextAlignment {
LEFT (SwingConstants.LEFT),
RIGHT (SwingConstants.RIGHT),
@@ -78,7 +78,7 @@ public class FComboBox<E> extends JComboBox<E> {
public void setSkinFont(SkinFont skinFont0) {
this.skinFont = skinFont0;
FSkin.get(this).setFont(skinFont0);
this.setFont(skinFont0);
}
public int getAutoSizeWidth() {
@@ -161,5 +161,4 @@ public class FComboBox<E> extends JComboBox<E> {
}
}
}
}

View File

@@ -1,18 +1,11 @@
package forge.gui.toolbox;
import java.awt.Component;
import java.awt.FlowLayout;
import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import javax.swing.border.EmptyBorder;
import forge.Singletons;
import forge.gui.toolbox.FSkin.JLabelSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.properties.ForgePreferences.FPref;
/**
@@ -69,10 +62,9 @@ public class FComboBoxPanel<E> extends JPanel {
private void setLabelLayout() {
if (this.comboBoxCaption != null && !this.comboBoxCaption.isEmpty()) {
JLabel comboLabel = new JLabel(this.comboBoxCaption);
JLabelSkin<JLabel> labelSkin = FSkin.get(comboLabel);
labelSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
labelSkin.setFont(FSkin.getBoldFont(12));
SkinnedLabel comboLabel = new SkinnedLabel(this.comboBoxCaption);
comboLabel.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
comboLabel.setFont(FSkin.getBoldFont(12));
this.add(comboLabel);
}
}
@@ -80,11 +72,9 @@ public class FComboBoxPanel<E> extends JPanel {
private void setComboBoxLayout() {
if (this.comboBox != null) {
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) {
FSkin.JComponentSkin<FComboBox<E>> comboBoxSkin = FSkin.get(this.comboBox);
comboBoxSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
comboBoxSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
comboBoxSkin.setFont(FSkin.getFont(12));
this.comboBox.setRenderer(new ComplexCellRenderer<E>());
this.comboBox.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.comboBox.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.comboBox.setFont(FSkin.getFont(12));
}
this.comboBox.setEditable(false);
this.comboBox.setFocusable(true);
@@ -104,25 +94,4 @@ public class FComboBoxPanel<E> extends JPanel {
private void refreshSkin() {
this.comboBox = FComboBoxWrapper.refreshComboBoxSkin(this.comboBox);
}
private class ComplexCellRenderer<E1> implements ListCellRenderer<E1> {
private DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
/* (non-Javadoc)
* @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
*/
@Override
public Component getListCellRendererComponent(JList<? extends E1> lst0, E1 val0, int i0,
boolean isSelected, boolean cellHasFocus) {
JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
lst0, val0, i0, isSelected, cellHasFocus);
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
FSkin.get(lblItem).setFont(FSkin.getFont(12));
lblItem.setOpaque(isSelected);
return lblItem;
}
}
}

View File

@@ -6,15 +6,16 @@ import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import javax.swing.JLabel;
import javax.swing.Timer;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Digital clock label that displays current time
*
*/
@SuppressWarnings("serial")
public class FDigitalClock extends JLabel {
public class FDigitalClock extends SkinnedLabel {
private static final Calendar now = Calendar.getInstance();
private static final DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT);
private static final ArrayList<FDigitalClock> clocks = new ArrayList<FDigitalClock>();

View File

@@ -3,18 +3,19 @@ package forge.gui.toolbox;
import javax.swing.JEditorPane;
import javax.swing.SwingUtilities;
import forge.gui.toolbox.FSkin.SkinnedEditorPane;
/**
* Viewer for HTML
*
*/
@SuppressWarnings("serial")
public class FHtmlViewer extends JEditorPane {
public class FHtmlViewer extends SkinnedEditorPane {
/** */
public FHtmlViewer() {
super();
FSkin.JTextComponentSkin<FHtmlViewer> skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setOpaque(false);
this.setFocusable(false);
this.setEditable(false);

View File

@@ -21,7 +21,6 @@ import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.Timer;
@@ -30,9 +29,9 @@ import javax.swing.event.AncestorListener;
import forge.Command;
import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin.JLabelSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinImage;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/**
* Uses the Builder pattern to facilitate/encourage inline styling.
@@ -50,7 +49,7 @@ import forge.gui.toolbox.FSkin.SkinImage;
* - Can execute command when clicked
*/
@SuppressWarnings("serial")
public class FLabel extends JLabel implements ILocalRepaint {
public class FLabel extends SkinnedLabel implements ILocalRepaint {
/**
* Uses the Builder pattern to facilitate/encourage inline styling.
* Credit to Effective Java 2 (Joshua Bloch).
@@ -188,8 +187,6 @@ public class FLabel extends JLabel implements ILocalRepaint {
// Call this using FLabel.Builder()...
protected FLabel(final Builder b0) {
super(b0.bldText);
this.skin = FSkin.get(this);
// Init fields from builder
this.iconScaleFactor = b0.bldIconScaleFactor;
@@ -234,8 +231,8 @@ public class FLabel extends JLabel implements ILocalRepaint {
if (b0.bldUseSkinColors) {
// Non-custom display properties
this.skin.setForeground(clrText);
this.skin.setBackground(clrMain);
this.setForeground(clrText);
this.setBackground(clrMain);
}
// Resize adapter
@@ -249,7 +246,6 @@ public class FLabel extends JLabel implements ILocalRepaint {
//========== Variable initialization
// Final inits
private final JLabelSkin<FLabel> skin;
private final SkinColor clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
private final SkinColor clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
private final SkinColor clrMain = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
@@ -402,9 +398,9 @@ public class FLabel extends JLabel implements ILocalRepaint {
public void setFontSize(final int i0) {
switch(this.fontStyle) {
case Font.BOLD: skin.setFont(FSkin.getBoldFont(i0)); break;
case Font.ITALIC: skin.setFont(FSkin.getItalicFont(i0)); break;
default: skin.setFont(FSkin.getFont(i0));
case Font.BOLD: this.setFont(FSkin.getBoldFont(i0)); break;
case Font.ITALIC: this.setFont(FSkin.getItalicFont(i0)); break;
default: this.setFont(FSkin.getFont(i0));
}
}
@@ -469,10 +465,6 @@ public class FLabel extends JLabel implements ILocalRepaint {
return this.cmdRightClick;
}
public void setIcon(FSkin.SkinImage icon) {
this.skin.setIcon(icon);
}
@Override
// Must be public.
public void setIcon(final Icon i0) {

View File

@@ -1,6 +1,7 @@
package forge.gui.toolbox;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
@@ -8,13 +9,15 @@ import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.border.EmptyBorder;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.gui.toolbox.FSkin.SkinnedList;
/**
* A JList object using Forge skin properties.
*
*/
@SuppressWarnings("serial")
public class FList<E> extends JList<E> {
public class FList<E> extends SkinnedList<E> {
public FList() {
super();
applySkin();
@@ -45,7 +48,7 @@ public class FList<E> extends JList<E> {
* TODO: Write javadoc for this method.
*/
private void applySkin() {
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
ListCellRenderer<E> renderer = new ComplexCellRenderer<E>();
setCellRenderer(renderer);
@@ -58,14 +61,14 @@ public class FList<E> extends JList<E> {
public Component getListCellRendererComponent(JList<? extends E1> lst0, E1 val0, int i0,
boolean isSelected, boolean cellHasFocus) {
JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
JLabel defaultItem = (JLabel) defaultRenderer.getListCellRendererComponent(
lst0, val0, i0, isSelected, cellHasFocus);
SkinnedLabel lblItem = new SkinnedLabel(defaultItem.getText());
FSkin.JLabelSkin<JLabel> lblItemSkin = FSkin.get(lblItem);
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
lblItemSkin.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
lblItemSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblItemSkin.setFont(FSkin.getFont(12));
lblItem.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
lblItem.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
lblItem.setFont(FSkin.getFont(12));
lblItem.setOpaque(isSelected);
return lblItem;
}

View File

@@ -150,7 +150,7 @@ public class FOptionPane extends FDialog {
}
if (message != null) {
FTextArea prompt = new FTextArea(message);
FSkin.get(prompt).setFont(FSkin.getFont(14));
prompt.setFont(FSkin.getFont(14));
prompt.setAutoSize(true);
Dimension parentSize = JOptionPane.getRootFrame().getSize();
prompt.setMaximumSize(new Dimension(parentSize.width / 2, parentSize.height - 100));

View File

@@ -26,9 +26,8 @@ import java.awt.event.MouseMotionAdapter;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/**
* Semi-transparent overlay panel. Should be used with layered panes.
@@ -43,7 +42,7 @@ public enum FOverlay {
SINGLETON_INSTANCE;
private final JButton btnClose = new JButton("X");
private final JPanel pnl = new OverlayPanel();
private final OverlayPanel pnl = new OverlayPanel();
/**
* Semi-transparent overlay panel. Should be used with layered panes.
@@ -83,12 +82,11 @@ public enum FOverlay {
return this.btnClose;
}
/** @return {@link javax.swing.JPanel} */
public JPanel getPanel() {
public SkinnedPanel getPanel() {
return this.pnl;
}
private class OverlayPanel extends JPanel {
private class OverlayPanel extends SkinnedPanel {
/**
* For some reason, the alpha channel background doesn't work properly on
* Windows 7, so the paintComponent override is required for a

View File

@@ -30,14 +30,12 @@ import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import forge.Command;
import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin.FPanelBase;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinImage;
/**
* Core panel used in UI.
@@ -51,9 +49,7 @@ import forge.gui.toolbox.FSkin.SkinImage;
* - Border toggle<br>
*/
@SuppressWarnings("serial")
public class FPanel extends JPanel implements ILocalRepaint {
//========== Variable initialization
protected final FSkin.FPanelSkin<FPanel> skin;
public class FPanel extends FPanelBase implements ILocalRepaint {
// Defaults for adjustable values
private boolean selectable = false;
private boolean hoverable = false;
@@ -89,8 +85,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
this.setOpaque(false);
// Background will follow skin theme.
skin = FSkin.get(this);
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
}
// Mouse event handler
@@ -143,15 +138,13 @@ public class FPanel extends JPanel implements ILocalRepaint {
/** @param bool0 &emsp; boolean */
public void setSelected(final boolean bool0) {
selected = bool0;
if (bool0) { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
else { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
if (bool0) { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
else { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
repaintSelf();
}
/** @param img0 &emsp; {@link java.awt.Image} */
public void setForegroundImage(final Image img0) {
skin.resetForegroundImage(); //must reset if non-skin image set
protected void onSetForegroundImage(final Image img0) {
if (img0 == null) {
this.foregroundImage = null;
return;
@@ -163,16 +156,6 @@ public class FPanel extends JPanel implements ILocalRepaint {
this.iar = (double) imgW / (double) imgH;
}
/** @param ii0 &emsp; {@link javax.swing.ImageIcon} */
public void setForegroundImage(final ImageIcon ii0) {
setForegroundImage(ii0.getImage());
}
/** @param ii0 &emsp; {@link javax.swing.ImageIcon} */
public void setForegroundImage(final SkinImage skinImage) {
skin.setForegroundImage(skinImage);
}
/** Aligns NON-STRETCHED foreground image.
* Must use SwingConstants.
* @param i0 &emsp; int
@@ -197,9 +180,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
}
/** @param img0 &emsp; {@link java.awt.Image} */
public void setBackgroundTexture(final Image img0) {
skin.resetBackgroundTexture(); //must reset if non-skin image set
protected void onSetBackgroundTexture(final Image img0) {
if (img0 == null) { return; }
this.backgroundTexture = img0;
@@ -207,27 +188,11 @@ public class FPanel extends JPanel implements ILocalRepaint {
this.textureH = img0.getHeight(null);
}
/** @param ii0 &emsp; {@link javax.swing.ImageIcon} */
public void setBackgroundTexture(final ImageIcon ii0) {
setBackgroundTexture(ii0.getImage());
}
/** @param ii0 &emsp; {@link javax.swing.ImageIcon} */
public void setBackgroundTexture(final SkinImage skinImage) {
skin.setBackgroundTexture(skinImage);
}
/** @param clr0 &emsp; {@link java.awt.Color} */
public void setBackgroundTextureOverlay(final Color color) {
skin.resetBackgroundTexture(); //must reset if non-skin color set
public void onSetBackgroundTextureOverlay(final Color color) {
this.backgroundTextureOverlay = color;
}
/** @param clr0 &emsp; {@link forge.gui.toolbox.FSkin.SkinColor} */
public void setBackgroundTextureOverlay(final SkinColor skinColor) {
skin.setBackgroundTextureOverlay(skinColor);
}
/** @param bool0 &emsp; boolean */
public void setBorderToggle(final boolean bool0) {
this.borderToggle = bool0;
@@ -293,7 +258,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
if (selected) { FSkin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
else if (hovered) { FSkin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_HOVER)); }
else if (selectable) { FSkin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
else { FSkin.setGraphicsColor(g2d0, skin.getBackground()); }
else { FSkin.setGraphicsColor(g2d0, getSkin().getBackground()); }
g2d0.fillRoundRect(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter);
}

View File

@@ -1,14 +1,12 @@
package forge.gui.toolbox;
import javax.swing.JRadioButton;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinnedRadioButton;
/**
* A custom instance of JRadioButton using Forge skin properties.
*/
@SuppressWarnings("serial")
public class FRadioButton extends JRadioButton {
public class FRadioButton extends SkinnedRadioButton {
/** */
public FRadioButton() {
this("");
@@ -18,9 +16,8 @@ public class FRadioButton extends JRadioButton {
public FRadioButton(String s0) {
super();
this.setText(s0);
JComponentSkin<FRadioButton> skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setFont(FSkin.getFont(14));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getFont(14));
this.setOpaque(false);
}
}

View File

@@ -2,15 +2,16 @@ package forge.gui.toolbox;
import java.awt.Component;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import forge.gui.toolbox.FSkin.SkinnedScrollPane;
/**
* A very basic extension of JScrollPane to centralize common styling changes.
*
*/
@SuppressWarnings("serial")
public class FScrollPane extends JScrollPane {
public class FScrollPane extends SkinnedScrollPane {
/**
* A very basic extension of JScrollPane to centralize common styling changes.
* This constructor assumes "as needed" for horizontal and vertical scroll policies.
@@ -32,7 +33,7 @@ public class FScrollPane extends JScrollPane {
super(c0, vertical0, horizontal0);
getVerticalScrollBar().setUnitIncrement(16);
getViewport().setOpaque(false);
FSkin.get(this).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
this.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
setOpaque(false);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,13 +7,15 @@ import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.text.NumberFormatter;
import forge.gui.toolbox.FSkin.SkinnedSpinner;
/**
* A custom instance of JSpinner using Forge skin properties. Only numeric
* integer spinners are implemented, since that's all we've needed so far.
*
*/
@SuppressWarnings("serial")
public class FSpinner extends JSpinner {
public class FSpinner extends SkinnedSpinner {
public static class Builder {
//========== Default values for FTextField are set here.
private int initialValue = 0;
@@ -35,12 +37,11 @@ public class FSpinner extends JSpinner {
this.setModel(new SpinnerNumberModel(builder.initialValue, builder.minValue, builder.maxValue, 1));
this.setEditor(new JSpinner.NumberEditor(this, "##"));
JFormattedTextField txt = ((JSpinner.NumberEditor)this.getEditor()).getTextField();
JFormattedTextField txt = this.getTextField();
((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false);
FSkin.JTextComponentSkin<JFormattedTextField> txtSkin = FSkin.get(txt);
txtSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
txtSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
txtSkin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
txt.setMargin(new Insets(5, 5, 5, 5));
txt.setOpaque(true);

View File

@@ -1,18 +1,16 @@
package forge.gui.toolbox;
import javax.swing.JTabbedPane;
import forge.gui.toolbox.FSkin.SkinnedTabbedPane;
/**
* TODO: Write javadoc for this type.
*
*/
public class FTabbedPane extends JTabbedPane {
public class FTabbedPane extends SkinnedTabbedPane {
private static final long serialVersionUID = 2207172560817790885L;
public FTabbedPane() {
FSkin.JComponentSkin<FTabbedPane> skin = FSkin.get(this);
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
}

View File

@@ -2,22 +2,21 @@ package forge.gui.toolbox;
import java.awt.FontMetrics;
import javax.swing.JTextArea;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
/**
* A custom instance of JTextArea using Forge skin properties.
*
*/
@SuppressWarnings("serial")
public class FTextArea extends JTextArea {
public class FTextArea extends SkinnedTextArea {
private boolean autoSize;
/** */
public FTextArea() {
super();
FSkin.JTextComponentSkin<FTextArea> skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setOpaque(false);
this.setWrapStyleWord(true);
this.setLineWrap(true);

View File

@@ -5,21 +5,21 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.event.DocumentListener;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
@SuppressWarnings("serial")
public class FTextEditor extends JScrollPane {
private final JTextArea tarEditor;
private final SkinnedTextArea tarEditor;
private final FUndoManager undoManager;
public FTextEditor() {
tarEditor = new JTextArea();
FSkin.JTextComponentSkin<JTextArea> skin = FSkin.get(tarEditor);
skin.setFont(FSkin.getFixedFont(16));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tarEditor = new SkinnedTextArea();
tarEditor.setFont(FSkin.getFixedFont(16));
tarEditor.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tarEditor.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
tarEditor.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
undoManager = new FUndoManager(tarEditor);

View File

@@ -8,7 +8,6 @@ import java.awt.RenderingHints;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -16,12 +15,14 @@ import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import forge.gui.toolbox.FSkin.SkinnedTextField;
/**
* A custom instance of JTextArea using Forge skin properties.
*
*/
@SuppressWarnings("serial")
public class FTextField extends JTextField {
public class FTextField extends SkinnedTextField {
/**
* Uses the Builder pattern to facilitate/encourage inline styling.
* Credit to Effective Java 2 (Joshua Bloch).
@@ -52,16 +53,17 @@ public class FTextField extends JTextField {
}
public static final int HEIGHT = 25; //TODO: calculate this somehow instead of hard-coding it
private static final FSkin.SkinColor textColor = FSkin.getColor(FSkin.Colors.CLR_TEXT);
private static final FSkin.SkinColor ghostTextColor = textColor.stepColor(20);
private static final FSkin.SkinColor backColor = FSkin.getColor(FSkin.Colors.CLR_THEME2);
private final FSkin.JTextComponentSkin<FTextField> skin;
private String ghostText;
private boolean showGhostTextWithFocus;
private FTextField(Builder builder) {
skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setForeground(textColor);
this.setBackground(backColor);
this.setCaretColor(textColor);
this.setMargin(new Insets(3, 3, 2, 3));
this.setOpaque(true);
@@ -124,7 +126,7 @@ public class FTextField extends JTextField {
final Insets margin = this.getMargin();
final Graphics2D g2d = (Graphics2D)g.create();
g2d.setFont(this.getFont());
FSkin.setGraphicsColor(g2d, skin.getForeground().stepColor(20));
FSkin.setGraphicsColor(g2d, ghostTextColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawString(this.ghostText, margin.left + 2, margin.top + 15); //account for borders (TODO: why +15?)
g2d.dispose();

View File

@@ -25,7 +25,6 @@ import forge.ImageCache;
import forge.card.CardCharacteristicName;
import forge.game.card.Card;
import forge.gui.toolbox.CardFaceSymbols;
import forge.gui.toolbox.FSkin.ComponentSkin;
/**
* Common image-related routines specific to Forge images.
@@ -36,11 +35,11 @@ import forge.gui.toolbox.FSkin.ComponentSkin;
public final class FImageUtil {
private FImageUtil() {}
public static BufferedImage getImage(Card card, CardCharacteristicName state, ComponentSkin<?> skin) {
public static BufferedImage getImage(Card card, CardCharacteristicName state) {
BufferedImage image = ImageCache.getOriginalImage(card.getImageKey(state), true);
int foilIndex = card.getFoil();
if (image != null && foilIndex > 0) {
image = getImageWithFoilEffect(image, foilIndex, skin);
image = getImageWithFoilEffect(image, foilIndex);
}
return image;
}
@@ -53,11 +52,11 @@ public final class FImageUtil {
* For double-sided cards, returns the front-side image.<br>
* For flip cards, returns the un-flipped image.
*/
public static BufferedImage getImage(Card card, ComponentSkin<?> skin) {
public static BufferedImage getImage(Card card) {
BufferedImage image = ImageCache.getOriginalImage(card.getImageKey(), true);
int foilIndex = card.getFoil();
if (image != null && foilIndex > 0) {
image = getImageWithFoilEffect(image, foilIndex, skin);
image = getImageWithFoilEffect(image, foilIndex);
}
return image;
}
@@ -65,11 +64,11 @@ public final class FImageUtil {
/**
* Applies a foil effect to a card image.
*/
private static BufferedImage getImageWithFoilEffect(BufferedImage plainImage, int foilIndex, ComponentSkin<?> skin) {
private static BufferedImage getImageWithFoilEffect(BufferedImage plainImage, int foilIndex) {
ColorModel cm = plainImage.getColorModel();
BufferedImage foilImage = new BufferedImage(cm, plainImage.copyData(null), cm.isAlphaPremultiplied(), null);
final String fl = String.format("foil%02d", foilIndex);
CardFaceSymbols.drawOther(skin, foilImage.getGraphics(), fl, 0, 0, foilImage.getWidth(), foilImage.getHeight());
CardFaceSymbols.drawOther(foilImage.getGraphics(), fl, 0, 0, foilImage.getWidth(), foilImage.getHeight());
return foilImage;
}
}

View File

@@ -30,7 +30,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.JCheckBox;
import javax.swing.JMenu;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
@@ -52,6 +51,8 @@ import forge.gui.toolbox.ContextMenuBuilder;
import forge.gui.toolbox.FComboBoxWrapper;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedCheckBox;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.gui.toolbox.FTextField;
import forge.gui.toolbox.LayoutHelper;
import forge.gui.toolbox.ToolTipListener;
@@ -89,7 +90,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
private final Class<T> genericType;
private final ArrayList<ListSelectionListener> selectionListeners = new ArrayList<ListSelectionListener>();
private final JCheckBox chkEnableFilters = new JCheckBox();
private final SkinnedCheckBox chkEnableFilters = new SkinnedCheckBox();
private final FTextField txtFilterLogic = new FTextField.Builder()
.tooltip("Use '&','|','!' symbols (AND,OR,NOT) in combination with filter numbers and optional grouping \"()\" to build Boolean expression evaluated when applying filters")
@@ -97,7 +98,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
.build();
private ItemFilter<? extends T> mainSearchFilter;
private final JPanel pnlButtons = new JPanel(new MigLayout("insets 0, gap 0, ax center, hidemode 3"));
private final SkinnedPanel pnlButtons = new SkinnedPanel(new MigLayout("insets 0, gap 0, ax center, hidemode 3"));
private final FLabel btnFilters = new FLabel.ButtonBuilder()
.text("Filters")
@@ -181,7 +182,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
this.mainSearchFilter = createSearchFilter();
this.add(mainSearchFilter.getWidget());
this.pnlButtons.setOpaque(false);
FSkin.get(this.pnlButtons).setMatteBorder(1, 0, 1, 0, FSkin.getColor(Colors.CLR_TEXT));
this.pnlButtons.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(Colors.CLR_TEXT)));
this.add(this.pnlButtons);
this.add(this.btnFilters);
this.add(this.lblCaption);

View File

@@ -11,7 +11,6 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
@@ -21,8 +20,9 @@ import com.google.common.base.Predicate;
import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.Colors;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedCheckBox;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.gui.toolbox.FTextField;
import forge.gui.toolbox.LayoutHelper;
import forge.gui.toolbox.itemmanager.ItemManager;
@@ -35,10 +35,9 @@ import forge.item.InventoryItem;
public abstract class ItemFilter<T extends InventoryItem> {
public final static int PANEL_HEIGHT = 28;
public static void layoutCheckbox(JCheckBox cb) {
JComponentSkin<JCheckBox> skin = FSkin.get(cb);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setFont(FSkin.getFont(12));
public static void layoutCheckbox(SkinnedCheckBox cb) {
cb.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
cb.setFont(FSkin.getFont(12));
cb.setOpaque(false);
cb.setFocusable(false);
}
@@ -46,7 +45,7 @@ public abstract class ItemFilter<T extends InventoryItem> {
protected final ItemManager<? super T> itemManager;
private FilterPanel panel;
private Widget widget;
private final JCheckBox chkEnable = new JCheckBox();
private final SkinnedCheckBox chkEnable = new SkinnedCheckBox();
private RemoveButton btnRemove;
protected ItemFilter(ItemManager<? super T> itemManager0) {
@@ -159,11 +158,11 @@ public abstract class ItemFilter<T extends InventoryItem> {
protected abstract Predicate<T> buildPredicate();
@SuppressWarnings("serial")
private class FilterPanel extends JPanel {
private class FilterPanel extends SkinnedPanel {
private FilterPanel() {
setLayout(null);
setOpaque(false);
FSkin.get(this).setMatteBorder(0, 0, 1, 0, FSkin.getColor(Colors.CLR_TEXT));
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(Colors.CLR_TEXT)));
}
@Override

View File

@@ -70,7 +70,7 @@ public abstract class ToggleButtonsFilter<T extends InventoryItem> extends ItemF
for (int fs = 11; fs > 5; fs--) {
SkinFont skinFont = FSkin.getFont(fs);
if (skinFont.measureTextWidth(g, btn.getText()) <= max) {
FSkin.get(btn).setFont(skinFont);
btn.setFont(skinFont);
break;
}
}

View File

@@ -38,6 +38,7 @@ import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.JViewport;
import javax.swing.ListSelectionModel;
import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
@@ -52,6 +53,7 @@ import org.apache.commons.lang3.ArrayUtils;
import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTable;
import forge.gui.toolbox.itemmanager.ItemManager;
import forge.gui.toolbox.itemmanager.ItemManagerModel;
import forge.gui.toolbox.itemmanager.SItemManagerIO;
@@ -70,7 +72,6 @@ import forge.util.ItemPoolSorter;
@SuppressWarnings("serial")
public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
private final ItemTable table = new ItemTable();
private final FSkin.JTableSkin<ItemTable> skin;
private final ItemTableModel tableModel;
public ItemTableModel getTableModel() {
@@ -88,20 +89,19 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
this.tableModel = new ItemTableModel(model0);
// use different selection highlight colors for focused vs. unfocused tables
this.skin = FSkin.get(this.table);
this.skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
this.skin.setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.table.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
this.table.setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.table.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
if (!e.isTemporary() && !skin.isDisposed()) {
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
if (!e.isTemporary()) {
table.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
}
}
@Override
public void focusGained(FocusEvent e) {
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
table.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
// if nothing selected when we gain focus, select the first row (if exists)
if (-1 == getSelectedIndex() && getCount() > 0) {
table.setRowSelectionInterval(0, 0);
@@ -121,8 +121,8 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
}
});
this.skin.setFont(FSkin.getFont(12));
this.table.setBorder(null);
this.table.setFont(FSkin.getFont(12));
this.table.setBorder((Border)null);
this.table.getTableHeader().setBorder(null);
this.table.setRowHeight(18);
setWantElasticColumns(false);
@@ -292,7 +292,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
this.table.setAutoResizeMode(value ? JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS : JTable.AUTO_RESIZE_OFF);
}
public final class ItemTable extends JTable {
public final class ItemTable extends SkinnedTable {
@Override
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {

View File

@@ -215,10 +215,10 @@ public abstract class ItemView<T extends InventoryItem> {
// show a popup with the current search string, highlighted in red if not found
popupLabel.setText(searchStr + " (hit Enter for next match, Esc to cancel)");
if (found) {
FSkin.get(popupLabel).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
popupLabel.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
else {
FSkin.get(popupLabel).setForeground(new Color(255, 0, 0));
popupLabel.setForeground(new Color(255, 0, 0));
}
if (popupShowing) {
@@ -229,7 +229,7 @@ public abstract class ItemView<T extends InventoryItem> {
PopupFactory factory = PopupFactory.getSharedInstance();
Point tableLoc = ItemView.this.getLocationOnScreen();
popup = factory.getPopup(null, popupLabel, tableLoc.x + 10, tableLoc.y + 10);
FSkin.get(SwingUtilities.getRoot(popupLabel)).setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
FSkin.setTempBackground(SwingUtilities.getRoot(popupLabel), FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
popupTimer = new Timer(5000, new ActionListener() {
@Override

View File

@@ -25,8 +25,6 @@ import forge.card.CardSplitType;
import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostShard;
import forge.gui.toolbox.CardFaceSymbols;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JLabelSkin;
/**
* Displays mana cost as symbols.
@@ -38,8 +36,7 @@ public class ManaCostRenderer extends ItemCellRenderer {
private static final int elemtGap = 0;
private static final int padding0 = 2;
private static final int spaceBetweenSplitCosts = 3;
private final JLabelSkin<ManaCostRenderer> skin = FSkin.get(this);
private ManaCost v1;
private ManaCost v2;
@@ -106,7 +103,7 @@ public class ManaCostRenderer extends ItemCellRenderer {
// Display X Mana before any other type of mana
if (xManaCosts > 0) {
for (int i = 0; i < xManaCosts; i++) {
CardFaceSymbols.drawSymbol(ManaCostShard.X.getImageKey(), skin, g, x, y);
CardFaceSymbols.drawSymbol(ManaCostShard.X.getImageKey(), g, x, y);
x += dx;
}
}
@@ -114,7 +111,7 @@ public class ManaCostRenderer extends ItemCellRenderer {
// Display colorless mana before colored mana
if (hasGeneric) {
final String sGeneric = Integer.toString(genericManaCost);
CardFaceSymbols.drawSymbol(sGeneric, skin, g, x, y);
CardFaceSymbols.drawSymbol(sGeneric, g, x, y);
x += dx;
}
@@ -123,7 +120,7 @@ public class ManaCostRenderer extends ItemCellRenderer {
// X costs already drawn up above
continue;
}
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, x, y);
CardFaceSymbols.drawSymbol(s.getImageKey(), g, x, y);
x += dx;
}
}

View File

@@ -26,7 +26,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
@@ -37,6 +37,7 @@ import forge.game.card.CardUtil;
import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FOverlay;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.gui.toolbox.imaging.FImagePanel;
import forge.gui.toolbox.imaging.FImageUtil;
import forge.gui.toolbox.imaging.FImagePanel.AutoSizeImageMode;
@@ -57,7 +58,7 @@ public enum CardZoomer {
private final JPanel overlay = FOverlay.SINGLETON_INSTANCE.getPanel();
private JPanel pnlMain;
private FImagePanel imagePanel;
private JLabel lblFlipcard = new JLabel();
private SkinnedLabel lblFlipcard = new SkinnedLabel();
// Details about the current card being displayed.
private Card thisCard;
@@ -77,7 +78,7 @@ public enum CardZoomer {
// ctr
private CardZoomer() {
FSkin.get(lblFlipcard).setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
lblFlipcard.setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
setMouseButtonListener();
setMouseWheelListener();
setKeyListeners();
@@ -235,7 +236,7 @@ public enum CardZoomer {
*/
private void setImage() {
imagePanel = new FImagePanel();
imagePanel.setImage(FImageUtil.getImage(thisCard, cardState, FSkin.get(imagePanel)), getInitialRotation(), AutoSizeImageMode.SOURCE);
imagePanel.setImage(FImageUtil.getImage(thisCard, cardState), getInitialRotation(), AutoSizeImageMode.SOURCE);
pnlMain.removeAll();
pnlMain.add(imagePanel, "w 80%!, h 80%!");
pnlMain.validate();

View File

@@ -26,10 +26,9 @@ import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout;
import forge.Command;
@@ -49,7 +48,9 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FOptionPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JLabelSkin;
import forge.gui.toolbox.FSkin.SkinnedButton;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.item.InventoryItem;
import forge.model.CardCollections;
@@ -121,8 +122,8 @@ public class DeckLister extends JPanel implements ILocalRepaint {
// Note: careful with the widths of the rows here;
// scroll panes will have difficulty dynamically resizing if 100% width
// is set.
final JPanel rowTitle = new TitlePanel();
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
final TitlePanel rowTitle = new TitlePanel();
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
rowTitle.add(new FLabel.Builder().text("Deck Name")
@@ -178,17 +179,16 @@ public class DeckLister extends JPanel implements ILocalRepaint {
this.repaint(0, 0, d.width, d.height);
}
private class DeleteButton extends JButton {
private class DeleteButton extends SkinnedButton {
public DeleteButton(final RowPanel r0) {
super();
FSkin.AbstractButtonSkin<DeleteButton> skin = FSkin.get(this);
this.setRolloverEnabled(true);
skin.setPressedIcon(DeckLister.this.icoDeleteOver);
skin.setRolloverIcon(DeckLister.this.icoDeleteOver);
skin.setIcon(DeckLister.this.icoDelete);
this.setPressedIcon(DeckLister.this.icoDeleteOver);
this.setRolloverIcon(DeckLister.this.icoDeleteOver);
this.setIcon(DeckLister.this.icoDelete);
this.setOpaque(false);
this.setContentAreaFilled(false);
this.setBorder(null);
this.setBorder((Border)null);
this.setBorderPainted(false);
this.setToolTipText("Delete this deck");
@@ -196,7 +196,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
@Override
public void onMouseEnter(final MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(DeckLister.this.clrHover);
r0.setBackground(DeckLister.this.clrHover);
r0.setOpaque(true);
}
}
@@ -204,7 +204,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
@Override
public void onMouseExit(final MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(DeckLister.this.clrDefault);
r0.setBackground(DeckLister.this.clrDefault);
r0.setOpaque(false);
}
}
@@ -217,17 +217,16 @@ public class DeckLister extends JPanel implements ILocalRepaint {
}
}
private class EditButton extends JButton {
private class EditButton extends SkinnedButton {
public EditButton(final RowPanel r0) {
super();
FSkin.AbstractButtonSkin<EditButton> skin = FSkin.get(this);
this.setRolloverEnabled(true);
skin.setPressedIcon(DeckLister.this.icoEditOver);
skin.setRolloverIcon(DeckLister.this.icoEditOver);
skin.setIcon(DeckLister.this.icoEdit);
this.setPressedIcon(DeckLister.this.icoEditOver);
this.setRolloverIcon(DeckLister.this.icoEditOver);
this.setIcon(DeckLister.this.icoEdit);
this.setOpaque(false);
this.setContentAreaFilled(false);
this.setBorder(null);
this.setBorder((Border)null);
this.setBorderPainted(false);
this.setToolTipText("Edit this deck");
@@ -235,7 +234,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
@Override
public void onMouseEnter(final MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(DeckLister.this.clrHover);
r0.setBackground(DeckLister.this.clrHover);
r0.setOpaque(true);
}
}
@@ -243,7 +242,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
@Override
public void onMouseExit(final MouseEvent e) {
if (!r0.selected) {
FSkin.get(r0).setBackground(DeckLister.this.clrDefault);
r0.setBackground(DeckLister.this.clrDefault);
r0.setOpaque(false);
}
}
@@ -258,7 +257,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
// Here only to prevent visual artifact problems from translucent skin
// colors.
private class TitlePanel extends JPanel {
private class TitlePanel extends SkinnedPanel {
@Override
public void paintComponent(final Graphics g) {
g.setColor(this.getBackground());
@@ -268,7 +267,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
}
}
private class RowPanel extends JPanel {
private class RowPanel extends SkinnedPanel {
private boolean selected = false;
private boolean hovered = false;
private final Deck deck;
@@ -278,7 +277,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
this.setOpaque(false);
this.setBackground(new Color(0, 0, 0, 0));
this.setLayout(new MigLayout("insets 0, gap 0"));
FSkin.get(this).setMatteBorder(0, 0, 1, 0, DeckLister.this.clrBorders);
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, DeckLister.this.clrBorders));
this.deck = d0;
this.addMouseListener(new FMouseAdapter() {
@@ -286,8 +285,8 @@ public class DeckLister extends JPanel implements ILocalRepaint {
public void onMouseEnter(final MouseEvent e) {
RowPanel.this.hovered = true;
if (!RowPanel.this.selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(DeckLister.this.clrHover);
((RowPanel) e.getSource()).setOpaque(true);
RowPanel.this.setBackground(DeckLister.this.clrHover);
RowPanel.this.setOpaque(true);
}
}
@@ -295,15 +294,15 @@ public class DeckLister extends JPanel implements ILocalRepaint {
public void onMouseExit(final MouseEvent e) {
RowPanel.this.hovered = false;
if (!RowPanel.this.selected) {
FSkin.get(((RowPanel) e.getSource())).setBackground(DeckLister.this.clrDefault);
((RowPanel) e.getSource()).setOpaque(false);
RowPanel.this.setBackground(DeckLister.this.clrDefault);
RowPanel.this.setOpaque(false);
}
}
@Override
public void onLeftMouseDown(final MouseEvent e) {
if (e.getClickCount() == 1) {
DeckLister.this.selectHandler((RowPanel) e.getSource());
DeckLister.this.selectHandler(RowPanel.this);
}
}
@@ -317,9 +316,9 @@ public class DeckLister extends JPanel implements ILocalRepaint {
public void setSelected(final boolean b0) {
this.selected = b0;
this.setOpaque(b0);
if (b0) { FSkin.get(this).setBackground(DeckLister.this.clrActive); }
else if (this.hovered) { FSkin.get(this).setBackground(DeckLister.this.clrHover); }
else { FSkin.get(this).setBackground(DeckLister.this.clrDefault); }
if (b0) { this.setBackground(DeckLister.this.clrActive); }
else if (this.hovered) { this.setBackground(DeckLister.this.clrHover); }
else { this.setBackground(DeckLister.this.clrDefault); }
}
public boolean isSelected() {
@@ -331,7 +330,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
}
}
private class MainLabel extends JLabel {
private class MainLabel extends SkinnedLabel {
public MainLabel(final String txt0) {
super(txt0);
this.setOpaque(true);
@@ -341,18 +340,17 @@ public class DeckLister extends JPanel implements ILocalRepaint {
this.setBackground(Color.GREEN);
}
this.setHorizontalAlignment(SwingConstants.CENTER);
FSkin.get(this).setFont(FSkin.getBoldFont(12));
this.setFont(FSkin.getBoldFont(12));
this.setHorizontalAlignment(SwingConstants.CENTER);
}
}
private class GenericLabel extends JLabel {
private class GenericLabel extends SkinnedLabel {
public GenericLabel(final String txt0) {
super(txt0);
this.setHorizontalAlignment(SwingConstants.LEFT);
JLabelSkin<GenericLabel> skin = FSkin.get(this);
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setFont(FSkin.getBoldFont(12));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setFont(FSkin.getBoldFont(12));
}
}

View File

@@ -7,7 +7,6 @@ import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
@@ -27,6 +26,7 @@ import forge.gui.match.controllers.CPlayers;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinProp;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/**
* TODO: Write javadoc for this type.
@@ -77,18 +77,18 @@ public class PlayerDetailsPanel extends JPanel {
/** Adds various labels to pool area JPanel container. */
private void populateDetails() {
final JPanel row1 = new JPanel(new MigLayout("insets 0, gap 0"));
final JPanel row2 = new JPanel(new MigLayout("insets 0, gap 0"));
final JPanel row3 = new JPanel(new MigLayout("insets 0, gap 0"));
final JPanel row4 = 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 SkinnedPanel row1 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
final SkinnedPanel row2 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
final SkinnedPanel row3 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
final SkinnedPanel row4 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
final SkinnedPanel row5 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
final SkinnedPanel row6 = new SkinnedPanel(new MigLayout("insets 0, gap 0"));
FSkin.get(row1).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row1.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row2.setOpaque(false);
FSkin.get(row3).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row3.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row4.setOpaque(false);
FSkin.get(row5).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row5.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
row6.setOpaque(false);
// Hand, library, graveyard, exile, flashback, poison labels
@@ -151,10 +151,10 @@ public class PlayerDetailsPanel extends JPanel {
// Poison/life
this.getLblPoison().setText("" + player.getPoisonCounters());
if (player.getPoisonCounters() < 8) {
FSkin.get(this.getLblPoison()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.getLblPoison().setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
}
else {
FSkin.get(this.getLblPoison()).setForeground(Color.red);
this.getLblPoison().setForeground(Color.red);
}
}
@@ -169,14 +169,10 @@ public class PlayerDetailsPanel extends JPanel {
label.getKey().setText(Integer.toString(m.getAmountOfColor(label.getRight())));
}
/** @return {@link javax.swing.JLabel} */
public FLabel getLblHand() {
return this.lblHand;
}
/** @return {@link javax.swing.JLabel} */
public FLabel getLblLibrary() {
return this.lblLibrary;
}
@@ -185,28 +181,22 @@ public class PlayerDetailsPanel extends JPanel {
return manaLabels;
}
/** @return {@link javax.swing.JLabel} */
public JLabel getLblGraveyard() {
public FLabel getLblGraveyard() {
return this.lblGraveyard;
}
/** @return {@link javax.swing.JLabel} */
public JLabel getLblExile() {
public FLabel getLblExile() {
return this.lblExile;
}
/** @return {@link javax.swing.JLabel} */
public JLabel getLblFlashback() {
public FLabel getLblFlashback() {
return this.lblFlashback;
}
/** @return {@link javax.swing.JLabel} */
public JLabel getLblPoison() {
public FLabel getLblPoison() {
return this.lblPoison;
}
/**
* TODO: Write javadoc for this method.
* @param handAction

View File

@@ -6,8 +6,10 @@ import java.awt.event.KeyEvent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import forge.gui.menus.MenuUtil;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedMenuItem;
import forge.gui.workshop.controllers.CCardScript;
/**
@@ -36,8 +38,8 @@ public final class WorkshopFileMenu {
}
private static JMenuItem getMenuItem_SaveCard() {
JMenuItem menuItem = new JMenuItem("Save and Apply Card Changes");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVE) : null);
SkinnedMenuItem menuItem = new SkinnedMenuItem("Save and Apply Card Changes");
menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVE) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_S));
menuItem.addActionListener(getSaveCardAction());
menuItem_SaveCard = menuItem;

View File

@@ -31,7 +31,7 @@ public class ViewItem extends FPanel {
this.tarDesc = new FTextArea();
this.btnPurchase = new FLabel.Builder().text("Buy").opaque(true).fontSize(20).hoverable(true).build();
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Layout
this.setLayout(new MigLayout("insets 0, gap 0"));

View File

@@ -25,6 +25,7 @@ import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@@ -35,7 +36,7 @@ import forge.gui.bazaar.VBazaarUI;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin;
import forge.gui.toolbox.FSkin.SkinnedTextPane;
import forge.quest.QuestController;
import forge.quest.bazaar.IQuestBazaarItem;
import forge.quest.bazaar.QuestStallDefinition;
@@ -52,7 +53,7 @@ import forge.quest.data.QuestAssets;
@SuppressWarnings("serial")
public class ViewStall extends JPanel {
private final FLabel lblStallName, lblEmpty, lblStats;
private final JTextPane tpnFluff;
private final SkinnedTextPane tpnFluff;
private final JPanel pnlInventory;
private final FScrollPane scrInventory;
private final VBazaarUI parentView;
@@ -70,7 +71,7 @@ public class ViewStall extends JPanel {
.fontAlign(SwingConstants.CENTER).build();
this.lblStats = new FLabel.Builder().fontAlign(SwingConstants.CENTER).fontSize(12).build();
this.tpnFluff = new JTextPane();
this.tpnFluff = new SkinnedTextPane();
this.pnlInventory = new JPanel();
this.scrInventory = new FScrollPane(this.pnlInventory);
this.parentView = v0;
@@ -79,13 +80,12 @@ public class ViewStall extends JPanel {
// Component styling
this.setOpaque(false);
JTextComponentSkin<JTextPane> tpnFluffSkin = FSkin.get(this.tpnFluff);
this.tpnFluff.setOpaque(false);
tpnFluffSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnFluffSkin.setFont(FSkin.getItalicFont(15));
this.tpnFluff.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.tpnFluff.setFont(FSkin.getItalicFont(15));
this.tpnFluff.setFocusable(false);
this.tpnFluff.setEditable(false);
this.tpnFluff.setBorder(null);
this.tpnFluff.setBorder((Border)null);
final StyledDocument doc = this.tpnFluff.getStyledDocument();
final SimpleAttributeSet center = new SimpleAttributeSet();
@@ -94,7 +94,7 @@ public class ViewStall extends JPanel {
this.pnlInventory.setOpaque(false);
this.scrInventory.setBorder(null);
this.scrInventory.setBorder((Border)null);
this.scrInventory.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
this.scrInventory.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

View File

@@ -25,7 +25,6 @@ import java.awt.event.WindowFocusListener;
import java.awt.geom.RoundRectangle2D;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
@@ -35,10 +34,11 @@ import forge.Singletons;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedDialog;
import forge.util.OperatingSystem;
@SuppressWarnings("serial")
public class FDialog extends JDialog implements ITitleBarOwner, KeyEventDispatcher {
public class FDialog extends SkinnedDialog implements ITitleBarOwner, KeyEventDispatcher {
private static final SkinColor borderColor = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
private static final int cornerDiameter = 20;
private static final boolean isSetShapeSupported;
@@ -53,7 +53,6 @@ public class FDialog extends JDialog implements ITitleBarOwner, KeyEventDispatch
antiAliasBorder = OperatingSystem.isWindows();
}
private FSkin.WindowSkin<FDialog> skin = FSkin.get(this);
private Point locBeforeMove;
private Point mouseDownLoc;
private final FTitleBar titleBar;
@@ -67,7 +66,7 @@ public class FDialog extends JDialog implements ITitleBarOwner, KeyEventDispatch
public FDialog(boolean modal0) {
super(JOptionPane.getRootFrame(), modal0);
this.setUndecorated(true);
skin.setIconImage(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FAVICON)); //use Forge icon by default
this.setIconImage(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FAVICON)); //use Forge icon by default
this.innerPanel = new FPanel(new MigLayout("insets dialog, gap 0, center, fill"));
this.innerPanel.setBackgroundTexture(FSkin.getIcon(FSkin.Backgrounds.BG_TEXTURE));
@@ -140,7 +139,6 @@ public class FDialog extends JDialog implements ITitleBarOwner, KeyEventDispatch
@Override
public void dispose() {
setVisible(false); //ensure overlay hidden when disposing
FSkin.dispose(this); //ensure skins disposed for dialog and all its components
super.dispose();
}

Some files were not shown because too many files have changed in this diff Show More