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); clearChildren(JLayeredPane.DEFAULT_LAYER);
SOverlayUtils.hideOverlay(); 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 ImageCache.clear(); //reduce memory usage by clearing image cache when switching screens
this.currentScreen = screen; this.currentScreen = screen;

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,6 +3,7 @@ package forge.gui.bazaar;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Command; import forge.Command;
@@ -107,9 +108,9 @@ public enum VBazaarUI implements IVTopLevelUI {
@Override @Override
public void populate() { public void populate() {
FPanel pnl = FView.SINGLETON_INSTANCE.getPnlInsets(); FPanel pnl = FView.SINGLETON_INSTANCE.getPnlInsets();
pnl.setBorder(null); pnl.setBorder((Border)null);
pnl.setLayout(new MigLayout("insets 0, gap 0")); 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(pnlAllStalls, "w 25%!, h 100%!");
pnl.add(pnlSingleStall, "w 75%!, 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); txtInput.setEditable(true);
FSkin.SkinColor foreColor = FSkin.getColor(FSkin.Colors.CLR_TEXT); 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)); 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.scrollOutput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Expect the recognized lines to appear", foreColor));
this.scrollInput.setViewportBorder(BorderFactory.createLoweredBevelBorder()); this.scrollInput.setViewportBorder(BorderFactory.createLoweredBevelBorder());
this.scrollOutput.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 java.awt.event.KeyEvent;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import forge.gui.deckeditor.CDeckEditorUI; import forge.gui.deckeditor.CDeckEditorUI;
import forge.gui.deckeditor.views.VCurrentDeck; import forge.gui.deckeditor.views.VCurrentDeck;
import forge.gui.menus.MenuUtil; import forge.gui.menus.MenuUtil;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedMenuItem;
/** /**
* Returns a JMenu containing options associated with current game. * Returns a JMenu containing options associated with current game.
@@ -40,7 +40,7 @@ public final class DeckFileMenu {
return menu; return menu;
} }
private static JMenuItem menuItem_Save, menuItem_SaveAs; private static SkinnedMenuItem menuItem_Save, menuItem_SaveAs;
public static void updateSaveEnabled() { public static void updateSaveEnabled() {
if (menuItem_Save != null) { if (menuItem_Save != null) {
@@ -51,9 +51,9 @@ public final class DeckFileMenu {
} }
} }
private static JMenuItem getMenuItem_New() { private static SkinnedMenuItem getMenuItem_New() {
JMenuItem menuItem = new JMenuItem("New Deck"); SkinnedMenuItem menuItem = new SkinnedMenuItem("New Deck");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_NEW) : null); menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_NEW) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_N)); menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_N));
menuItem.addActionListener(getNewAction()); menuItem.addActionListener(getNewAction());
return menuItem; return menuItem;
@@ -68,9 +68,9 @@ public final class DeckFileMenu {
}; };
} }
private static JMenuItem getMenuItem_Open() { private static SkinnedMenuItem getMenuItem_Open() {
JMenuItem menuItem = new JMenuItem("Open Deck"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Open Deck");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_OPEN) : null); menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_OPEN) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_O)); menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_O));
menuItem.addActionListener(getOpenAction()); menuItem.addActionListener(getOpenAction());
return menuItem; return menuItem;
@@ -85,8 +85,8 @@ public final class DeckFileMenu {
}; };
} }
private static JMenuItem getMenuItem_Import() { private static SkinnedMenuItem getMenuItem_Import() {
JMenuItem menuItem = new JMenuItem("Import Deck"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Import Deck");
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_I)); menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_I));
menuItem.addActionListener(getImportAction()); menuItem.addActionListener(getImportAction());
return menuItem; return menuItem;
@@ -101,9 +101,9 @@ public final class DeckFileMenu {
}; };
} }
private static JMenuItem getMenuItem_Save() { private static SkinnedMenuItem getMenuItem_Save() {
JMenuItem menuItem = new JMenuItem("Save Deck"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Deck");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVE) : null); menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVE) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_S)); menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_S));
menuItem.addActionListener(getSaveAction()); menuItem.addActionListener(getSaveAction());
menuItem_Save = menuItem; menuItem_Save = menuItem;
@@ -119,9 +119,9 @@ public final class DeckFileMenu {
}; };
} }
private static JMenuItem getMenuItem_SaveAs() { private static SkinnedMenuItem getMenuItem_SaveAs() {
JMenuItem menuItem = new JMenuItem("Save Deck As"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Deck As");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVEAS) : null); menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_SAVEAS) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_E)); menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_E));
menuItem.addActionListener(getSaveAsAction()); menuItem.addActionListener(getSaveAsAction());
menuItem_SaveAs = menuItem; menuItem_SaveAs = menuItem;
@@ -137,9 +137,9 @@ public final class DeckFileMenu {
}; };
} }
private static JMenuItem getMenuItem_Print() { private static SkinnedMenuItem getMenuItem_Print() {
JMenuItem menuItem = new JMenuItem("Print to HTML file"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Print to HTML file");
FSkin.get(menuItem).setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_PRINT) : null); menuItem.setIcon(showIcons ? MenuUtil.getMenuIcon(FSkin.InterfaceIcons.ICO_PRINT) : null);
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_P)); menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_P));
menuItem.addActionListener(getPrintAction()); menuItem.addActionListener(getPrintAction());
return menuItem; return menuItem;

View File

@@ -1,7 +1,6 @@
package forge.gui.deckeditor.views; package forge.gui.deckeditor.views;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
@@ -27,82 +26,82 @@ public enum VEditorPreferences implements IVDoc<CEditorPreferences> {
private DragCell parentCell; private DragCell parentCell;
private final DragTab tab = new DragTab("Preferences"); 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") .text("General").tooltip("Configure high-level UI components")
.fontSize(12).build(); .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") .text("Card Catalog Columns").tooltip("Toggle columns in card catalog panel")
.fontSize(12).build(); .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") .text("Current Deck Columns").tooltip("Toggle columns in current deck panel")
.fontSize(12).build(); .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") .text("Card Catalog Options").tooltip("Toggle card catalog display options")
.fontSize(12).build(); .fontSize(12).build();
private JCheckBox chbCatalogColor = new FCheckBox("Color"); private FCheckBox chbCatalogColor = new FCheckBox("Color");
private JCheckBox chbCatalogRarity = new FCheckBox("Rarity"); private FCheckBox chbCatalogRarity = new FCheckBox("Rarity");
private JCheckBox chbCatalogCMC = new FCheckBox("CMC"); private FCheckBox chbCatalogCMC = new FCheckBox("CMC");
private JCheckBox chbCatalogSet = new FCheckBox("Set"); private FCheckBox chbCatalogSet = new FCheckBox("Set");
private JCheckBox chbCatalogAI = new FCheckBox("AI"); private FCheckBox chbCatalogAI = new FCheckBox("AI");
private JCheckBox chbCatalogRanking = new FCheckBox("Ranking"); private FCheckBox chbCatalogRanking = new FCheckBox("Ranking");
private JCheckBox chbCatalogPower = new FCheckBox("Power"); private FCheckBox chbCatalogPower = new FCheckBox("Power");
private JCheckBox chbCatalogToughness = new FCheckBox("Toughness"); private FCheckBox chbCatalogToughness = new FCheckBox("Toughness");
private JCheckBox chbCatalogFavorite = new FCheckBox("Favorite"); private FCheckBox chbCatalogFavorite = new FCheckBox("Favorite");
private JCheckBox chbCatalogOwned = new FCheckBox("Owned (Spell shop)"); private FCheckBox chbCatalogOwned = new FCheckBox("Owned (Spell shop)");
private JCheckBox chbDeckColor = new FCheckBox("Color"); private FCheckBox chbDeckColor = new FCheckBox("Color");
private JCheckBox chbDeckRarity = new FCheckBox("Rarity"); private FCheckBox chbDeckRarity = new FCheckBox("Rarity");
private JCheckBox chbDeckCMC = new FCheckBox("CMC"); private FCheckBox chbDeckCMC = new FCheckBox("CMC");
private JCheckBox chbDeckSet = new FCheckBox("Set"); private FCheckBox chbDeckSet = new FCheckBox("Set");
private JCheckBox chbDeckAI = new FCheckBox("AI"); private FCheckBox chbDeckAI = new FCheckBox("AI");
private JCheckBox chbDeckRanking = new FCheckBox("Ranking"); private FCheckBox chbDeckRanking = new FCheckBox("Ranking");
private JCheckBox chbDeckPower = new FCheckBox("Power"); private FCheckBox chbDeckPower = new FCheckBox("Power");
private JCheckBox chbDeckToughness = new FCheckBox("Toughness"); 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 JPanel pnl = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax left"));
private JScrollPane scroller = new JScrollPane(pnl); private JScrollPane scroller = new JScrollPane(pnl);
//========== Constructor //========== Constructor
private VEditorPreferences() { private VEditorPreferences() {
FSkin.get(lblStats).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)));
FSkin.get(lblCatalog).setMatteBorder(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)));
FSkin.get(lblDeck).setMatteBorder(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)));
FSkin.get(lblDisplay).setMatteBorder(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.SkinFont font = FSkin.getFont(12);
FSkin.get(chbCatalogColor).setFont(font); chbCatalogColor.setFont(font);
FSkin.get(chbCatalogRarity).setFont(font); chbCatalogRarity.setFont(font);
FSkin.get(chbCatalogCMC).setFont(font); chbCatalogCMC.setFont(font);
FSkin.get(chbCatalogSet).setFont(font); chbCatalogSet.setFont(font);
FSkin.get(chbCatalogAI).setFont(font); chbCatalogAI.setFont(font);
FSkin.get(chbCatalogRanking).setFont(font); chbCatalogRanking.setFont(font);
FSkin.get(chbCatalogPower).setFont(font); chbCatalogPower.setFont(font);
FSkin.get(chbCatalogToughness).setFont(font); chbCatalogToughness.setFont(font);
FSkin.get(chbCatalogFavorite).setFont(font); chbCatalogFavorite.setFont(font);
FSkin.get(chbCatalogOwned).setFont(font); chbCatalogOwned.setFont(font);
FSkin.get(chbDeckColor).setFont(font); chbDeckColor.setFont(font);
FSkin.get(chbDeckRarity).setFont(font); chbDeckRarity.setFont(font);
FSkin.get(chbDeckCMC).setFont(font); chbDeckCMC.setFont(font);
FSkin.get(chbDeckSet).setFont(font); chbDeckSet.setFont(font);
FSkin.get(chbDeckAI).setFont(font); chbDeckAI.setFont(font);
FSkin.get(chbDeckRanking).setFont(font); chbDeckRanking.setFont(font);
FSkin.get(chbDeckPower).setFont(font); chbDeckPower.setFont(font);
FSkin.get(chbDeckToughness).setFont(font); chbDeckToughness.setFont(font);
FSkin.get(chbElasticColumns).setFont(font); chbElasticColumns.setFont(font);
chbElasticColumns.setSelected(false); chbElasticColumns.setSelected(false);
FSkin.get(chbCardDisplayUnique).setFont(font); chbCardDisplayUnique.setFont(font);
chbCardDisplayUnique.setSelected(false); chbCardDisplayUnique.setSelected(false);
pnl.add(lblStats, "h 25px!, gap 5px 5px 5px 5px, ax left, span 2 1"); 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.getViewport().setBorder(null);
scroller.getVerticalScrollBar().setUnitIncrement(16); scroller.getVerticalScrollBar().setUnitIncrement(16);
FSkin.JLabelSkin<FLabel> labelSkin = FSkin.get(lblSampleHand); lblSampleHand.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)); lblSampleHand.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
labelSkin = FSkin.get(lblRemainingDraws); lblRemainingDraws.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)); lblRemainingDraws.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Core layout // Core layout
pnlContent.add(lblReshuffle, "w 96%!, h 29px!, gap 2% 0 5px 5px"); 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) { 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) .fontAlign(SwingConstants.CENTER).fontSize(13)
.build(); .build();
@@ -189,7 +187,7 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
if (zebra) { if (zebra) {
lbl.setOpaque(true); lbl.setOpaque(true);
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA)); lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
} }
return lbl; return lbl;

View File

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

View File

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

View File

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

View File

@@ -14,6 +14,7 @@ import javax.swing.JPanel;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinCursor; import forge.gui.toolbox.FSkin.SkinCursor;
import forge.gui.toolbox.FSkin.SkinnedLayeredPane;
import forge.view.FView; import forge.view.FView;
/** /**
@@ -42,7 +43,7 @@ public final class SRearrangingUtil {
private static int tempH; private static int tempH;
private static JPanel pnlPreview = FView.SINGLETON_INSTANCE.getPnlPreview(); 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 cellTarget = null;
private static DragCell cellSrc = null; private static DragCell cellSrc = null;
private static DragCell cellNew = 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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import forge.Singletons; import forge.Singletons;
import forge.gui.framework.ILocalRepaint; import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor; import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
/** /**
@@ -20,8 +19,7 @@ import forge.properties.ForgePreferences.FPref;
* Handles repainting and listening for hover and click events. * Handles repainting and listening for hover and click events.
*/ */
@SuppressWarnings("serial") @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 final boolean isCompactMenu = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_COMPACT_MAIN_MENU);
private static EMenuGroup activeMenuGroup = null; private static EMenuGroup activeMenuGroup = null;
@@ -41,11 +39,10 @@ public class LblGroup extends JLabel implements ILocalRepaint {
* @param e0 {@link forge.gui.home.EMenuGroup} * @param e0 {@link forge.gui.home.EMenuGroup}
*/ */
public LblGroup(final EMenuGroup e0) { public LblGroup(final EMenuGroup e0) {
super(" " + e0.getTitle()); super(" " + e0.getTitle());
FSkin.get(this).setFont(FSkin.getBoldFont(14)); this.setFont(FSkin.getBoldFont(14));
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@Override @Override

View File

@@ -3,17 +3,17 @@ package forge.gui.home;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import javax.swing.JLabel;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor; import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/** /**
* Standardized header label for top of menu display panel. * Standardized header label for top of menu display panel.
*/ */
@SuppressWarnings("serial") @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 clr = FSkin.getColor(FSkin.Colors.CLR_THEME).stepColor(0);
private final SkinColor a100 = clr.alphaColor(100); private final SkinColor a100 = clr.alphaColor(100);
private final SkinColor d40 = clr.stepColor(-40); private final SkinColor d40 = clr.stepColor(-40);
@@ -25,8 +25,8 @@ public class LblHeader extends JLabel {
*/ */
public LblHeader(final String txt0) { public LblHeader(final String txt0) {
super(txt0); super(txt0);
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
FSkin.get(this).setFont(FSkin.getFont(18)); this.setFont(FSkin.getFont(18));
this.setBorder(new EmptyBorder(5, 30, 0, 0)); 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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import forge.gui.framework.ICDoc; import forge.gui.framework.ICDoc;
import forge.gui.framework.ILocalRepaint; import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor; import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/** /**
* Custom JLabel for an item in the menu. Handles listening * Custom JLabel for an item in the menu. Handles listening
* and repainting for hover and select events. * and repainting for hover and select events.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class LblMenuItem extends JLabel implements ILocalRepaint { public class LblMenuItem extends SkinnedLabel implements ILocalRepaint {
private boolean selected = false; private boolean selected = false;
private boolean hovered = false; private boolean hovered = false;
@@ -39,8 +38,8 @@ public class LblMenuItem extends JLabel implements ILocalRepaint {
public LblMenuItem(final IVSubmenu<? extends ICDoc> doc0) { public LblMenuItem(final IVSubmenu<? extends ICDoc> doc0) {
super(" " + doc0.getMenuTitle()); super(" " + doc0.getMenuTitle());
FSkin.get(this).setFont(FSkin.getFont(14)); this.setFont(FSkin.getFont(14));
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@Override @Override

View File

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

View File

@@ -5,33 +5,33 @@ import java.awt.event.ActionListener;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import javax.swing.JButton;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedButton;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class StartButton extends JButton { public class StartButton extends SkinnedButton {
public StartButton() { public StartButton() {
final FSkin.AbstractButtonSkin<StartButton> skin = FSkin.get(this);
setOpaque(false); setOpaque(false);
setContentAreaFilled(false); setContentAreaFilled(false);
setBorder(null); setBorder((Border)null);
setBorderPainted(false); setBorderPainted(false);
setRolloverEnabled(true); setRolloverEnabled(true);
skin.setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER)); setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP)); setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
skin.setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN)); setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN));
addFocusListener(new FocusListener() { addFocusListener(new FocusListener() {
@Override @Override
public void focusLost(FocusEvent arg0) { 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 @Override
public void focusGained(FocusEvent arg0) { 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.FLabel;
import forge.gui.toolbox.FScrollPanel; import forge.gui.toolbox.FScrollPanel;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinColor; import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.properties.NewConstants; import forge.properties.NewConstants;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
import forge.view.FView; import forge.view.FView;
@@ -185,7 +185,7 @@ public enum VHomeUI implements IVTopLevelUI {
} }
pnlMenu.add(pnlSubmenus, "w 100%!, h 100% - " + pnlMainMenuHeight + "px!"); 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() { public final FLabel getLblStartServer() {
@@ -241,12 +241,9 @@ public enum VHomeUI implements IVTopLevelUI {
} }
/** */ /** */
public class PnlDisplay extends JPanel implements ILocalRepaint { public class PnlDisplay extends SkinnedPanel implements ILocalRepaint {
private final JComponentSkin<PnlDisplay> skin;
/** Constructor. */ /** Constructor. */
public PnlDisplay() { public PnlDisplay() {
this.skin = FSkin.get(this);
this.setOpaque(false); this.setOpaque(false);
} }
@@ -261,7 +258,7 @@ public enum VHomeUI implements IVTopLevelUI {
super.paintComponent(g); super.paintComponent(g);
final Graphics2D g2d = (Graphics2D) g.create(); final Graphics2D g2d = (Graphics2D) g.create();
FSkin.setGraphicsColor(g2d, skin.getBackground()); g2d.setColor(this.getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.dispose(); g2d.dispose();

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,6 @@ import java.awt.Font;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
@@ -21,6 +20,7 @@ import forge.gui.home.VHomeUI;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/** /**
* Assembles Swing components of "build gauntlet" submenu singleton. * 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 StartButton btnStart = new StartButton();
private final SkinnedPanel pnlLoad = new SkinnedPanel(new MigLayout("insets 0, gap 0, wrap"));
private final JPanel pnlLoad = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
private final ContestGauntletLister gauntletList = new ContestGauntletLister(); private final ContestGauntletLister gauntletList = new ContestGauntletLister();
private final FDeckChooser lstDecks = new FDeckChooser("Deck", false); 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(); .text("A gauntlet that has been started will keep the same deck until it is finished.").build();
private VSubmenuGauntletContests() { 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")); 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(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(), // pnlLoad.add(new FLabel.Builder().text("If a gauntlet has been started, its deck is frozen.").build(),
// "gap 0 0 0 5px, ax center"); // "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 final StartButton btnStart = new StartButton();
private VSubmenuGauntletLoad() { private VSubmenuGauntletLoad() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
scrLoad.setBorder(null); scrLoad.setBorder(null);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,12 +6,10 @@ import java.awt.event.ActionListener;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.plaf.basic.BasicComboBoxRenderer; import javax.swing.plaf.basic.BasicComboBoxRenderer;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
@@ -61,10 +59,10 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
.text("Load Quest Data").fontAlign(SwingConstants.CENTER) .text("Load Quest Data").fontAlign(SwingConstants.CENTER)
.opaque(true).fontSize(16).build(); .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(); .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.") + "res/quest/data, and restart Forge.")
.fontAlign(SwingConstants.CENTER).fontSize(12).build(); .fontAlign(SwingConstants.CENTER).fontSize(12).build();
@@ -73,16 +71,16 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
private final JPanel pnlOptions = new JPanel(); private final JPanel pnlOptions = new JPanel();
/* Fist column */ /* Fist column */
private final JRadioButton radEasy = new FRadioButton("Easy"); private final FRadioButton radEasy = new FRadioButton("Easy");
private final JRadioButton radMedium = new FRadioButton("Medium"); private final FRadioButton radMedium = new FRadioButton("Medium");
private final JRadioButton radHard = new FRadioButton("Hard"); private final FRadioButton radHard = new FRadioButton("Hard");
private final JRadioButton radExpert = new FRadioButton("Expert"); private final FRadioButton radExpert = new FRadioButton("Expert");
private final JCheckBox boxFantasy = new FCheckBox("Fantasy Mode"); 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 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 FComboBoxWrapper<String> cbxPreferredColor = new FComboBoxWrapper<String>();
private final String stringBalancedDistribution = new String("balanced distribution"); private final String stringBalancedDistribution = new String("balanced distribution");
private final String stringRandomizedDistribution = new String("randomized distribution"); private final String stringRandomizedDistribution = new String("randomized distribution");
@@ -90,33 +88,33 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
/* Second column */ /* 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 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 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 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 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 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 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 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 FComboBoxWrapper<GameFormat> cbxPrizeFormat = new FComboBoxWrapper<GameFormat>();
private final JLabel lblPrizeUnrestricted = new FLabel.Builder().text("All cards will be available to win.").build(); private final FLabel 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 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) private final FLabel btnEmbark = new FLabel.Builder().opaque(true)
.fontSize(16).hoverable(true).text("Embark!").build(); .fontSize(16).hoverable(true).text("Embark!").build();
@@ -206,10 +204,10 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private VSubmenuQuestData() { private VSubmenuQuestData() {
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
FSkin.get(lblTitleNew).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 JXButtonPanel difficultyPanel = new JXButtonPanel();
final String difficulty_constraints = "h 27px!, gapbottom 5"; final String difficulty_constraints = "h 27px!, gapbottom 5";

View File

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

View File

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

View File

@@ -61,7 +61,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
// CTR // CTR
private VSubmenuConstructed() { 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 //This listener will look for any of the radio buttons being selected
//and call the method that shows/hides tabs appropriately. //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); lstAI.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
btnStart.setEnabled(false); 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(); JXButtonPanel grpPanel = new JXButtonPanel();
grpPanel.add(radSingle, "w 200px!, h 30px!"); 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.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border;
import javax.swing.text.SimpleAttributeSet; import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants; import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
@@ -29,7 +29,7 @@ import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FPanel; import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin; import forge.gui.toolbox.FSkin.SkinnedTextPane;
import forge.gui.toolbox.special.DeckLister; import forge.gui.toolbox.special.DeckLister;
/** /**
@@ -79,7 +79,7 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
private VSubmenuSealed() { private VSubmenuSealed() {
btnStart.setEnabled(false); btnStart.setEnabled(false);
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -164,15 +164,14 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
+ "Credit: Wikipedia"; + "Credit: Wikipedia";
// Init directions text pane // Init directions text pane
final JTextPane tpnDirections = new JTextPane(); final SkinnedTextPane tpnDirections = new SkinnedTextPane();
JTextComponentSkin<JTextPane> tpnDirectionsSkin = FSkin.get(tpnDirections);
tpnDirections.setOpaque(false); tpnDirections.setOpaque(false);
tpnDirectionsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); tpnDirections.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tpnDirectionsSkin.setFont(FSkin.getFont(15)); tpnDirections.setFont(FSkin.getFont(15));
tpnDirections.setAlignmentX(SwingConstants.CENTER); tpnDirections.setAlignmentX(SwingConstants.CENTER);
tpnDirections.setFocusable(false); tpnDirections.setFocusable(false);
tpnDirections.setEditable(false); tpnDirections.setEditable(false);
tpnDirections.setBorder(null); tpnDirections.setBorder((Border)null);
tpnDirections.setText(instructions); tpnDirections.setText(instructions);
final StyledDocument doc = tpnDirections.getStyledDocument(); final StyledDocument doc = tpnDirections.getStyledDocument();

View File

@@ -10,6 +10,7 @@ import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Command; import forge.Command;
@@ -90,7 +91,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
pnlContent.add(btnLicensing, constraintsBTN); pnlContent.add(btnLicensing, constraintsBTN);
pnlContent.add(_makeLabel("Forge legal."), constraintsLBL); pnlContent.add(_makeLabel("Forge legal."), constraintsLBL);
scrContent.setBorder(null); scrContent.setBorder((Border)null);
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -178,7 +179,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
FTextArea directions = new FTextArea(FileUtil.readFileToString(NewConstants.TEXT_HOWTO_FILE)); FTextArea directions = new FTextArea(FileUtil.readFileToString(NewConstants.TEXT_HOWTO_FILE));
final FScrollPane scr = new FScrollPane(directions, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, final FScrollPane scr = new FScrollPane(directions, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scr.setBorder(null); scr.setBorder((Border)null);
_showDialog(scr, new Runnable() { _showDialog(scr, new Runnable() {
@Override public void run() { scr.getViewport().setViewPosition(new Point(0, 0)); } @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.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
@@ -39,6 +39,8 @@ import forge.gui.toolbox.FComboBoxPanel;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.gui.toolbox.FSkin.SkinnedTextField;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
/** /**
@@ -226,7 +228,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
shortcutFields.put(s.getPrefKey(), field); shortcutFields.put(s.getPrefKey(), field);
} }
scrContent.setBorder(null); scrContent.setBorder((Border)null);
} }
public void reloadShortcuts() { public void reloadShortcuts() {
@@ -278,41 +280,39 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private class OptionsCheckBox extends FCheckBox { private class OptionsCheckBox extends FCheckBox {
public OptionsCheckBox(final String txt0) { public OptionsCheckBox(final String txt0) {
super(txt0); super(txt0);
FSkin.get(this).setFont(FSkin.getBoldFont(12)); this.setFont(FSkin.getBoldFont(12));
} }
} }
/** Consolidates section title label styling in one place. */ /** Consolidates section title label styling in one place. */
@SuppressWarnings("serial") @SuppressWarnings("serial")
private class SectionLabel extends JLabel { private class SectionLabel extends SkinnedLabel {
public SectionLabel(final String txt0) { public SectionLabel(final String txt0) {
super(txt0); super(txt0);
FSkin.JLabelSkin<SectionLabel> skin = FSkin.get(this); this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
skin.setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
setHorizontalAlignment(SwingConstants.CENTER); setHorizontalAlignment(SwingConstants.CENTER);
skin.setFont(FSkin.getBoldFont(16)); this.setFont(FSkin.getBoldFont(16));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
} }
/** Consolidates notation label styling in one place. */ /** Consolidates notation label styling in one place. */
@SuppressWarnings("serial") @SuppressWarnings("serial")
private class NoteLabel extends JLabel { private class NoteLabel extends SkinnedLabel {
public NoteLabel(final String txt0) { public NoteLabel(final String txt0) {
super(txt0); super(txt0);
FSkin.JLabelSkin<NoteLabel> skin = FSkin.get(this); this.setFont(FSkin.getItalicFont(12));
skin.setFont(FSkin.getItalicFont(12)); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.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 * shortcut. Also, an action listener that handles translation of keycodes
* into characters and (dis)assembly of keycode stack. * into characters and (dis)assembly of keycode stack.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class KeyboardShortcutField extends JTextField { public class KeyboardShortcutField extends SkinnedTextField {
private String codeString; private String codeString;
/** /**
@@ -325,7 +325,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
public KeyboardShortcutField(final Shortcut shortcut0) { public KeyboardShortcutField(final Shortcut shortcut0) {
super(); super();
this.setEditable(false); this.setEditable(false);
FSkin.get(this).setFont(FSkin.getFont(14)); this.setFont(FSkin.getFont(14));
final FPref prefKey = shortcut0.getPrefKey(); final FPref prefKey = shortcut0.getPrefKey();
reload(prefKey); reload(prefKey);
@@ -339,7 +339,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
this.addFocusListener(new FocusAdapter() { this.addFocusListener(new FocusAdapter() {
@Override @Override
public void focusGained(final FocusEvent evt) { 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 @Override
@@ -347,7 +347,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
Singletons.getModel().getPreferences().setPref(prefKey, getCodeString()); Singletons.getModel().getPreferences().setPref(prefKey, getCodeString());
Singletons.getModel().getPreferences().save(); Singletons.getModel().getPreferences().save();
shortcut0.attach(); 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.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell; import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab; import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID; import forge.gui.framework.EDocID;
@@ -33,6 +31,7 @@ import forge.gui.home.EMenuGroup;
import forge.gui.home.IVSubmenu; import forge.gui.home.IVSubmenu;
import forge.gui.home.VHomeUI; import forge.gui.home.VHomeUI;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
/** /**
* Displays contents of CHANGES.txt file. * 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 DragTab tab = new DragTab("Release Notes");
private final JPanel pnlMain = new JPanel(); private final JPanel pnlMain = new JPanel();
private JTextArea tar; private SkinnedTextArea tar;
private final JScrollPane scroller; private final JScrollPane scroller;
/** /**
@@ -60,17 +59,16 @@ public enum VSubmenuReleaseNotes implements IVSubmenu<CSubmenuReleaseNotes> {
pnlMain.setOpaque(false); pnlMain.setOpaque(false);
pnlMain.setLayout(new MigLayout("insets 0, gap 0, wrap 2")); pnlMain.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
tar = new JTextArea(); tar = new SkinnedTextArea();
tar.setOpaque(true); tar.setOpaque(true);
tar.setLineWrap(true); tar.setLineWrap(true);
tar.setWrapStyleWord(true); tar.setWrapStyleWord(true);
tar.setEditable(false); tar.setEditable(false);
tar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); tar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
tar.setFont(FSkin.getFixedFont(16)); tar.setFont(FSkin.getFixedFont(16));
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
tarSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); tar.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
scroller = new JScrollPane(tar); scroller = new JScrollPane(tar);
pnlMain.add(scroller, "w 100%!, h 100%!"); pnlMain.add(scroller, "w 100%!, h 100%!");

View File

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

View File

@@ -72,7 +72,7 @@ public enum VSubmenuCommander implements IVSubmenu<CSubmenuCommander> {
private VSubmenuCommander() { 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>(); Vector<Object> cmdDeckListData = new Vector<Object>();
if(Singletons.getModel().getDecks().getCommander().size() > 0) { if(Singletons.getModel().getDecks().getCommander().size() > 0) {

View File

@@ -76,7 +76,7 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
private VSubmenuPlanechase() { 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 //This listener will look for any of the radio buttons being selected
//and call the method that shows/hides tabs appropriately. //and call the method that shows/hides tabs appropriately.

View File

@@ -89,7 +89,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
private VSubmenuVanguard() { 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> humanListData = new Vector<Object>();
Vector<Object> aiListData = 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;
import forge.gui.MouseUtil.MouseCursor; import forge.gui.MouseUtil.MouseCursor;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.JTextComponentSkin;
import forge.gui.toolbox.FSkin.SkinFont; import forge.gui.toolbox.FSkin.SkinFont;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class GameLogPanel extends JPanel { public class GameLogPanel extends JPanel {
@@ -150,20 +150,19 @@ public class GameLogPanel extends JPanel {
} }
private JTextArea createNewLogEntryJTextArea(String text, boolean useAlternateBackColor) { private JTextArea createNewLogEntryJTextArea(String text, boolean useAlternateBackColor) {
final JTextArea tar = new JTextArea(text); final SkinnedTextArea tar = new SkinnedTextArea(text);
final JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar); tar.setFont(textFont);
tarSkin.setFont(textFont);
tar.setBorder(new EmptyBorder(3, 4, 3, 4)); tar.setBorder(new EmptyBorder(3, 4, 3, 4));
tar.setFocusable(false); tar.setFocusable(false);
tar.setEditable(false); tar.setEditable(false);
tar.setLineWrap(true); tar.setLineWrap(true);
tar.setWrapStyleWord(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); FSkin.SkinColor skinColor = FSkin.getColor(FSkin.Colors.CLR_THEME2);
if (useAlternateBackColor) { skinColor = skinColor.darker(); } if (useAlternateBackColor) { skinColor = skinColor.darker(); }
tar.setOpaque(true); tar.setOpaque(true);
tarSkin.setBackground(skinColor); tar.setBackground(skinColor);
return tar; return tar;
} }

View File

@@ -38,6 +38,7 @@ import forge.gauntlet.GauntletData;
import forge.gauntlet.GauntletIO; import forge.gauntlet.GauntletIO;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.net.FServer; import forge.net.FServer;
import forge.net.Lobby; 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"); 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.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
pnl.setOpaque(true); 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(lblTitle, "gap 0 0 20px 10px, ax center");
pnl.add(pnlResults, "w 96%!, growy, pushy, gap 2% 0 0 0"); 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 java.awt.Dimension;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import forge.Singletons; import forge.Singletons;
import forge.game.Game; import forge.game.Game;
import forge.gui.SOverlayUtils; import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.limited.GauntletMini; import forge.limited.GauntletMini;
import forge.net.FServer; 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_TITLE = "w 95%!, gap 0 0 20px 10px";
private static final String CONSTRAINTS_TEXT = "w 95%!,, h 180px!, gap 0 0 0 20px"; private static final String CONSTRAINTS_TEXT = "w 95%!,, h 180px!, gap 0 0 0 20px";
private JLabel lblTemp1; private SkinnedLabel lblTemp1;
private JLabel lblTemp2; private SkinnedLabel lblTemp2;
/** /**
* Instantiates a new limited mode win/lose handler. * Instantiates a new limited mode win/lose handler.
@@ -125,11 +125,11 @@ public class LimitedWinLose extends ControlWinLose {
private void showTournamentInfo(final String newTitle) { private void showTournamentInfo(final String newTitle) {
this.lblTemp1 = new TitleLabel(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 Wins: " + gauntlet.getWins()
// + " Total Losses: " + gauntlet.getLosses()); // + " Total Losses: " + gauntlet.getLosses());
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER); 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.setForeground(Color.white);
this.lblTemp2.setIconTextGap(50); this.lblTemp2.setIconTextGap(50);
this.getView().getPnlCustom().add(this.lblTemp1, LimitedWinLose.CONSTRAINTS_TITLE); this.getView().getPnlCustom().add(this.lblTemp1, LimitedWinLose.CONSTRAINTS_TITLE);
@@ -204,10 +204,10 @@ public class LimitedWinLose extends ControlWinLose {
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
private class TitleLabel extends JLabel { private class TitleLabel extends SkinnedLabel {
TitleLabel(final String msg) { TitleLabel(final String msg) {
super(msg); super(msg);
FSkin.get(this).setFont(FSkin.getFont(18)); this.setFont(FSkin.getFont(18));
this.setPreferredSize(new Dimension(200, 40)); this.setPreferredSize(new Dimension(200, 40));
this.setHorizontalAlignment(SwingConstants.CENTER); this.setHorizontalAlignment(SwingConstants.CENTER);
this.setForeground(Color.white); this.setForeground(Color.white);

View File

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

View File

@@ -22,6 +22,7 @@ import java.util.List;
import javax.swing.AbstractListModel; import javax.swing.AbstractListModel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
@@ -68,9 +69,9 @@ public class QuestWinLoseCardViewer extends FPanel {
this.setCornerDiameter(20); this.setCornerDiameter(20);
this.setBorderToggle(false); this.setBorderToggle(false);
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
picture.setOpaque(false); picture.setOpaque(false);
scroller.setBorder(null); scroller.setBorder((Border)null);
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
this.add(scroller, "w 32%!, h 98%!, gap 1% 1% 1% 1%"); 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.controllers.CDock;
import forge.gui.match.views.VField; import forge.gui.match.views.VField;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.view.FView; import forge.view.FView;
import forge.view.arcane.CardPanel; import forge.view.arcane.CardPanel;
@@ -53,7 +54,7 @@ public enum TargetingOverlay {
/** */ /** */
SINGLETON_INSTANCE; 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<CardPanel> cardPanels = new ArrayList<CardPanel>();
private final List<Point[]> arcs = new ArrayList<Point[]>(); private final List<Point[]> arcs = new ArrayList<Point[]>();
@@ -66,7 +67,7 @@ public enum TargetingOverlay {
pnl.setOpaque(false); pnl.setOpaque(false);
pnl.setVisible(false); pnl.setVisible(false);
pnl.setFocusTraversalKeysEnabled(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} */ /** @return {@link javax.swing.JPanel} */
@@ -255,7 +256,7 @@ public enum TargetingOverlay {
endpoints.clear(); endpoints.clear();
} }
private class OverlayPanel extends JPanel { private class OverlayPanel extends SkinnedPanel {
/** /**
* For some reason, the alpha channel background doesn't work properly on * For some reason, the alpha channel background doesn't work properly on
* Windows 7, so the paintComponent override is required for a * 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.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.game.GameEntity; import forge.game.GameEntity;
@@ -44,6 +45,7 @@ import forge.gui.toolbox.FButton;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FScrollPane; import forge.gui.toolbox.FScrollPane;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedPanel;
import forge.view.FDialog; import forge.view.FDialog;
import forge.view.arcane.CardPanel; 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 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.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 @Override
public void mouseExited(final MouseEvent evt) { public void mouseExited(final MouseEvent evt) {
((CardPanel) evt.getSource()).setBorder(null); ((CardPanel) evt.getSource()).setBorder((Border)null);
} }
@Override @Override
@@ -153,8 +155,8 @@ public class VAssignDamage {
// Top-level UI stuff // Top-level UI stuff
final JPanel overlay = SOverlayUtils.genericOverlay(); final JPanel overlay = SOverlayUtils.genericOverlay();
final JPanel pnlMain = new JPanel(); final SkinnedPanel pnlMain = new SkinnedPanel();
FSkin.get(pnlMain).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); pnlMain.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Attacker area // Attacker area
final CardPanel pnlAttacker = new CardPanel(attacker0); final CardPanel pnlAttacker = new CardPanel(attacker0);
@@ -175,7 +177,7 @@ public class VAssignDamage {
pnlDefenders.setLayout(new MigLayout("insets 0, gap 0, ax center, " + wrap)); pnlDefenders.setLayout(new MigLayout("insets 0, gap 0, ax center, " + wrap));
final FScrollPane scrDefenders = new FScrollPane(pnlDefenders); final FScrollPane scrDefenders = new FScrollPane(pnlDefenders);
scrDefenders.setBorder(null); scrDefenders.setBorder((Border)null);
// Top row of cards... // Top row of cards...
for (final Card c : defenderCards) { for (final Card c : defenderCards) {

View File

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

View File

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

View File

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

View File

@@ -71,7 +71,7 @@ public class VCommand implements IVDoc<CCommand> {
control = new CCommand(player, this); 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); tabletop.setOpaque(false);
scroller.setViewportView(this.tabletop); scroller.setViewportView(this.tabletop);

View File

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

View File

@@ -37,6 +37,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc; import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CDev; import forge.gui.match.controllers.CDev;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/** /**
* Assembles Swing components of players report. * 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 * Labels that act as buttons which control dev mode functions. Labels are
* used to support multiline text. * used to support multiline text.
*/ */
public class DevLabel extends JLabel { public class DevLabel extends SkinnedLabel {
private static final long serialVersionUID = 7917311680519060700L; private static final long serialVersionUID = 7917311680519060700L;
private FSkin.SkinColor defaultBG = FSkin.getColor(FSkin.Colors.CLR_ACTIVE); 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.r = 6; // Radius (for paintComponent)
this.i = 2; // Insets (for paintComponent) this.i = 2; // Insets (for paintComponent)
this.setEnabled(true); 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() { this.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.pressedBG); DevLabel.this.setBackground(DevLabel.this.pressedBG);
} }
@Override @Override
public void mouseReleased(final MouseEvent e) { public void mouseReleased(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.defaultBG); DevLabel.this.setBackground(DevLabel.this.defaultBG);
} }
@Override @Override
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
FSkin.get(DevLabel.this).setBackground(DevLabel.this.hoverBG); DevLabel.this.setBackground(DevLabel.this.hoverBG);
} }
@Override @Override
public void mouseExited(final MouseEvent e) { 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.enabled = b;
this.setText(s); this.setText(s);
this.setToolTipText(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.Graphics;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import forge.Command; import forge.Command;
@@ -38,6 +37,7 @@ import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinColor; import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinImage; import forge.gui.toolbox.FSkin.SkinImage;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/** /**
* Assembles Swing components of button dock area. * 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. * Buttons in Dock. JLabels are used to allow hover effects.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class DockButton extends JLabel implements ILocalRepaint { public class DockButton extends SkinnedLabel implements ILocalRepaint {
private final SkinImage img; private final SkinImage img;
private final SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER); private final SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
private final Color defaultBG = new Color(0, 0, 0, 0); private final Color defaultBG = new Color(0, 0, 0, 0);
@@ -215,12 +215,12 @@ public enum VDock implements IVDoc<CDock> {
@Override @Override
public void onMouseEnter(final MouseEvent e) { public void onMouseEnter(final MouseEvent e) {
FSkin.get(DockButton.this).setBackground(DockButton.this.hoverBG); DockButton.this.setBackground(DockButton.this.hoverBG);
} }
@Override @Override
public void onMouseExit(final MouseEvent e) { 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.setColor(this.getBackground());
g.fillRect(0, 0, this.w, this.h); 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)); FSkin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
} }
else { else {

View File

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

View File

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

View File

@@ -24,6 +24,7 @@ import java.util.Map.Entry;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.Singletons; import forge.Singletons;
import forge.game.Game; import forge.game.Game;
@@ -38,6 +39,7 @@ import forge.gui.framework.EDocID;
import forge.gui.framework.IVDoc; import forge.gui.framework.IVDoc;
import forge.gui.match.controllers.CPlayers; import forge.gui.match.controllers.CPlayers;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.properties.ForgePreferences.FPref; 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 }); 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 // 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()); 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. */ /** A quick JLabel for info in "players" panel, to consolidate styling. */
@SuppressWarnings("serial") @SuppressWarnings("serial")
private class InfoLabel extends JLabel { private class InfoLabel extends SkinnedLabel {
public InfoLabel() { public InfoLabel() {
super(); 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); btnOK.addKeyListener(buttonKeyAdapter);
btnCancel.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)); 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. // wrap : 2 columns required for btnOk and btnCancel.
container.setLayout(new MigLayout("wrap 2, gap 0px!, insets 1px 1px 3px 1px")); 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 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 { else {
container.add(lblGames, "span 2, w 10:100%, h 22px!"); 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"); 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.FMouseAdapter;
import forge.gui.toolbox.FScrollPanel; import forge.gui.toolbox.FScrollPanel;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTextArea;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
import forge.view.arcane.CardArea; import forge.view.arcane.CardArea;
import forge.view.arcane.CardPanel; import forge.view.arcane.CardPanel;
@@ -186,7 +187,7 @@ public enum VStack implements IVDoc<CStack> {
Animation.moveCard(stackArea.addCard(spell.getSourceCard())); Animation.moveCard(stackArea.addCard(spell.getSourceCard()));
} }
else { else {
JTextArea tar = new JTextArea(txt); SkinnedTextArea tar = new SkinnedTextArea(txt);
tar.setToolTipText(txt); tar.setToolTipText(txt);
tar.setOpaque(true); tar.setOpaque(true);
tar.setBorder(border); 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 ")) { if (s0.getStackDescription().startsWith("Morph ")) {
tar.setBackground(new Color(0, 0, 0, 0)); 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()) { else if (CardUtil.getColors(s0.getSourceCard()).isMulticolor()) {
tar.setBackground(new Color(253, 175, 63)); tar.setBackground(new Color(253, 175, 63));
@@ -284,7 +285,7 @@ public enum VStack implements IVDoc<CStack> {
} }
else { else {
tar.setBackground(new Color(0, 0, 0, 0)); 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.framework.FScreen;
import forge.gui.match.controllers.CDock; import forge.gui.match.controllers.CDock;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedMenuItem;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
import forge.view.FFrame; import forge.view.FFrame;
@@ -77,8 +78,7 @@ public final class LayoutMenu {
JRadioButtonMenuItem menuItem; JRadioButtonMenuItem menuItem;
ButtonGroup group = new ButtonGroup(); ButtonGroup group = new ButtonGroup();
String currentSkin = prefs.getPref(FPref.UI_SKIN); String currentSkin = prefs.getPref(FPref.UI_SKIN);
String[] skins = FSkin.getSkinNamesArray(true); for (String skin : FSkin.getAllSkins()) {
for (String skin : skins) {
menuItem = new JRadioButtonMenuItem(skin); menuItem = new JRadioButtonMenuItem(skin);
group.add(menuItem); group.add(menuItem);
if (skin.equals(currentSkin)) { if (skin.equals(currentSkin)) {
@@ -143,8 +143,8 @@ public final class LayoutMenu {
} }
private static JMenuItem getMenuItem_SaveLayout() { private static JMenuItem getMenuItem_SaveLayout() {
JMenuItem menuItem = new JMenuItem("Save Current Layout"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Current Layout");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_SAVELAYOUT) : null)); menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_SAVELAYOUT) : null));
menuItem.addActionListener(getSaveLayoutAction()); menuItem.addActionListener(getSaveLayoutAction());
return menuItem; return menuItem;
} }
@@ -159,8 +159,8 @@ public final class LayoutMenu {
} }
private static JMenuItem getMenuItem_OpenLayout() { private static JMenuItem getMenuItem_OpenLayout() {
JMenuItem menuItem = new JMenuItem("Open..."); SkinnedMenuItem menuItem = new SkinnedMenuItem("Open...");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_OPENLAYOUT) : null)); menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_OPENLAYOUT) : null));
menuItem.addActionListener(getOpenLayoutAction()); menuItem.addActionListener(getOpenLayoutAction());
return menuItem; return menuItem;
} }
@@ -175,8 +175,8 @@ public final class LayoutMenu {
} }
private static JMenuItem getMenuItem_RevertLayout() { private static JMenuItem getMenuItem_RevertLayout() {
JMenuItem menuItem = new JMenuItem("Refresh"); SkinnedMenuItem menuItem = new SkinnedMenuItem("Refresh");
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_REVERTLAYOUT) : null)); menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_REVERTLAYOUT) : null));
menuItem.addActionListener(getRevertLayoutAction()); menuItem.addActionListener(getRevertLayoutAction());
return menuItem; return menuItem;
} }

View File

@@ -26,7 +26,6 @@ import com.esotericsoftware.minlog.Log;
import forge.card.mana.ManaCost; import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostShard; import forge.card.mana.ManaCostShard;
import forge.gui.toolbox.FSkin.ComponentSkin;
import forge.gui.toolbox.FSkin.SkinImage; import forge.gui.toolbox.FSkin.SkinImage;
/** /**
@@ -132,7 +131,7 @@ public class CardFaceSymbols {
* @param y * @param y
* a int. * 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()) { if (manaCost.isNoCost()) {
return; return;
} }
@@ -145,25 +144,25 @@ public class CardFaceSymbols {
if (hasGeneric) { if (hasGeneric) {
for (final ManaCostShard s : manaCost) { //render X shards before generic for (final ManaCostShard s : manaCost) { //render X shards before generic
if (s == ManaCostShard.X) { if (s == ManaCostShard.X) {
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y); CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
xpos += offset; xpos += offset;
} }
} }
final String sGeneric = Integer.toString(genericManaCost); final String sGeneric = Integer.toString(genericManaCost);
CardFaceSymbols.drawSymbol(sGeneric, skin, g, xpos, y); CardFaceSymbols.drawSymbol(sGeneric, g, xpos, y);
xpos += offset; xpos += offset;
for (final ManaCostShard s : manaCost) { //render non-X shards after generic for (final ManaCostShard s : manaCost) { //render non-X shards after generic
if (s != ManaCostShard.X) { if (s != ManaCostShard.X) {
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y); CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
xpos += offset; xpos += offset;
} }
} }
} }
else { //if no generic, just render shards in order else { //if no generic, just render shards in order
for (final ManaCostShard s : manaCost) { for (final ManaCostShard s : manaCost) {
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y); CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
xpos += offset; xpos += offset;
} }
} }
@@ -179,7 +178,7 @@ public class CardFaceSymbols {
* @param w an int * @param w an int
* @param h and 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) { if (s.length() == 0) {
return; return;
} }
@@ -209,7 +208,7 @@ public class CardFaceSymbols {
* @param y * @param y
* a int. * 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); FSkin.drawImage(g, MANA_IMAGES.get("attack"), x, y);
} }
@@ -227,7 +226,7 @@ public class CardFaceSymbols {
* @param y * @param y
* a int. * 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); 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 java.awt.event.MouseEvent;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton;
import forge.gui.framework.ILocalRepaint; import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin.JComponentSkin;
import forge.gui.toolbox.FSkin.SkinImage; import forge.gui.toolbox.FSkin.SkinImage;
import forge.gui.toolbox.FSkin.SkinnedButton;
/** /**
* The core JButton used throughout the Forge project. Follows skin font and * The core JButton used throughout the Forge project. Follows skin font and
@@ -44,10 +42,9 @@ import forge.gui.toolbox.FSkin.SkinImage;
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FButton extends JButton implements ILocalRepaint { public class FButton extends SkinnedButton implements ILocalRepaint {
/** The img r. */ /** The img r. */
private final JComponentSkin<FButton> skin;
private SkinImage imgL; private SkinImage imgL;
private SkinImage imgM; private SkinImage imgM;
private SkinImage imgR; private SkinImage imgR;
@@ -68,14 +65,13 @@ public class FButton extends JButton implements ILocalRepaint {
public FButton(final String label) { public FButton(final String label) {
super(label); super(label);
this.setOpaque(false); this.setOpaque(false);
skin = FSkin.get(this); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setBackground(Color.red);
skin.setBackground(Color.red);
this.setFocusPainted(false); this.setFocusPainted(false);
this.setBorder(BorderFactory.createEmptyBorder()); this.setBorder(BorderFactory.createEmptyBorder());
this.setContentAreaFilled(false); this.setContentAreaFilled(false);
this.setMargin(new Insets(0, 25, 0, 25)); this.setMargin(new Insets(0, 25, 0, 25));
skin.setFont(FSkin.getBoldFont(14)); this.setFont(FSkin.getBoldFont(14));
this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT); this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT);
this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER); this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER);
this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT); this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT);

View File

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

View File

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

View File

@@ -1,18 +1,11 @@
package forge.gui.toolbox; package forge.gui.toolbox;
import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import javax.swing.border.EmptyBorder;
import forge.Singletons; import forge.Singletons;
import forge.gui.toolbox.FSkin.JLabelSkin; import forge.gui.toolbox.FSkin.SkinnedLabel;
import forge.properties.ForgePreferences.FPref; import forge.properties.ForgePreferences.FPref;
/** /**
@@ -69,10 +62,9 @@ public class FComboBoxPanel<E> extends JPanel {
private void setLabelLayout() { private void setLabelLayout() {
if (this.comboBoxCaption != null && !this.comboBoxCaption.isEmpty()) { if (this.comboBoxCaption != null && !this.comboBoxCaption.isEmpty()) {
JLabel comboLabel = new JLabel(this.comboBoxCaption); SkinnedLabel comboLabel = new SkinnedLabel(this.comboBoxCaption);
JLabelSkin<JLabel> labelSkin = FSkin.get(comboLabel); comboLabel.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
labelSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); comboLabel.setFont(FSkin.getBoldFont(12));
labelSkin.setFont(FSkin.getBoldFont(12));
this.add(comboLabel); this.add(comboLabel);
} }
} }
@@ -80,11 +72,9 @@ public class FComboBoxPanel<E> extends JPanel {
private void setComboBoxLayout() { private void setComboBoxLayout() {
if (this.comboBox != null) { if (this.comboBox != null) {
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) { if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) {
FSkin.JComponentSkin<FComboBox<E>> comboBoxSkin = FSkin.get(this.comboBox); this.comboBox.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
comboBoxSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); this.comboBox.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
comboBoxSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.comboBox.setFont(FSkin.getFont(12));
comboBoxSkin.setFont(FSkin.getFont(12));
this.comboBox.setRenderer(new ComplexCellRenderer<E>());
} }
this.comboBox.setEditable(false); this.comboBox.setEditable(false);
this.comboBox.setFocusable(true); this.comboBox.setFocusable(true);
@@ -104,25 +94,4 @@ public class FComboBoxPanel<E> extends JPanel {
private void refreshSkin() { private void refreshSkin() {
this.comboBox = FComboBoxWrapper.refreshComboBoxSkin(this.comboBox); 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.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import javax.swing.JLabel;
import javax.swing.Timer; import javax.swing.Timer;
import forge.gui.toolbox.FSkin.SkinnedLabel;
/** /**
* Digital clock label that displays current time * Digital clock label that displays current time
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FDigitalClock extends JLabel { public class FDigitalClock extends SkinnedLabel {
private static final Calendar now = Calendar.getInstance(); private static final Calendar now = Calendar.getInstance();
private static final DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT); private static final DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT);
private static final ArrayList<FDigitalClock> clocks = new ArrayList<FDigitalClock>(); 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.JEditorPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import forge.gui.toolbox.FSkin.SkinnedEditorPane;
/** /**
* Viewer for HTML * Viewer for HTML
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FHtmlViewer extends JEditorPane { public class FHtmlViewer extends SkinnedEditorPane {
/** */ /** */
public FHtmlViewer() { public FHtmlViewer() {
super(); super();
FSkin.JTextComponentSkin<FHtmlViewer> skin = FSkin.get(this); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setOpaque(false); this.setOpaque(false);
this.setFocusable(false); this.setFocusable(false);
this.setEditable(false); this.setEditable(false);

View File

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

View File

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

View File

@@ -150,7 +150,7 @@ public class FOptionPane extends FDialog {
} }
if (message != null) { if (message != null) {
FTextArea prompt = new FTextArea(message); FTextArea prompt = new FTextArea(message);
FSkin.get(prompt).setFont(FSkin.getFont(14)); prompt.setFont(FSkin.getFont(14));
prompt.setAutoSize(true); prompt.setAutoSize(true);
Dimension parentSize = JOptionPane.getRootFrame().getSize(); Dimension parentSize = JOptionPane.getRootFrame().getSize();
prompt.setMaximumSize(new Dimension(parentSize.width / 2, parentSize.height - 100)); 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.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel;
import forge.gui.SOverlayUtils; import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FSkin.SkinnedPanel;
/** /**
* Semi-transparent overlay panel. Should be used with layered panes. * Semi-transparent overlay panel. Should be used with layered panes.
@@ -43,7 +42,7 @@ public enum FOverlay {
SINGLETON_INSTANCE; SINGLETON_INSTANCE;
private final JButton btnClose = new JButton("X"); 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. * Semi-transparent overlay panel. Should be used with layered panes.
@@ -83,12 +82,11 @@ public enum FOverlay {
return this.btnClose; return this.btnClose;
} }
/** @return {@link javax.swing.JPanel} */ public SkinnedPanel getPanel() {
public JPanel getPanel() {
return this.pnl; 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 * For some reason, the alpha channel background doesn't work properly on
* Windows 7, so the paintComponent override is required for a * 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.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import forge.Command; import forge.Command;
import forge.gui.framework.ILocalRepaint; import forge.gui.framework.ILocalRepaint;
import forge.gui.toolbox.FSkin.FPanelBase;
import forge.gui.toolbox.FSkin.SkinColor; import forge.gui.toolbox.FSkin.SkinColor;
import forge.gui.toolbox.FSkin.SkinImage;
/** /**
* Core panel used in UI. * Core panel used in UI.
@@ -51,9 +49,7 @@ import forge.gui.toolbox.FSkin.SkinImage;
* - Border toggle<br> * - Border toggle<br>
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FPanel extends JPanel implements ILocalRepaint { public class FPanel extends FPanelBase implements ILocalRepaint {
//========== Variable initialization
protected final FSkin.FPanelSkin<FPanel> skin;
// Defaults for adjustable values // Defaults for adjustable values
private boolean selectable = false; private boolean selectable = false;
private boolean hoverable = false; private boolean hoverable = false;
@@ -89,8 +85,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
this.setOpaque(false); this.setOpaque(false);
// Background will follow skin theme. // Background will follow skin theme.
skin = FSkin.get(this); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
} }
// Mouse event handler // Mouse event handler
@@ -143,15 +138,13 @@ public class FPanel extends JPanel implements ILocalRepaint {
/** @param bool0 &emsp; boolean */ /** @param bool0 &emsp; boolean */
public void setSelected(final boolean bool0) { public void setSelected(final boolean bool0) {
selected = bool0; selected = bool0;
if (bool0) { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); } if (bool0) { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
else { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); } else { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
repaintSelf(); repaintSelf();
} }
/** @param img0 &emsp; {@link java.awt.Image} */ /** @param img0 &emsp; {@link java.awt.Image} */
public void setForegroundImage(final Image img0) { protected void onSetForegroundImage(final Image img0) {
skin.resetForegroundImage(); //must reset if non-skin image set
if (img0 == null) { if (img0 == null) {
this.foregroundImage = null; this.foregroundImage = null;
return; return;
@@ -163,16 +156,6 @@ public class FPanel extends JPanel implements ILocalRepaint {
this.iar = (double) imgW / (double) imgH; 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. /** Aligns NON-STRETCHED foreground image.
* Must use SwingConstants. * Must use SwingConstants.
* @param i0 &emsp; int * @param i0 &emsp; int
@@ -197,9 +180,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
} }
/** @param img0 &emsp; {@link java.awt.Image} */ /** @param img0 &emsp; {@link java.awt.Image} */
public void setBackgroundTexture(final Image img0) { protected void onSetBackgroundTexture(final Image img0) {
skin.resetBackgroundTexture(); //must reset if non-skin image set
if (img0 == null) { return; } if (img0 == null) { return; }
this.backgroundTexture = img0; this.backgroundTexture = img0;
@@ -207,27 +188,11 @@ public class FPanel extends JPanel implements ILocalRepaint {
this.textureH = img0.getHeight(null); 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} */ /** @param clr0 &emsp; {@link java.awt.Color} */
public void setBackgroundTextureOverlay(final Color color) { public void onSetBackgroundTextureOverlay(final Color color) {
skin.resetBackgroundTexture(); //must reset if non-skin color set
this.backgroundTextureOverlay = 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 */ /** @param bool0 &emsp; boolean */
public void setBorderToggle(final boolean bool0) { public void setBorderToggle(final boolean bool0) {
this.borderToggle = 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)); } 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 (hovered) { FSkin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_HOVER)); }
else if (selectable) { FSkin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); } 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); g2d0.fillRoundRect(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter);
} }

View File

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

View File

@@ -2,15 +2,16 @@ package forge.gui.toolbox;
import java.awt.Component; import java.awt.Component;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import forge.gui.toolbox.FSkin.SkinnedScrollPane;
/** /**
* A very basic extension of JScrollPane to centralize common styling changes. * A very basic extension of JScrollPane to centralize common styling changes.
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FScrollPane extends JScrollPane { public class FScrollPane extends SkinnedScrollPane {
/** /**
* A very basic extension of JScrollPane to centralize common styling changes. * A very basic extension of JScrollPane to centralize common styling changes.
* This constructor assumes "as needed" for horizontal and vertical scroll policies. * This constructor assumes "as needed" for horizontal and vertical scroll policies.
@@ -32,7 +33,7 @@ public class FScrollPane extends JScrollPane {
super(c0, vertical0, horizontal0); super(c0, vertical0, horizontal0);
getVerticalScrollBar().setUnitIncrement(16); getVerticalScrollBar().setUnitIncrement(16);
getViewport().setOpaque(false); 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); 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.SpinnerNumberModel;
import javax.swing.text.NumberFormatter; import javax.swing.text.NumberFormatter;
import forge.gui.toolbox.FSkin.SkinnedSpinner;
/** /**
* A custom instance of JSpinner using Forge skin properties. Only numeric * A custom instance of JSpinner using Forge skin properties. Only numeric
* integer spinners are implemented, since that's all we've needed so far. * integer spinners are implemented, since that's all we've needed so far.
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FSpinner extends JSpinner { public class FSpinner extends SkinnedSpinner {
public static class Builder { public static class Builder {
//========== Default values for FTextField are set here. //========== Default values for FTextField are set here.
private int initialValue = 0; 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.setModel(new SpinnerNumberModel(builder.initialValue, builder.minValue, builder.maxValue, 1));
this.setEditor(new JSpinner.NumberEditor(this, "##")); this.setEditor(new JSpinner.NumberEditor(this, "##"));
JFormattedTextField txt = ((JSpinner.NumberEditor)this.getEditor()).getTextField(); JFormattedTextField txt = this.getTextField();
((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false); ((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false);
FSkin.JTextComponentSkin<JFormattedTextField> txtSkin = FSkin.get(txt); this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
txtSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
txtSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2)); this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
txtSkin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
txt.setMargin(new Insets(5, 5, 5, 5)); txt.setMargin(new Insets(5, 5, 5, 5));
txt.setOpaque(true); txt.setOpaque(true);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import javax.swing.JCheckBox;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
@@ -52,6 +51,8 @@ import forge.gui.toolbox.ContextMenuBuilder;
import forge.gui.toolbox.FComboBoxWrapper; import forge.gui.toolbox.FComboBoxWrapper;
import forge.gui.toolbox.FLabel; import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin; 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.FTextField;
import forge.gui.toolbox.LayoutHelper; import forge.gui.toolbox.LayoutHelper;
import forge.gui.toolbox.ToolTipListener; 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 Class<T> genericType;
private final ArrayList<ListSelectionListener> selectionListeners = new ArrayList<ListSelectionListener>(); 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() 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") .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(); .build();
private ItemFilter<? extends T> mainSearchFilter; 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() private final FLabel btnFilters = new FLabel.ButtonBuilder()
.text("Filters") .text("Filters")
@@ -181,7 +182,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
this.mainSearchFilter = createSearchFilter(); this.mainSearchFilter = createSearchFilter();
this.add(mainSearchFilter.getWidget()); this.add(mainSearchFilter.getWidget());
this.pnlButtons.setOpaque(false); 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.pnlButtons);
this.add(this.btnFilters); this.add(this.btnFilters);
this.add(this.lblCaption); this.add(this.lblCaption);

View File

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

View File

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

View File

@@ -38,6 +38,7 @@ import javax.swing.JComponent;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.JViewport; import javax.swing.JViewport;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
@@ -52,6 +53,7 @@ import org.apache.commons.lang3.ArrayUtils;
import forge.gui.toolbox.FMouseAdapter; import forge.gui.toolbox.FMouseAdapter;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.gui.toolbox.FSkin.SkinnedTable;
import forge.gui.toolbox.itemmanager.ItemManager; import forge.gui.toolbox.itemmanager.ItemManager;
import forge.gui.toolbox.itemmanager.ItemManagerModel; import forge.gui.toolbox.itemmanager.ItemManagerModel;
import forge.gui.toolbox.itemmanager.SItemManagerIO; import forge.gui.toolbox.itemmanager.SItemManagerIO;
@@ -70,7 +72,6 @@ import forge.util.ItemPoolSorter;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public final class ItemListView<T extends InventoryItem> extends ItemView<T> { public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
private final ItemTable table = new ItemTable(); private final ItemTable table = new ItemTable();
private final FSkin.JTableSkin<ItemTable> skin;
private final ItemTableModel tableModel; private final ItemTableModel tableModel;
public ItemTableModel getTableModel() { public ItemTableModel getTableModel() {
@@ -88,20 +89,19 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
this.tableModel = new ItemTableModel(model0); this.tableModel = new ItemTableModel(model0);
// use different selection highlight colors for focused vs. unfocused tables // use different selection highlight colors for focused vs. unfocused tables
this.skin = FSkin.get(this.table); this.table.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
this.skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); this.table.setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.skin.setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.table.addFocusListener(new FocusListener() { this.table.addFocusListener(new FocusListener() {
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (!e.isTemporary() && !skin.isDisposed()) { if (!e.isTemporary()) {
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); table.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
} }
} }
@Override @Override
public void focusGained(FocusEvent e) { 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 nothing selected when we gain focus, select the first row (if exists)
if (-1 == getSelectedIndex() && getCount() > 0) { if (-1 == getSelectedIndex() && getCount() > 0) {
table.setRowSelectionInterval(0, 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.setFont(FSkin.getFont(12));
this.table.setBorder(null); this.table.setBorder((Border)null);
this.table.getTableHeader().setBorder(null); this.table.getTableHeader().setBorder(null);
this.table.setRowHeight(18); this.table.setRowHeight(18);
setWantElasticColumns(false); 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); 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 @Override
protected JTableHeader createDefaultTableHeader() { protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) { 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 // 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)"); popupLabel.setText(searchStr + " (hit Enter for next match, Esc to cancel)");
if (found) { if (found) {
FSkin.get(popupLabel).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT)); popupLabel.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
} }
else { else {
FSkin.get(popupLabel).setForeground(new Color(255, 0, 0)); popupLabel.setForeground(new Color(255, 0, 0));
} }
if (popupShowing) { if (popupShowing) {
@@ -229,7 +229,7 @@ public abstract class ItemView<T extends InventoryItem> {
PopupFactory factory = PopupFactory.getSharedInstance(); PopupFactory factory = PopupFactory.getSharedInstance();
Point tableLoc = ItemView.this.getLocationOnScreen(); Point tableLoc = ItemView.this.getLocationOnScreen();
popup = factory.getPopup(null, popupLabel, tableLoc.x + 10, tableLoc.y + 10); 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() { popupTimer = new Timer(5000, new ActionListener() {
@Override @Override

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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