mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Support switching between Themes/Skins without restarting
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -15034,6 +15034,7 @@ src/main/java/forge/gui/toolbox/FAbsolutePositioner.java -text
|
||||
src/main/java/forge/gui/toolbox/FButton.java -text
|
||||
src/main/java/forge/gui/toolbox/FCheckBox.java -text
|
||||
src/main/java/forge/gui/toolbox/FComboBoxPanel.java -text
|
||||
src/main/java/forge/gui/toolbox/FComboBoxWrapper.java -text
|
||||
src/main/java/forge/gui/toolbox/FLabel.java -text
|
||||
src/main/java/forge/gui/toolbox/FList.java -text
|
||||
src/main/java/forge/gui/toolbox/FOverlay.java -text
|
||||
@@ -15145,7 +15146,6 @@ src/main/java/forge/net/protocol/toserver/IPacketSrv.java -text
|
||||
src/main/java/forge/net/protocol/toserver/IncorrectPacketSrv.java -text
|
||||
src/main/java/forge/net/protocol/toserver/package-info.java -text
|
||||
src/main/java/forge/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/properties/ForgeLookAndFeel.java -text
|
||||
src/main/java/forge/properties/ForgePreferences.java svneol=native#text/plain
|
||||
src/main/java/forge/properties/NewConstants.java svneol=native#text/plain
|
||||
src/main/java/forge/properties/Preferences.java svneol=native#text/plain
|
||||
|
||||
@@ -11,6 +11,8 @@ Release Notes
|
||||
- Commander -
|
||||
The Commander gaming mode has been added and is located in the Variant view. This is a work in progress and is not finished at this time. You are invited to play test this variant.
|
||||
|
||||
- Switch Theme/Skin Without Restart -
|
||||
You can now switch between themes/skins from any screen without restarting via Layout > Theme on main menu or via combo box on Preferences page of Home screen
|
||||
|
||||
- Card Overlays -
|
||||
Card overlays are now always displayed regardless of card image size if the display card overlays option is turned on in your user preferences.
|
||||
|
||||
@@ -25,8 +25,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@@ -39,6 +37,7 @@ import forge.card.CardRules;
|
||||
import forge.card.CardSplitType;
|
||||
import forge.game.player.IHasIcon;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinIcon;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.PaperToken;
|
||||
@@ -125,7 +124,7 @@ public class ImageCache {
|
||||
* retrieve an icon from the cache. returns the current skin's ICO_UNKNOWN if the icon image is not found
|
||||
* in the cache and cannot be loaded from disk.
|
||||
*/
|
||||
public static ImageIcon getIcon(IHasIcon ihi) {
|
||||
public static SkinIcon getIcon(IHasIcon ihi) {
|
||||
String imageKey = ihi.getIconImageKey();
|
||||
final BufferedImage i;
|
||||
if (_missingIconKeys.contains(imageKey) ||
|
||||
@@ -133,7 +132,7 @@ public class ImageCache {
|
||||
_missingIconKeys.add(imageKey);
|
||||
return FSkin.getIcon(FSkin.InterfaceIcons.ICO_UNKNOWN);
|
||||
}
|
||||
return new ImageIcon(i);
|
||||
return new FSkin.UnskinnedIcon(i);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,6 @@ import forge.gui.menubar.FMenuBar;
|
||||
import forge.gui.menubar.MenuUtil;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.net.FServer;
|
||||
import forge.properties.ForgeLookAndFeel;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.properties.NewConstants;
|
||||
@@ -173,19 +172,14 @@ public enum FControl implements KeyEventDispatcher {
|
||||
* @param isHeadlessMode */
|
||||
public void initialize() {
|
||||
// Preloads skin components (using progress bar).
|
||||
FSkin.loadFull();
|
||||
|
||||
// This must be done here or at least between the skin being loaded
|
||||
// and any GUI controls being created.
|
||||
FSkin.setProgessBarMessage("Setting look and feel...");
|
||||
setForgeLookAndFeel();
|
||||
FSkin.loadFull(true);
|
||||
|
||||
createMenuBar();
|
||||
|
||||
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts();
|
||||
this.display = FView.SINGLETON_INSTANCE.getLpnDocument();
|
||||
|
||||
FSkin.setProgessBarMessage("About to load current quest.");
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("About to load current quest.");
|
||||
// Preload quest data if present
|
||||
final File dirQuests = new File(NewConstants.QUEST_SAVE_DIR);
|
||||
final String questname = Singletons.getModel().getQuestPreferences().getPref(QPref.CURRENT_QUEST);
|
||||
@@ -213,7 +207,7 @@ public enum FControl implements KeyEventDispatcher {
|
||||
|
||||
setGlobalKeyboardHandler();
|
||||
|
||||
FSkin.setProgessBarMessage("Opening main window...");
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Opening main window...");
|
||||
SwingUtilities.invokeLater(new Runnable() { @Override
|
||||
public void run() { Singletons.getView().initialize(); } });
|
||||
}
|
||||
@@ -223,11 +217,6 @@ public enum FControl implements KeyEventDispatcher {
|
||||
manager.addKeyEventDispatcher(this);
|
||||
}
|
||||
|
||||
private void setForgeLookAndFeel() {
|
||||
ForgeLookAndFeel laf = new ForgeLookAndFeel();
|
||||
laf.setForgeLookAndFeel(Singletons.getView().getFrame());
|
||||
}
|
||||
|
||||
private void createMenuBar() {
|
||||
this.menuBar = new FMenuBar(Singletons.getView().getFrame());
|
||||
this.menuBar.setVisible(MenuUtil.isMenuBarVisible());
|
||||
|
||||
@@ -91,8 +91,9 @@ public class CardDetailPanel extends FPanel {
|
||||
labelConstrains.weightx = 1.0;
|
||||
|
||||
final JPanel cdLabels = new JPanel(new GridLayout(0, 1, 0, 5));
|
||||
cdLabels.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
cdLabels.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
final FSkin.JComponentSkin<JPanel> cdLabelsSkin = FSkin.get(cdLabels);
|
||||
cdLabelsSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
cdLabelsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.nameCostLabel = new FLabel.Builder().build();
|
||||
this.typeLabel = new FLabel.Builder().build();
|
||||
this.powerToughnessLabel = new FLabel.Builder().build();
|
||||
@@ -101,8 +102,9 @@ public class CardDetailPanel extends FPanel {
|
||||
cdLabels.add(this.powerToughnessLabel);
|
||||
|
||||
final JPanel idr = new JPanel(new GridBagLayout());
|
||||
idr.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
idr.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.JComponentSkin<JPanel> idrSkin = FSkin.get(idr);
|
||||
idrSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
idrSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
final GridBagConstraints c1 = new GridBagConstraints();
|
||||
final GridBagConstraints c2 = new GridBagConstraints();
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.ImageCache;
|
||||
import forge.Singletons;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
import forge.gui.toolbox.imaging.FImagePanel;
|
||||
import forge.gui.toolbox.imaging.FImagePanel.AutoSizeImageMode;
|
||||
import forge.gui.toolbox.imaging.FImageUtil;
|
||||
@@ -46,12 +48,14 @@ public final class CardPicturePanel extends JPanel {
|
||||
private Object displayed;
|
||||
|
||||
private final FImagePanel panel;
|
||||
private final JComponentSkin<FImagePanel> panelSkin;
|
||||
private BufferedImage currentImage;
|
||||
|
||||
public CardPicturePanel() {
|
||||
super(new BorderLayout());
|
||||
|
||||
this.panel = new FImagePanel();
|
||||
this.panelSkin = FSkin.get(this.panel);
|
||||
this.add(this.panel);
|
||||
}
|
||||
|
||||
@@ -67,7 +71,7 @@ public final class CardPicturePanel extends JPanel {
|
||||
}
|
||||
|
||||
public void setCardImage(CardCharacteristicName flipState) {
|
||||
BufferedImage image = FImageUtil.getImage((Card)displayed, flipState);
|
||||
BufferedImage image = FImageUtil.getImage((Card)displayed, flipState, this.panelSkin);
|
||||
if (image != null && image != this.currentImage) {
|
||||
this.currentImage = image;
|
||||
this.panel.setImage(image, getAutoSizeImageMode());
|
||||
@@ -91,7 +95,7 @@ public final class CardPicturePanel extends JPanel {
|
||||
image = ImageCache.getOriginalImage(ImageCache.getImageKey(item, false), true);
|
||||
|
||||
} else if (displayed instanceof Card) {
|
||||
image = FImageUtil.getImage((Card)displayed);
|
||||
image = FImageUtil.getImage((Card)displayed, this.panelSkin);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
||||
@@ -77,8 +77,8 @@ public class DualListBox<T> extends FPanel {
|
||||
|
||||
setPreferredSize(new Dimension(650, 300));
|
||||
setLayout(new GridLayout(0, 3));
|
||||
setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
this.skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
final Runnable onAdd = new Runnable() {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.awt.event.ActionListener;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
@@ -68,10 +67,11 @@ public enum FNetOverlay {
|
||||
* Semi-transparent overlay panel. Should be used with layered panes.
|
||||
*/
|
||||
private FNetOverlay() {
|
||||
FSkin.JComponentSkin<JPanel> pnlSkin = FSkin.get(pnl);
|
||||
pnl.setOpaque(false);
|
||||
pnl.setVisible(false);
|
||||
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
pnl.setBorder(BorderFactory.createLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
pnlSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
pnlSkin.setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
|
||||
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 2"));
|
||||
// pnl.add(new FLabel.Builder().text("Loading new game...").fontSize(22).build(), "h 40px!, align center");
|
||||
@@ -80,7 +80,7 @@ public enum FNetOverlay {
|
||||
|
||||
txtLog.setOpaque(true);
|
||||
txtLog.setFocusable(true);
|
||||
txtLog.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
FSkin.get(txtLog).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
|
||||
JScrollPane _operationLogScroller = new JScrollPane(txtLog);
|
||||
_operationLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
@@ -88,7 +88,7 @@ public enum FNetOverlay {
|
||||
new SmartScroller(_operationLogScroller);
|
||||
pnl.add(_operationLogScroller, "pushx, hmin 24, pushy, growy, growx, gap 2px 2px 2px 0, sx 2");
|
||||
|
||||
txtInput.setBorder(BorderFactory.createLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
FSkin.get(txtInput).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
pnl.add(txtInput, "pushx, growx, h 26px!, gap 2px 2px 2px 0");
|
||||
pnl.add(cmdSend, "w 60px!, h 28px!, gap 0 0 2px 0");
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
@@ -61,6 +60,7 @@ import forge.error.BugReporter;
|
||||
import forge.gui.ImportSourceAnalyzer.OpType;
|
||||
import forge.gui.toolbox.FButton;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FOverlay;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
@@ -307,7 +307,7 @@ public class ImportDialog {
|
||||
private final Runnable _onAnalyzerDone;
|
||||
private final boolean _isMigration;
|
||||
private final FLabel _unknownDeckLabel;
|
||||
private final JComboBox<_UnknownDeckChoice> _unknownDeckCombo;
|
||||
private final FComboBoxWrapper<_UnknownDeckChoice> _unknownDeckCombo;
|
||||
private final FCheckBox _moveCheckbox;
|
||||
private final FCheckBox _overwriteCheckbox;
|
||||
private final JTextArea _operationLog;
|
||||
@@ -340,7 +340,7 @@ public class ImportDialog {
|
||||
_addSelectionWidget(knownDeckPanel, OpType.UNKNOWN_DECK, "Unknown decks");
|
||||
JPanel unknownDeckPanel = new JPanel(new MigLayout("insets 0, gap 5"));
|
||||
unknownDeckPanel.setOpaque(false);
|
||||
_unknownDeckCombo = new JComboBox<_UnknownDeckChoice>();
|
||||
_unknownDeckCombo = new FComboBoxWrapper<_UnknownDeckChoice>();
|
||||
_unknownDeckCombo.addItem(new _UnknownDeckChoice("Constructed", NewConstants.DECK_CONSTRUCTED_DIR));
|
||||
_unknownDeckCombo.addItem(new _UnknownDeckChoice("Draft", NewConstants.DECK_DRAFT_DIR));
|
||||
_unknownDeckCombo.addItem(new _UnknownDeckChoice("Planar", NewConstants.DECK_PLANE_DIR));
|
||||
@@ -351,7 +351,7 @@ public class ImportDialog {
|
||||
});
|
||||
_unknownDeckLabel = new FLabel.Builder().text("Treat unknown decks as:").build();
|
||||
unknownDeckPanel.add(_unknownDeckLabel);
|
||||
unknownDeckPanel.add(_unknownDeckCombo);
|
||||
_unknownDeckCombo.addTo(unknownDeckPanel);
|
||||
knownDeckPanel.add(unknownDeckPanel, "span");
|
||||
cbPanel.add(knownDeckPanel, "aligny top");
|
||||
|
||||
@@ -816,7 +816,7 @@ public class ImportDialog {
|
||||
private final boolean _move;
|
||||
private final boolean _overwrite;
|
||||
|
||||
public _Importer(String srcDir, Map<OpType, Pair<FCheckBox, ? extends Map<File, File>>> selections, JComboBox<_UnknownDeckChoice> unknownDeckCombo,
|
||||
public _Importer(String srcDir, Map<OpType, Pair<FCheckBox, ? extends Map<File, File>>> selections, FComboBoxWrapper<_UnknownDeckChoice> unknownDeckCombo,
|
||||
JTextArea operationLog, JProgressBar progressBar, boolean move, boolean overwrite) {
|
||||
_srcDir = srcDir;
|
||||
_operationLog = operationLog;
|
||||
|
||||
@@ -25,5 +25,4 @@ public final class MouseUtil {
|
||||
public static void setMouseCursor(MouseCursor cursor) {
|
||||
FView.SINGLETON_INSTANCE.getLpnDocument().setCursor(Cursor.getPredefinedCursor(cursor.getValue()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Singletons;
|
||||
import forge.gui.match.TargetingOverlay;
|
||||
@@ -44,7 +42,7 @@ public final class SOverlayUtils {
|
||||
// (which is preset with null layout and close button)
|
||||
final FPanel pnl = new FPanel();
|
||||
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap"));
|
||||
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
FSkin.get(pnl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
pnl.setBounds(new Rectangle(((w - pnlW) / 2), ((h - pnlH) / 2), pnlW, pnlH));
|
||||
|
||||
pnl.add(new FLabel.Builder().icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_LOGO)).build(),
|
||||
@@ -70,7 +68,7 @@ public final class SOverlayUtils {
|
||||
|
||||
final JLabel lblLoading = new JLabel("");
|
||||
lblLoading.setOpaque(true);
|
||||
lblLoading.setBackground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.get(lblLoading).setBackground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
lblLoading.setMinimumSize(new Dimension(0, 20));
|
||||
|
||||
pnlLoading.setBounds(((w - 170) / 2), ((h - 80) / 2), 170, 80);
|
||||
@@ -104,9 +102,10 @@ public final class SOverlayUtils {
|
||||
final int w = overlay.getWidth();
|
||||
|
||||
final JButton btnCloseTopRight = new JButton("X");
|
||||
final FSkin.JComponentSkin<JButton> btnCloseTopRightSkin = FSkin.get(btnCloseTopRight);
|
||||
btnCloseTopRight.setBounds(w - 25, 10, 15, 15);
|
||||
btnCloseTopRight.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
btnCloseTopRight.setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT), 1));
|
||||
btnCloseTopRightSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
btnCloseTopRightSkin.setLineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
btnCloseTopRight.setOpaque(false);
|
||||
btnCloseTopRight.setBackground(new Color(0, 0, 0));
|
||||
btnCloseTopRight.setFocusPainted(false);
|
||||
|
||||
@@ -439,7 +439,12 @@ public enum CDeckEditorUI implements ICDoc, IMenuProvider {
|
||||
|
||||
// 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.setForeground(found ? FSkin.getColor(FSkin.Colors.CLR_TEXT) : new Color(255, 0, 0));
|
||||
if (found) {
|
||||
FSkin.get(popupLabel).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
else {
|
||||
FSkin.get(popupLabel).setForeground(new Color(255, 0, 0));
|
||||
}
|
||||
|
||||
if (popupShowing) {
|
||||
_setPopupSize();
|
||||
@@ -448,7 +453,7 @@ public enum CDeckEditorUI implements ICDoc, IMenuProvider {
|
||||
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||
Point tableLoc = tableView.getTable().getTableHeader().getLocationOnScreen();
|
||||
popup = factory.getPopup(null, popupLabel, tableLoc.x + 10, tableLoc.y + 10);
|
||||
SwingUtilities.getRoot(popupLabel).setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
FSkin.get(SwingUtilities.getRoot(popupLabel)).setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
|
||||
popupTimer = new Timer(5000, new ActionListener() {
|
||||
@Override
|
||||
|
||||
@@ -6,12 +6,11 @@ import java.awt.FlowLayout;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -24,6 +23,7 @@ import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.gui.framework.IVDoc;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSpinner;
|
||||
@@ -82,7 +82,7 @@ public enum VCardCatalog implements IVDoc<CCardCatalog> {
|
||||
.text("Add filter")
|
||||
.tooltip("Click to add custom filters to the card list")
|
||||
.reactOnMouseDown().build();
|
||||
private final JComboBox<String> cbSearchMode = new JComboBox<String>();
|
||||
private final FComboBoxWrapper<String> cbSearchMode = new FComboBoxWrapper<String>();
|
||||
private final JTextField txfSearch = new FTextField.Builder().ghostText("Search").build();
|
||||
private final FLabel lblName = new FLabel.Builder().text("Name").hoverable().selectable().selected().build();
|
||||
private final FLabel lblType = new FLabel.Builder().text("Type").hoverable().selectable().selected().build();
|
||||
@@ -144,7 +144,7 @@ public enum VCardCatalog implements IVDoc<CCardCatalog> {
|
||||
pnlSearch.add(txfSearch, "pushx, growx");
|
||||
cbSearchMode.addItem("in");
|
||||
cbSearchMode.addItem("not in");
|
||||
pnlSearch.add(cbSearchMode, "center");
|
||||
cbSearchMode.addTo(pnlSearch, "center");
|
||||
pnlSearch.add(lblName, "w pref+8, h pref+8");
|
||||
pnlSearch.add(lblType, "w pref+8, h pref+8");
|
||||
pnlSearch.add(lblText, "w pref+8, h pref+8");
|
||||
@@ -227,7 +227,7 @@ public enum VCardCatalog implements IVDoc<CCardCatalog> {
|
||||
public FLabel getLblText() { return lblText; }
|
||||
|
||||
public FLabel getBtnAddRestriction() { return btnAddRestriction; }
|
||||
public JComboBox<String> getCbSearchMode() { return cbSearchMode; }
|
||||
public FComboBoxWrapper<String> getCbSearchMode() { return cbSearchMode; }
|
||||
public JTextField getTxfSearch() { return txfSearch; }
|
||||
|
||||
public Map<SItemManagerUtil.StatTypes, FLabel> getStatLabels() {
|
||||
@@ -264,7 +264,7 @@ public enum VCardCatalog implements IVDoc<CCardCatalog> {
|
||||
final JPanel pnl = new JPanel(new MigLayout("insets 2, gap 2, h 30!"));
|
||||
|
||||
pnl.setOpaque(false);
|
||||
pnl.setBorder(BorderFactory.createMatteBorder(1, 2, 1, 2, FSkin.getColor(FSkin.Colors.CLR_TEXT)));
|
||||
FSkin.get(pnl).setMatteBorder(1, 2, 1, 2, FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
pnl.add(component, "h 30!, center");
|
||||
pnl.add(new FLabel.Builder().text("X").fontSize(10).hoverable(true)
|
||||
|
||||
@@ -4,8 +4,6 @@ import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.gui.deckeditor.controllers.CEditorPreferences;
|
||||
import forge.gui.framework.DragCell;
|
||||
@@ -74,36 +72,38 @@ public enum VEditorPreferences implements IVDoc<CEditorPreferences> {
|
||||
|
||||
//========== Constructor
|
||||
private VEditorPreferences() {
|
||||
lblStats.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
lblCatalog.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
lblDeck.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
lblDisplay.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
FSkin.get(lblStats).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
FSkin.get(lblCatalog).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
FSkin.get(lblDeck).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
FSkin.get(lblDisplay).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
|
||||
chbCatalogColor.setFont(FSkin.getFont(12));
|
||||
chbCatalogRarity.setFont(FSkin.getFont(12));
|
||||
chbCatalogCMC.setFont(FSkin.getFont(12));
|
||||
chbCatalogSet.setFont(FSkin.getFont(12));
|
||||
chbCatalogAI.setFont(FSkin.getFont(12));
|
||||
chbCatalogRanking.setFont(FSkin.getFont(12));
|
||||
chbCatalogPower.setFont(FSkin.getFont(12));
|
||||
chbCatalogToughness.setFont(FSkin.getFont(12));
|
||||
chbCatalogOwned.setFont(FSkin.getFont(12));
|
||||
FSkin.SkinFont font = FSkin.getFont(12);
|
||||
|
||||
chbDeckColor.setFont(FSkin.getFont(12));
|
||||
chbDeckRarity.setFont(FSkin.getFont(12));
|
||||
chbDeckCMC.setFont(FSkin.getFont(12));
|
||||
chbDeckSet.setFont(FSkin.getFont(12));
|
||||
chbDeckAI.setFont(FSkin.getFont(12));
|
||||
chbDeckRanking.setFont(FSkin.getFont(12));
|
||||
chbDeckPower.setFont(FSkin.getFont(12));
|
||||
chbDeckToughness.setFont(FSkin.getFont(12));
|
||||
FSkin.get(chbCatalogColor).setFont(font);
|
||||
FSkin.get(chbCatalogRarity).setFont(font);
|
||||
FSkin.get(chbCatalogCMC).setFont(font);
|
||||
FSkin.get(chbCatalogSet).setFont(font);
|
||||
FSkin.get(chbCatalogAI).setFont(font);
|
||||
FSkin.get(chbCatalogRanking).setFont(font);
|
||||
FSkin.get(chbCatalogPower).setFont(font);
|
||||
FSkin.get(chbCatalogToughness).setFont(font);
|
||||
FSkin.get(chbCatalogOwned).setFont(font);
|
||||
|
||||
chbDeckStats.setFont(FSkin.getFont(12));
|
||||
chbElasticColumns.setFont(FSkin.getFont(12));
|
||||
FSkin.get(chbDeckColor).setFont(font);
|
||||
FSkin.get(chbDeckRarity).setFont(font);
|
||||
FSkin.get(chbDeckCMC).setFont(font);
|
||||
FSkin.get(chbDeckSet).setFont(font);
|
||||
FSkin.get(chbDeckAI).setFont(font);
|
||||
FSkin.get(chbDeckRanking).setFont(font);
|
||||
FSkin.get(chbDeckPower).setFont(font);
|
||||
FSkin.get(chbDeckToughness).setFont(font);
|
||||
|
||||
FSkin.get(chbDeckStats).setFont(font);
|
||||
FSkin.get(chbElasticColumns).setFont(font);
|
||||
chbDeckStats.setSelected(true);
|
||||
chbElasticColumns.setSelected(false);
|
||||
|
||||
chbCardDisplayUnique.setFont(FSkin.getFont(12));
|
||||
FSkin.get(chbCardDisplayUnique).setFont(font);
|
||||
chbCardDisplayUnique.setSelected(false);
|
||||
|
||||
pnl.add(lblStats, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1");
|
||||
|
||||
@@ -9,8 +9,6 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.deck.DeckBase;
|
||||
import forge.gui.deckeditor.CDeckEditorUI;
|
||||
@@ -66,10 +64,13 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
|
||||
scroller.getViewport().setBorder(null);
|
||||
scroller.getVerticalScrollBar().setUnitIncrement(16);
|
||||
|
||||
lblSampleHand.setBorder(new MatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
lblSampleHand.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
lblRemainingDraws.setBorder(new MatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
lblRemainingDraws.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(lblSampleHand);
|
||||
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
labelSkin = FSkin.get(lblRemainingDraws);
|
||||
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
// Core layout
|
||||
pnlContent.add(lblReshuffle, "w 96%!, h 29px!, gap 2% 0 5px 5px");
|
||||
@@ -188,7 +189,7 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
|
||||
|
||||
if (zebra) {
|
||||
lbl.setOpaque(true);
|
||||
lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
}
|
||||
|
||||
return lbl;
|
||||
|
||||
@@ -2,7 +2,6 @@ package forge.gui.deckeditor.views;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
@@ -15,6 +14,7 @@ import forge.gui.framework.EDocID;
|
||||
import forge.gui.framework.IVDoc;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.gui.toolbox.itemmanager.SItemManagerUtil;
|
||||
|
||||
/**
|
||||
@@ -61,20 +61,13 @@ public enum VStatistics implements IVDoc<CStatistics> {
|
||||
private final JLabel lblSorcery = buildLabel(SItemManagerUtil.StatTypes.SORCERY, true);
|
||||
|
||||
// CMC labels
|
||||
private final JLabel lblCMC0 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_0, 16, 16)), true);
|
||||
private final JLabel lblCMC1 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_1, 16, 16)), false);
|
||||
private final JLabel lblCMC2 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_2, 16, 16)), true);
|
||||
private final JLabel lblCMC3 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_3, 16, 16)), false);
|
||||
private final JLabel lblCMC4 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_4, 16, 16)), true);
|
||||
private final JLabel lblCMC5 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_5, 16, 16)), false);
|
||||
private final JLabel lblCMC6 = buildLabel(
|
||||
new ImageIcon(FSkin.getImage(FSkin.ColorlessManaImages.IMG_6, 16, 16)), true);
|
||||
private final JLabel lblCMC0 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_0, 16, 16), true);
|
||||
private final JLabel lblCMC1 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_1, 16, 16), false);
|
||||
private final JLabel lblCMC2 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_2, 16, 16), true);
|
||||
private final JLabel lblCMC3 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_3, 16, 16), false);
|
||||
private final JLabel lblCMC4 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_4, 16, 16), true);
|
||||
private final JLabel lblCMC5 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_5, 16, 16), false);
|
||||
private final JLabel lblCMC6 = buildLabel(FSkin.getImage(FSkin.ColorlessManaImages.IMG_6, 16, 16), true);
|
||||
|
||||
// Layout containers
|
||||
private final JScrollPane scroller = new JScrollPane(pnlStats);
|
||||
@@ -251,14 +244,14 @@ public enum VStatistics implements IVDoc<CStatistics> {
|
||||
|
||||
//========== Other methods
|
||||
|
||||
private JLabel buildLabel(ImageIcon icon, boolean zebra) {
|
||||
private JLabel buildLabel(SkinImage icon, boolean zebra) {
|
||||
final JLabel lbl = new FLabel.Builder().text("0")
|
||||
.icon(icon).iconScaleAuto(false)
|
||||
.fontSize(11).build();
|
||||
|
||||
if (zebra) {
|
||||
lbl.setOpaque(true);
|
||||
lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
}
|
||||
|
||||
return lbl;
|
||||
|
||||
@@ -44,7 +44,6 @@ import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
@@ -130,8 +129,8 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
||||
radProxySocks.addChangeListener(new ProxyHandler(2));
|
||||
radProxyNone.setSelected(true);
|
||||
|
||||
btnClose.setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT), 1));
|
||||
btnStart.setFont(FSkin.getFont(18));
|
||||
FSkin.get(btnClose).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.get(btnStart).setFont(FSkin.getFont(18));
|
||||
btnStart.setVisible(false);
|
||||
|
||||
barProgress.reset();
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
@@ -21,6 +20,8 @@ import com.google.common.collect.Lists;
|
||||
import forge.Singletons;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.FView;
|
||||
@@ -443,12 +444,12 @@ public final class DragCell extends JPanel implements ILocalRepaint {
|
||||
|
||||
/** Paints dragging handle image the length of the label. */
|
||||
private class DragHandle extends JLabel {
|
||||
private final Image img = FSkin.getImage(FSkin.LayoutImages.IMG_HANDLE);
|
||||
private final int imgW = img.getWidth(null);
|
||||
private final int imgH = img.getHeight(null);
|
||||
private final JLabelSkin<DragHandle> skin;
|
||||
private final SkinImage img = FSkin.getImage(FSkin.LayoutImages.IMG_HANDLE);
|
||||
private boolean hovered = false;
|
||||
|
||||
public DragHandle() {
|
||||
this.skin = FSkin.get(this);
|
||||
this.addMouseListener(SRearrangingUtil.getRearrangeClickEvent());
|
||||
this.addMouseMotionListener(SRearrangingUtil.getRearrangeDragEvent());
|
||||
|
||||
@@ -469,10 +470,14 @@ public final class DragCell extends JPanel implements ILocalRepaint {
|
||||
public void paintComponent(final Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (!hovered) { return; }
|
||||
|
||||
final Dimension imgSize = img.getSizeForPaint(g);
|
||||
final int imgW = imgSize.width;
|
||||
if (imgW < 1) { return; }
|
||||
final int imgH = imgSize.height;
|
||||
|
||||
for (int x = 0; x < getWidth(); x += imgW) {
|
||||
g.drawImage(img, x, ((getHeight() - imgH) / 2), null);
|
||||
skin.drawImage(g, img, x, ((getHeight() - imgH) / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import forge.gui.toolbox.FSkin;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public final class DragTab extends JLabel implements ILocalRepaint {
|
||||
private final FSkin.JLabelSkin<DragTab> skin;
|
||||
private boolean selected = false;
|
||||
private int priority = 10;
|
||||
|
||||
@@ -27,11 +28,12 @@ public final class DragTab extends JLabel implements ILocalRepaint {
|
||||
*/
|
||||
public DragTab(final String title0) {
|
||||
super(title0);
|
||||
skin = FSkin.get(this);
|
||||
setToolTipText(title0);
|
||||
setOpaque(false);
|
||||
setSelected(false);
|
||||
setBorder(new EmptyBorder(2, 5, 2, 5));
|
||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
this.addMouseListener(SRearrangingUtil.getRearrangeClickEvent());
|
||||
this.addMouseMotionListener(SRearrangingUtil.getRearrangeDragEvent());
|
||||
@@ -76,15 +78,15 @@ public final class DragTab extends JLabel implements ILocalRepaint {
|
||||
@Override
|
||||
public void paintComponent(final Graphics g) {
|
||||
if (!selected) {
|
||||
g.setColor(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
skin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() * 2, 6, 6);
|
||||
g.setColor(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
skin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() * 2, 6, 6);
|
||||
}
|
||||
else {
|
||||
g.setColor(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
skin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() * 2, 6, 6);
|
||||
g.setColor(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
skin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() * 2, 6, 6);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package forge.gui.framework;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
@@ -12,10 +10,10 @@ import java.awt.event.MouseMotionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinCursor;
|
||||
import forge.view.FView;
|
||||
|
||||
/**
|
||||
@@ -43,26 +41,20 @@ public final class SRearrangingUtil {
|
||||
private static int tempW;
|
||||
private static int tempH;
|
||||
|
||||
private static JPanel pnlPreview = FView.SINGLETON_INSTANCE.getPnlPreview();
|
||||
private static JLayeredPane pnlDocument = FView.SINGLETON_INSTANCE.getLpnDocument();
|
||||
private static DragCell cellTarget = null;
|
||||
private static DragCell cellSrc = null;
|
||||
private static DragCell cellNew = null;
|
||||
private static Dropzone dropzone = Dropzone.NONE;
|
||||
private static List<IVDoc<? extends ICDoc>> docsToMove = new ArrayList<IVDoc<? extends ICDoc>>();
|
||||
private static IVDoc<? extends ICDoc> srcSelectedDoc = null;
|
||||
private static JPanel pnlPreview = FView.SINGLETON_INSTANCE.getPnlPreview();
|
||||
private static FView.DocumentPane pnlDocument = FView.SINGLETON_INSTANCE.getLpnDocument();
|
||||
private static DragCell cellTarget = null;
|
||||
private static DragCell cellSrc = null;
|
||||
private static DragCell cellNew = null;
|
||||
private static Dropzone dropzone = Dropzone.NONE;
|
||||
private static List<IVDoc<? extends ICDoc>> docsToMove = new ArrayList<IVDoc<? extends ICDoc>>();
|
||||
private static IVDoc<? extends ICDoc> srcSelectedDoc = null;
|
||||
|
||||
private static final Toolkit TOOLS = Toolkit.getDefaultToolkit();
|
||||
private static final Cursor CUR_L = TOOLS.createCustomCursor(
|
||||
FSkin.getImage(FSkin.LayoutImages.IMG_CUR_L), new Point(16, 16), "CUR_L");
|
||||
private static final Cursor CUR_T = TOOLS.createCustomCursor(
|
||||
FSkin.getImage(FSkin.LayoutImages.IMG_CUR_T), new Point(16, 16), "CUR_T");
|
||||
private static final Cursor CUR_B = TOOLS.createCustomCursor(
|
||||
FSkin.getImage(FSkin.LayoutImages.IMG_CUR_B), new Point(16, 16), "CUR_B");
|
||||
private static final Cursor CUR_R = TOOLS.createCustomCursor(
|
||||
FSkin.getImage(FSkin.LayoutImages.IMG_CUR_R), new Point(16, 16), "CUR_R");
|
||||
private static final Cursor CUR_TAB = TOOLS.createCustomCursor(
|
||||
FSkin.getImage(FSkin.LayoutImages.IMG_CUR_TAB), new Point(16, 16), "CUR_TAB");
|
||||
private static final SkinCursor CUR_L = FSkin.getCursor(FSkin.LayoutImages.IMG_CUR_L, 16, 16, "CUR_L");
|
||||
private static final SkinCursor CUR_T = FSkin.getCursor(FSkin.LayoutImages.IMG_CUR_T, 16, 16, "CUR_T");
|
||||
private static final SkinCursor CUR_B = FSkin.getCursor(FSkin.LayoutImages.IMG_CUR_B, 16, 16, "CUR_B");
|
||||
private static final SkinCursor CUR_R = FSkin.getCursor(FSkin.LayoutImages.IMG_CUR_R, 16, 16, "CUR_R");
|
||||
private static final SkinCursor CUR_TAB = FSkin.getCursor(FSkin.LayoutImages.IMG_CUR_TAB, 16, 16, "CUR_TAB");
|
||||
|
||||
private static final MouseListener MAD_REARRANGE = new MouseAdapter() {
|
||||
@Override
|
||||
|
||||
@@ -114,7 +114,6 @@ public enum CHomeUI implements ICDoc, IMenuProvider {
|
||||
|
||||
private void setupMyMenuBar() {
|
||||
Singletons.getControl().getMenuBar().setupMenuBar(this);
|
||||
Singletons.getControl().getMenuBar().setStatusText("F1 : hide menu");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package forge.gui.home;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -14,6 +12,8 @@ import javax.swing.JLabel;
|
||||
import forge.Singletons;
|
||||
import forge.gui.framework.ILocalRepaint;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
/**
|
||||
@@ -28,12 +28,13 @@ public class LblGroup extends JLabel implements ILocalRepaint {
|
||||
|
||||
private boolean hovered = false;
|
||||
|
||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final Color l20 = FSkin.stepColor(clrTheme, 20);
|
||||
private final Color l25 = FSkin.stepColor(clrTheme, 25);
|
||||
private final Color l40 = FSkin.stepColor(clrTheme, 40);
|
||||
private final Color d20 = FSkin.stepColor(clrTheme, -20);
|
||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
||||
private final JLabelSkin<LblGroup> skin;
|
||||
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final SkinColor l20 = clrTheme.stepColor(20);
|
||||
private final SkinColor l25 = clrTheme.stepColor(25);
|
||||
private final SkinColor l40 = clrTheme.stepColor(40);
|
||||
private final SkinColor d20 = clrTheme.stepColor(-20);
|
||||
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||
|
||||
/**
|
||||
* Custom JLabel for title of menu item groups.
|
||||
@@ -44,9 +45,10 @@ public class LblGroup extends JLabel implements ILocalRepaint {
|
||||
public LblGroup(final EMenuGroup e0) {
|
||||
|
||||
super(" " + e0.getTitle());
|
||||
|
||||
this.setFont(FSkin.getBoldFont(14));
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
skin = FSkin.get(this);
|
||||
skin.setFont(FSkin.getBoldFont(14));
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
@@ -128,16 +130,15 @@ public class LblGroup extends JLabel implements ILocalRepaint {
|
||||
int w = getWidth();
|
||||
int h = getHeight();
|
||||
|
||||
g.setColor(l20);
|
||||
skin.setGraphicsColor(g, l20);
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
GradientPaint edge = new GradientPaint(w - 10, 0, l25, w, 0, d80, false);
|
||||
g2d.setPaint(edge);
|
||||
skin.setGraphicsGradientPaint(g2d, w - 10, 0, l25, w, 0, d80);
|
||||
g2d.fillRect(w - 10, 0, w, h);
|
||||
|
||||
g2d.setColor(l40);
|
||||
skin.setGraphicsColor(g, l40);
|
||||
g2d.drawLine(0, 0, w - 6, 0);
|
||||
g2d.setColor(d20);
|
||||
skin.setGraphicsColor(g, d20);
|
||||
g2d.drawLine(0, h - 1, w - 6, h - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.gui.home;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
@@ -8,16 +7,19 @@ import javax.swing.JLabel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
|
||||
/**
|
||||
* Standardized header label for top of menu display panel.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LblHeader extends JLabel {
|
||||
private final Color clr = FSkin.stepColor(FSkin.getColor(FSkin.Colors.CLR_THEME), 0);
|
||||
private final Color a100 = FSkin.alphaColor(clr, 100);
|
||||
private final Color d40 = FSkin.stepColor(clr, -40);
|
||||
private final Color d80 = FSkin.stepColor(clr, -80);
|
||||
private final JLabelSkin<LblHeader> skin;
|
||||
private final SkinColor clr = FSkin.getColor(FSkin.Colors.CLR_THEME).stepColor(0);
|
||||
private final SkinColor a100 = clr.alphaColor(100);
|
||||
private final SkinColor d40 = clr.stepColor(-40);
|
||||
private final SkinColor d80 = clr.stepColor(-80);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -25,8 +27,9 @@ public class LblHeader extends JLabel {
|
||||
*/
|
||||
public LblHeader(final String txt0) {
|
||||
super(txt0);
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setFont(FSkin.getFont(18));
|
||||
skin = FSkin.get(this);
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setFont(FSkin.getFont(18));
|
||||
this.setBorder(new EmptyBorder(5, 30, 0, 0));
|
||||
}
|
||||
|
||||
@@ -36,13 +39,13 @@ public class LblHeader extends JLabel {
|
||||
int w = getWidth();
|
||||
int h = getHeight();
|
||||
|
||||
g2d.setColor(d80);
|
||||
skin.setGraphicsColor(g2d, d80);
|
||||
g2d.fillRect(0, 5, w, h - 5);
|
||||
|
||||
g2d.setColor(a100);
|
||||
skin.setGraphicsColor(g2d, a100);
|
||||
g2d.fillRect(5, 0, w - 5, h - 5);
|
||||
|
||||
g2d.setColor(d40);
|
||||
skin.setGraphicsColor(g2d, d40);
|
||||
g2d.drawRect(5, 0, w - 6, h - 6);
|
||||
|
||||
super.paintComponent(g);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package forge.gui.home;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -13,6 +11,8 @@ import javax.swing.JLabel;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.framework.ILocalRepaint;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
|
||||
/**
|
||||
* Custom JLabel for an item in the menu. Handles listening
|
||||
@@ -24,14 +24,14 @@ public class LblMenuItem extends JLabel implements ILocalRepaint {
|
||||
private boolean selected = false;
|
||||
private boolean hovered = false;
|
||||
|
||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final Color l00 = FSkin.stepColor(clrTheme, 0);
|
||||
private final Color l20 = FSkin.stepColor(clrTheme, 20);
|
||||
private final Color d20 = FSkin.stepColor(clrTheme, -20);
|
||||
private final Color d60 = FSkin.stepColor(clrTheme, -60);
|
||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
||||
|
||||
private final GradientPaint edge = new GradientPaint(200 - 8, 0, l00, 200, 0, d80, false);
|
||||
private final JLabelSkin<LblMenuItem> skin;
|
||||
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final SkinColor l00 = clrTheme.stepColor(0);
|
||||
private final SkinColor l20 = clrTheme.stepColor(20);
|
||||
private final SkinColor d20 = clrTheme.stepColor(-20);
|
||||
private final SkinColor d60 = clrTheme.stepColor(-60);
|
||||
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||
private final SkinColor alpha100 = l00.alphaColor(100);
|
||||
|
||||
/**
|
||||
* Custom JLabel for an item in the menu. Handles listening
|
||||
@@ -41,8 +41,10 @@ public class LblMenuItem extends JLabel implements ILocalRepaint {
|
||||
*/
|
||||
public LblMenuItem(final IVSubmenu<? extends ICDoc> doc0) {
|
||||
super(" " + doc0.getMenuTitle());
|
||||
this.setFont(FSkin.getFont(14));
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
skin = FSkin.get(this);
|
||||
skin.setFont(FSkin.getFont(14));
|
||||
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
@@ -82,23 +84,23 @@ public class LblMenuItem extends JLabel implements ILocalRepaint {
|
||||
int h = getHeight();
|
||||
|
||||
if (this.selected) {
|
||||
g2d.setColor(FSkin.alphaColor(l00, 100));
|
||||
skin.setGraphicsColor(g2d, alpha100);
|
||||
g2d.fillRect(0, 0, w, h);
|
||||
g2d.setColor(d20);
|
||||
skin.setGraphicsColor(g2d, d20);
|
||||
g2d.drawLine(0, 0, w - 3, 0);
|
||||
g2d.setColor(l20);
|
||||
skin.setGraphicsColor(g2d, l20);
|
||||
g2d.drawLine(0, h - 1, w - 3, h - 1);
|
||||
}
|
||||
else if (this.hovered) {
|
||||
g2d.setColor(d60);
|
||||
skin.setGraphicsColor(g2d, d60);
|
||||
g2d.fillRect(0, 0, getWidth(), h);
|
||||
|
||||
g2d.setPaint(edge);
|
||||
skin.setGraphicsGradientPaint(g2d, 200 - 8, 0, l00, 200, 0, d80);
|
||||
g2d.fillRect(w - 2, 0, w, h);
|
||||
|
||||
g2d.setColor(d20);
|
||||
skin.setGraphicsColor(g2d, d20);
|
||||
g2d.drawLine(0, 0, w - 3, 0);
|
||||
g2d.setColor(l20);
|
||||
skin.setGraphicsColor(g2d, l20);
|
||||
g2d.drawLine(0, h - 1, w - 3, h - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forge.gui.home;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
@@ -10,6 +8,8 @@ import javax.swing.JPanel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
|
||||
/**
|
||||
* Custom JPanel for containing LblMenuItem components.
|
||||
@@ -17,20 +17,22 @@ import forge.gui.toolbox.FSkin;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PnlGroup extends JPanel {
|
||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final Color l00 = FSkin.stepColor(clrTheme, 0);
|
||||
private final Color l10 = FSkin.stepColor(clrTheme, 10);
|
||||
private final Color d20 = FSkin.stepColor(clrTheme, -20);
|
||||
private final Color d60 = FSkin.stepColor(clrTheme, -60);
|
||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
||||
private final JComponentSkin<PnlGroup> skin;
|
||||
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final SkinColor l00 = clrTheme.stepColor(0);
|
||||
private final SkinColor l10 = clrTheme.stepColor(10);
|
||||
private final SkinColor d20 = clrTheme.stepColor(-20);
|
||||
private final SkinColor d60 = clrTheme.stepColor(-60);
|
||||
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||
|
||||
/**
|
||||
* Custom JPanel for containing LblMenuItem components.
|
||||
* Mostly just handles repainting.
|
||||
*/
|
||||
public PnlGroup() {
|
||||
this.skin = FSkin.get(this);
|
||||
this.setLayout(new MigLayout("insets 10px 0 10px 0, gap 0, wrap"));
|
||||
this.setBackground(d20);
|
||||
this.skin.setBackground(d20);
|
||||
this.setOpaque(false);
|
||||
}
|
||||
|
||||
@@ -44,15 +46,14 @@ public class PnlGroup extends JPanel {
|
||||
final int w = getWidth();
|
||||
final int h = getHeight();
|
||||
|
||||
g2d.setColor(d20);
|
||||
skin.setGraphicsColor(g2d, d20);
|
||||
|
||||
// Selected in this group, don't draw background under selected label.
|
||||
if (getY() < yTop && yTop < getY() + h) {
|
||||
g2d.fillRect(0, 0, w, lbl.getY());
|
||||
g2d.fillRect(0, lbl.getY() + lbl.getHeight(), w, h);
|
||||
|
||||
GradientPaint edge = new GradientPaint(w - 8, 0, l00, w, 0, d80, false);
|
||||
g2d.setPaint(edge);
|
||||
skin.setGraphicsGradientPaint(g2d, w - 8, 0, l00, w, 0, d80);
|
||||
g2d.fillRect(w - 6, 0, w, lbl.getY());
|
||||
g2d.fillRect(w - 6, lbl.getY() + lbl.getHeight(), w, h);
|
||||
}
|
||||
@@ -60,15 +61,14 @@ public class PnlGroup extends JPanel {
|
||||
else {
|
||||
g2d.fillRect(0, 0, w, h);
|
||||
|
||||
GradientPaint edge = new GradientPaint(w - 8, 0, l00, w, 0, d80, false);
|
||||
g2d.setPaint(edge);
|
||||
skin.setGraphicsGradientPaint(g2d, w - 8, 0, l00, w, 0, d80);
|
||||
g2d.fillRect(w - 6, 0, w, h);
|
||||
}
|
||||
|
||||
g2d.setColor(l10);
|
||||
skin.setGraphicsColor(g2d, l10);
|
||||
g2d.drawLine(0, h - 1, w - 1, h - 1);
|
||||
|
||||
g2d.setColor(d60);
|
||||
skin.setGraphicsColor(g2d, d60);
|
||||
g2d.drawLine(0, 0, w - 1, 0);
|
||||
|
||||
g2d.dispose();
|
||||
|
||||
@@ -13,24 +13,25 @@ import forge.gui.toolbox.FSkin;
|
||||
@SuppressWarnings("serial")
|
||||
public class StartButton extends JButton {
|
||||
public StartButton() {
|
||||
final FSkin.AbstractButtonSkin<StartButton> skin = FSkin.get(this);
|
||||
setOpaque(false);
|
||||
setContentAreaFilled(false);
|
||||
setBorder(null);
|
||||
setBorderPainted(false);
|
||||
setRolloverEnabled(true);
|
||||
setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
||||
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
|
||||
setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN));
|
||||
skin.setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
||||
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
|
||||
skin.setPressedIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_DOWN));
|
||||
|
||||
addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
|
||||
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_UP));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
||||
skin.setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
*/
|
||||
package forge.gui.home;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.ArrayList;
|
||||
@@ -63,6 +61,8 @@ import forge.gui.home.variant.VSubmenuVanguard;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPanel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.FView;
|
||||
@@ -79,8 +79,8 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
/** */
|
||||
SINGLETON_INSTANCE;
|
||||
|
||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final Color l00 = FSkin.stepColor(clrTheme, 0);
|
||||
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||
private final SkinColor l00 = clrTheme.stepColor(0);
|
||||
|
||||
private final List<IVSubmenu<? extends ICDoc>> allSubmenus = new ArrayList<IVSubmenu<? extends ICDoc>>();
|
||||
private final Map<EDocID, LblMenuItem> allSubmenuLabels = new HashMap<EDocID, LblMenuItem>();
|
||||
@@ -191,7 +191,7 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
}
|
||||
|
||||
pnlMenu.add(pnlSubmenus, "w 100%!, h 100% - " + pnlMainMenuHeight + "px!");
|
||||
pnlDisplay.setBackground(FSkin.alphaColor(l00, 100));
|
||||
FSkin.get(pnlDisplay).setBackground(l00.alphaColor(100));
|
||||
}
|
||||
|
||||
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
|
||||
@@ -258,8 +258,11 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
|
||||
/** */
|
||||
public class PnlDisplay extends JPanel implements ILocalRepaint {
|
||||
private final JComponentSkin<PnlDisplay> skin;
|
||||
|
||||
/** Constructor. */
|
||||
public PnlDisplay() {
|
||||
this.skin = FSkin.get(this);
|
||||
this.setOpaque(false);
|
||||
}
|
||||
|
||||
@@ -274,7 +277,7 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
super.paintComponent(g);
|
||||
final Graphics2D g2d = (Graphics2D) g.create();
|
||||
|
||||
g2d.setColor(this.getBackground());
|
||||
skin.setGraphicsColor(g2d, skin.getBackground());
|
||||
g2d.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
g2d.dispose();
|
||||
@@ -282,9 +285,11 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
}
|
||||
|
||||
private class PnlMenu extends JPanel {
|
||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
||||
private final JComponentSkin<PnlMenu> skin;
|
||||
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||
|
||||
public PnlMenu() {
|
||||
this.skin = FSkin.get(this);
|
||||
this.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
||||
this.setOpaque(false);
|
||||
}
|
||||
@@ -316,15 +321,14 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
}
|
||||
}
|
||||
|
||||
g2d.setColor(l00);
|
||||
skin.setGraphicsColor(g2d, l00);
|
||||
g2d.fillRect(0, y1, w, h1);
|
||||
if (h2 > 0) {
|
||||
g2d.fillRect(0, y2, w, h2);
|
||||
}
|
||||
|
||||
int x = w - 8;
|
||||
GradientPaint edge = new GradientPaint(x, 0, l00, w, 0, d80, false);
|
||||
g2d.setPaint(edge);
|
||||
skin.setGraphicsGradientPaint(g2d, x, 0, l00, w, 0, d80);
|
||||
g2d.fillRect(x, y1, w, h1);
|
||||
if (h2 > 0) {
|
||||
g2d.fillRect(x, y2, w, h2);
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.List;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Command;
|
||||
import forge.gauntlet.GauntletData;
|
||||
@@ -30,7 +28,8 @@ public class ContestGauntletLister extends JPanel {
|
||||
private RowPanel previousSelect;
|
||||
private RowPanel[] rows;
|
||||
private Command cmdRowSelect;
|
||||
private final Color clrDefault, clrHover, clrActive, clrBorders;
|
||||
private final Color clrDefault;
|
||||
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
|
||||
|
||||
/** */
|
||||
public ContestGauntletLister() {
|
||||
@@ -61,7 +60,7 @@ public class ContestGauntletLister extends JPanel {
|
||||
// Note: careful with the widths of the rows here;
|
||||
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
||||
final JPanel rowTitle = new JPanel();
|
||||
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
rowTitle.add(new FLabel.Builder().build(),
|
||||
"w 30px!, h 20px!, gap 1% 0 5px 0");
|
||||
@@ -129,21 +128,21 @@ public class ContestGauntletLister extends JPanel {
|
||||
setOpaque(false);
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
setLayout(new MigLayout("insets 0, gap 0"));
|
||||
setBorder(new MatteBorder(0, 0, 1, 0, clrBorders));
|
||||
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
|
||||
gauntletData = gd0;
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (!selected) {
|
||||
((RowPanel) e.getSource()).setBackground(clrHover);
|
||||
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
|
||||
((RowPanel) e.getSource()).setOpaque(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (!selected) {
|
||||
((RowPanel) e.getSource()).setBackground(clrDefault);
|
||||
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
|
||||
((RowPanel) e.getSource()).setOpaque(false);
|
||||
}
|
||||
}
|
||||
@@ -157,7 +156,7 @@ public class ContestGauntletLister extends JPanel {
|
||||
public void setSelected(boolean b0) {
|
||||
selected = b0;
|
||||
setOpaque(b0);
|
||||
setBackground(b0 ? clrActive : clrHover);
|
||||
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
|
||||
@@ -11,12 +11,10 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Command;
|
||||
@@ -24,6 +22,7 @@ import forge.gauntlet.GauntletData;
|
||||
import forge.gauntlet.GauntletIO;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinIcon;
|
||||
|
||||
/**
|
||||
* Creates file list/table for quick deleting, editing, and basic info.
|
||||
@@ -31,11 +30,12 @@ import forge.gui.toolbox.FSkin;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class QuickGauntletLister extends JPanel {
|
||||
private ImageIcon icoDelete, icoDeleteOver;
|
||||
private SkinIcon icoDelete, icoDeleteOver;
|
||||
private RowPanel previousSelect;
|
||||
private RowPanel[] rows;
|
||||
private Command cmdRowSelect, cmdRowDelete;
|
||||
private final Color clrDefault, clrHover, clrActive, clrBorders;
|
||||
private final Color clrDefault;
|
||||
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
|
||||
|
||||
/** */
|
||||
public QuickGauntletLister() {
|
||||
@@ -70,7 +70,7 @@ public class QuickGauntletLister extends JPanel {
|
||||
// Note: careful with the widths of the rows here;
|
||||
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
||||
final JPanel rowTitle = new JPanel();
|
||||
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
rowTitle.add(new FLabel.Builder().build(),
|
||||
"w 30px!, h 20px!, gap 1% 0 5px 0");
|
||||
@@ -126,10 +126,11 @@ public class QuickGauntletLister extends JPanel {
|
||||
private class DeleteButton extends JButton {
|
||||
public DeleteButton(final RowPanel r0) {
|
||||
super();
|
||||
FSkin.AbstractButtonSkin<DeleteButton> skin = FSkin.get(this);
|
||||
setRolloverEnabled(true);
|
||||
setPressedIcon(icoDeleteOver);
|
||||
setRolloverIcon(icoDeleteOver);
|
||||
setIcon(icoDelete);
|
||||
skin.setPressedIcon(icoDeleteOver);
|
||||
skin.setRolloverIcon(icoDeleteOver);
|
||||
skin.setIcon(icoDelete);
|
||||
setOpaque(false);
|
||||
setContentAreaFilled(false);
|
||||
setBorder(null);
|
||||
@@ -140,14 +141,14 @@ public class QuickGauntletLister extends JPanel {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (!r0.selected) {
|
||||
r0.setBackground(clrHover);
|
||||
FSkin.get(r0).setBackground(clrHover);
|
||||
r0.setOpaque(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (!r0.selected) {
|
||||
r0.setBackground(clrDefault);
|
||||
FSkin.get(r0).setBackground(clrDefault);
|
||||
r0.setOpaque(false);
|
||||
}
|
||||
}
|
||||
@@ -168,21 +169,21 @@ public class QuickGauntletLister extends JPanel {
|
||||
setOpaque(false);
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
setLayout(new MigLayout("insets 0, gap 0"));
|
||||
setBorder(new MatteBorder(0, 0, 1, 0, clrBorders));
|
||||
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
|
||||
gauntletData = gd0;
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (!selected) {
|
||||
((RowPanel) e.getSource()).setBackground(clrHover);
|
||||
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
|
||||
((RowPanel) e.getSource()).setOpaque(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (!selected) {
|
||||
((RowPanel) e.getSource()).setBackground(clrDefault);
|
||||
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
|
||||
((RowPanel) e.getSource()).setOpaque(false);
|
||||
}
|
||||
}
|
||||
@@ -196,7 +197,7 @@ public class QuickGauntletLister extends JPanel {
|
||||
public void setSelected(boolean b0) {
|
||||
selected = b0;
|
||||
setOpaque(b0);
|
||||
setBackground(b0 ? clrActive : clrHover);
|
||||
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
|
||||
@@ -2,7 +2,6 @@ package forge.gui.home.gauntlet;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
@@ -74,22 +73,22 @@ public enum VSubmenuGauntletBuild implements IVSubmenu<CSubmenuGauntletBuild> {
|
||||
private final FLabel btnUp = new FLabel.Builder()
|
||||
.tooltip("Move this deck up in the gauntlet").hoverable(true)
|
||||
.iconScaleAuto(true).iconScaleFactor(1.0)
|
||||
.icon(new ImageIcon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_T))).build();
|
||||
.icon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_T)).build();
|
||||
|
||||
private final FLabel btnDown = new FLabel.Builder()
|
||||
.tooltip("Move this deck down in the gauntlet").hoverable(true)
|
||||
.iconScaleAuto(true).iconScaleFactor(1.0)
|
||||
.icon(new ImageIcon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_B))).build();
|
||||
.icon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_B)).build();
|
||||
|
||||
private final FLabel btnRight = new FLabel.Builder()
|
||||
.tooltip("Add this deck to the gauntlet").hoverable(true)
|
||||
.iconScaleAuto(true).iconScaleFactor(1.0)
|
||||
.icon(new ImageIcon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_R))).build();
|
||||
.icon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_R)).build();
|
||||
|
||||
private final FLabel btnLeft = new FLabel.Builder()
|
||||
.tooltip("Remove this deck from the gauntlet").hoverable(true)
|
||||
.iconScaleAuto(true).iconScaleFactor(1.0)
|
||||
.icon(new ImageIcon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_L))).build();
|
||||
.icon(FSkin.getImage(FSkin.LayoutImages.IMG_CUR_L)).build();
|
||||
|
||||
private final FLabel btnSave = new FLabel.Builder()
|
||||
.fontSize(14)
|
||||
@@ -116,7 +115,7 @@ public enum VSubmenuGauntletBuild implements IVSubmenu<CSubmenuGauntletBuild> {
|
||||
.text(" ").hoverable(true).build();
|
||||
|
||||
private VSubmenuGauntletBuild() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
|
||||
// File handling panel
|
||||
|
||||
@@ -59,11 +59,11 @@ public enum VSubmenuGauntletContests implements IVSubmenu<CSubmenuGauntletContes
|
||||
.text("A gauntlet that has been started will keep the same deck until it is finished.").build();
|
||||
|
||||
private VSubmenuGauntletContests() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
|
||||
pnlLoad.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||
pnlLoad.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlLoad).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnlLoad.add(lblLoad, "h 30px!, w 94%!, gap 1% 0 0 5px, ax center");
|
||||
// pnlLoad.add(new FLabel.Builder().text("If a gauntlet has been started, its deck is frozen.").build(),
|
||||
// "gap 0 0 0 5px, ax center");
|
||||
|
||||
@@ -47,7 +47,7 @@ public enum VSubmenuGauntletLoad implements IVSubmenu<CSubmenuGauntletLoad> {
|
||||
private final StartButton btnStart = new StartButton();
|
||||
|
||||
private VSubmenuGauntletLoad() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
scrLoad.setBorder(null);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
import forge.gui.toolbox.special.FDeckChooser;
|
||||
|
||||
/**
|
||||
@@ -81,30 +82,28 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
||||
private final StartButton btnStart = new StartButton();
|
||||
|
||||
private VSubmenuGauntletQuick() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
boxUserDecks.setSelected(true);
|
||||
boxQuestDecks.setSelected(true);
|
||||
boxThemeDecks.setSelected(true);
|
||||
boxColorDecks.setSelected(true);
|
||||
|
||||
|
||||
JComponentSkin<JSlider> sliOpponentsSkin = FSkin.get(sliOpponents);
|
||||
sliOpponents.setMajorTickSpacing(5);
|
||||
sliOpponents.setMinorTickSpacing(0);
|
||||
sliOpponents.setPaintTicks(false);
|
||||
sliOpponents.setPaintLabels(true);
|
||||
sliOpponents.setSnapToTicks(true);
|
||||
sliOpponents.setOpaque(false);
|
||||
sliOpponents.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
sliOpponents.setFont(FSkin.getFont(12));
|
||||
|
||||
|
||||
sliOpponentsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
sliOpponentsSkin.setFont(FSkin.getFont(12));
|
||||
|
||||
scrLoad.setOpaque(false);
|
||||
scrLoad.getViewport().setOpaque(false);
|
||||
scrLoad.setBorder(null);
|
||||
|
||||
pnlOptions.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlOptions).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnlOptions.add(lblOptions, "h 30px!, w 96%!, gap 2% 0 0 5px");
|
||||
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
|
||||
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package forge.gui.home.quest;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
|
||||
/** Dictates methods required for a panel with stats/pet display. */
|
||||
@@ -45,8 +45,8 @@ public interface IVQuestStats {
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
JLabel getLblWinStreak();
|
||||
|
||||
/** @return {@link javax.swing.JComboBox} */
|
||||
JComboBox<String> getCbxPet();
|
||||
/** @return {@link javax.swing.FComboBoxWrapper} */
|
||||
FComboBoxWrapper<String> getCbxPet();
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
JCheckBox getCbPlant();
|
||||
|
||||
@@ -2,10 +2,10 @@ package forge.gui.home.quest;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
@@ -17,6 +17,9 @@ import net.miginfocom.swing.MigLayout;
|
||||
import forge.ImageCache;
|
||||
import forge.gui.toolbox.FRadioButton;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.gui.toolbox.FTextArea;
|
||||
import forge.quest.QuestEvent;
|
||||
|
||||
@@ -29,16 +32,16 @@ import forge.quest.QuestEvent;
|
||||
class PnlEvent extends JPanel {
|
||||
private final QuestEvent event;
|
||||
private final JRadioButton rad;
|
||||
private final Image img;
|
||||
private final int wSrc, hSrc;
|
||||
private final SkinImage img;
|
||||
|
||||
private final int wImg = 100;
|
||||
private final int hImg = 100;
|
||||
private final int hRfl = 20;
|
||||
|
||||
private final JComponentSkin<PnlEvent> skin;
|
||||
private final Color clr1 = new Color(255, 0, 255, 100);
|
||||
private final Color clr2 = new Color(255, 255, 0, 0);
|
||||
private final Color clr3 = FSkin.alphaColor(FSkin.getColor(FSkin.Colors.CLR_THEME2), 200);
|
||||
private final SkinColor clr3 = FSkin.getColor(FSkin.Colors.CLR_THEME2).alphaColor(200);
|
||||
|
||||
/**
|
||||
* Panels for displaying duels and challenges.<br>
|
||||
@@ -49,19 +52,17 @@ class PnlEvent extends JPanel {
|
||||
*/
|
||||
public PnlEvent(final QuestEvent e0) {
|
||||
super();
|
||||
this.skin = FSkin.get(this);
|
||||
this.event = e0;
|
||||
img = ImageCache.getIcon(e0).getImage();
|
||||
|
||||
wSrc = img.getWidth(null);
|
||||
hSrc = img.getHeight(null);
|
||||
img = ImageCache.getIcon(e0);
|
||||
|
||||
// Title and description
|
||||
this.rad = new FRadioButton(event.getTitle() + " (" + event.getDifficulty().getTitle() + ")");
|
||||
this.rad.setFont(FSkin.getBoldFont(16));
|
||||
FSkin.get(this.rad).setFont(FSkin.getBoldFont(16));
|
||||
|
||||
final FTextArea tarDesc = new FTextArea();
|
||||
tarDesc.setText(event.getDescription());
|
||||
tarDesc.setFont(FSkin.getItalicFont(12));
|
||||
FSkin.get(tarDesc).setFont(FSkin.getItalicFont(12));
|
||||
|
||||
// Change listener for radio button
|
||||
this.rad.addChangeListener(new ChangeListener() {
|
||||
@@ -93,16 +94,19 @@ class PnlEvent extends JPanel {
|
||||
@Override
|
||||
public void paintComponent(final Graphics g) {
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
g2d.setPaint(new GradientPaint(0, 0, clr3, getWidth(), 0, clr2));
|
||||
skin.setGraphicsGradientPaint(g2d, 0, 0, clr3, getWidth(), 0, clr2);
|
||||
g2d.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
// Padding here
|
||||
g2d.translate(5, 5);
|
||||
|
||||
Dimension srcSize = img.getSizeForPaint(g2d);
|
||||
int wSrc = srcSize.width;
|
||||
int hSrc = srcSize.height;
|
||||
|
||||
g2d.drawImage(img,
|
||||
skin.drawImage(g2d, img,
|
||||
0, 0, wImg, hImg, // Destination
|
||||
0, 0, wSrc, hSrc, // Source
|
||||
null);
|
||||
0, 0, wSrc, hSrc); // Source
|
||||
|
||||
// Gap between image and reflection set here
|
||||
g2d.translate(0, hImg + 2);
|
||||
@@ -111,10 +115,9 @@ class PnlEvent extends JPanel {
|
||||
BufferedImage refl = new BufferedImage(wImg, hImg, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D gRefl = refl.createGraphics();
|
||||
|
||||
gRefl.drawImage(img,
|
||||
skin.drawImage(gRefl, img,
|
||||
0, hRfl, wImg, 0, // Destination
|
||||
0, hSrc - hRfl * hSrc / hImg, wSrc, hSrc, // Source
|
||||
null);
|
||||
0, hSrc - hRfl * hSrc / hImg, wSrc, hSrc); // Source
|
||||
|
||||
gRefl.setPaint(new GradientPaint(0, 0, clr1, 0, hRfl, clr2));
|
||||
gRefl.setComposite(AlphaComposite.DstIn);
|
||||
|
||||
@@ -9,13 +9,10 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Command;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
@@ -29,11 +26,12 @@ import forge.quest.data.QuestData;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class QuestFileLister extends JPanel {
|
||||
private ImageIcon icoDelete, icoDeleteOver, icoEdit, icoEditOver;
|
||||
private FSkin.SkinIcon icoDelete, icoDeleteOver, icoEdit, icoEditOver;
|
||||
private RowPanel previousSelect;
|
||||
private RowPanel[] rows;
|
||||
private Command cmdRowSelect, cmdRowDelete, cmdRowEdit;
|
||||
private final Color clrDefault, clrHover, clrActive, clrBorders;
|
||||
private final Color clrDefault;
|
||||
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
|
||||
|
||||
/** */
|
||||
public QuestFileLister() {
|
||||
@@ -81,7 +79,7 @@ public class QuestFileLister extends JPanel {
|
||||
// Note: careful with the widths of the rows here;
|
||||
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
||||
final JPanel rowTitle = new JPanel();
|
||||
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
rowTitle.add(new FLabel.Builder().text("Rename").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||
@@ -117,10 +115,11 @@ public class QuestFileLister extends JPanel {
|
||||
private class DeleteButton extends JButton {
|
||||
public DeleteButton(final RowPanel r0) {
|
||||
super();
|
||||
FSkin.AbstractButtonSkin<DeleteButton> skin = FSkin.get(this);
|
||||
setRolloverEnabled(true);
|
||||
setPressedIcon(icoDeleteOver);
|
||||
setRolloverIcon(icoDeleteOver);
|
||||
setIcon(icoDelete);
|
||||
skin.setPressedIcon(icoDeleteOver);
|
||||
skin.setRolloverIcon(icoDeleteOver);
|
||||
skin.setIcon(icoDelete);
|
||||
setOpaque(false);
|
||||
setContentAreaFilled(false);
|
||||
setBorder(null);
|
||||
@@ -131,14 +130,14 @@ public class QuestFileLister extends JPanel {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (!r0.selected) {
|
||||
r0.setBackground(clrHover);
|
||||
FSkin.get(r0).setBackground(clrHover);
|
||||
r0.setOpaque(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (!r0.selected) {
|
||||
r0.setBackground(clrDefault);
|
||||
FSkin.get(r0).setBackground(clrDefault);
|
||||
r0.setOpaque(false);
|
||||
}
|
||||
}
|
||||
@@ -153,10 +152,11 @@ public class QuestFileLister extends JPanel {
|
||||
private class EditButton extends JButton {
|
||||
public EditButton(final RowPanel r0) {
|
||||
super();
|
||||
FSkin.AbstractButtonSkin<EditButton> skin = FSkin.get(this);
|
||||
setRolloverEnabled(true);
|
||||
setPressedIcon(icoEditOver);
|
||||
setRolloverIcon(icoEditOver);
|
||||
setIcon(icoEdit);
|
||||
skin.setPressedIcon(icoEditOver);
|
||||
skin.setRolloverIcon(icoEditOver);
|
||||
skin.setIcon(icoEdit);
|
||||
setOpaque(false);
|
||||
setContentAreaFilled(false);
|
||||
setBorder(null);
|
||||
@@ -167,14 +167,14 @@ public class QuestFileLister extends JPanel {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (!r0.selected) {
|
||||
r0.setBackground(clrHover);
|
||||
FSkin.get(r0).setBackground(clrHover);
|
||||
r0.setOpaque(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (!r0.selected) {
|
||||
r0.setBackground(clrDefault);
|
||||
FSkin.get(r0).setBackground(clrDefault);
|
||||
r0.setOpaque(false);
|
||||
}
|
||||
}
|
||||
@@ -195,21 +195,21 @@ public class QuestFileLister extends JPanel {
|
||||
setOpaque(false);
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
setLayout(new MigLayout("insets 0, gap 0"));
|
||||
setBorder(new MatteBorder(0, 0, 1, 0, clrBorders));
|
||||
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
|
||||
questData = qd0;
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (!selected) {
|
||||
((RowPanel) e.getSource()).setBackground(clrHover);
|
||||
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
|
||||
((RowPanel) e.getSource()).setOpaque(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (!selected) {
|
||||
((RowPanel) e.getSource()).setBackground(clrDefault);
|
||||
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
|
||||
((RowPanel) e.getSource()).setOpaque(false);
|
||||
}
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public class QuestFileLister extends JPanel {
|
||||
public void setSelected(boolean b0) {
|
||||
selected = b0;
|
||||
setOpaque(b0);
|
||||
setBackground(b0 ? clrActive : clrHover);
|
||||
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.awt.event.FocusEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
@@ -16,6 +15,7 @@ import net.miginfocom.swing.MigLayout;
|
||||
import forge.Singletons;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||
import forge.quest.data.QuestPreferences;
|
||||
import forge.quest.data.QuestPreferences.QPref;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
pnlRewards.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
|
||||
pnlRewards.add(new FLabel.Builder().text("Rewards")
|
||||
.icon(new ImageIcon("res/images/icons/CoinIcon.png")).build(),
|
||||
.icon(new FSkin.UnskinnedIcon("res/images/icons/CoinIcon.png")).build(),
|
||||
"w 100%!, h 30px!, span 2 1");
|
||||
pnlRewards.add(lblErrRewards, "w 100%!, h 30px!, span 2 1");
|
||||
|
||||
@@ -104,7 +104,7 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
pnlDifficulty.setOpaque(false);
|
||||
pnlDifficulty.setLayout(new MigLayout("insets 0, gap 0, wrap 5"));
|
||||
|
||||
pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(new ImageIcon("res/images/icons/NotesIcon.png")).build(), "w 100%!, h 30px!, span 5 1");
|
||||
pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(new FSkin.UnskinnedIcon("res/images/icons/NotesIcon.png")).build(), "w 100%!, h 30px!, span 5 1");
|
||||
pnlDifficulty.add(lblErrDifficulty, "w 100%!, h 30px!, span 5 1");
|
||||
|
||||
constraints1 = "w 60px!, h 26px!";
|
||||
@@ -184,7 +184,7 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
pnlBooster.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
|
||||
pnlBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
|
||||
.icon(new ImageIcon("res/images/icons/BookIcon.png")).build(),
|
||||
.icon(new FSkin.UnskinnedIcon("res/images/icons/BookIcon.png")).build(),
|
||||
"w 100%!, h 30px!, span 2 1");
|
||||
pnlBooster.add(lblErrBooster, "w 100%!, h 30px!, span 2 1");
|
||||
|
||||
@@ -204,7 +204,7 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
pnlShop.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
|
||||
pnlShop.add(new FLabel.Builder().text("Shop Preferences")
|
||||
.icon(new ImageIcon("res/images/icons/CoinIcon.png")).build(), "w 100%!, h 30px!, span 2 1");
|
||||
.icon(new FSkin.UnskinnedIcon("res/images/icons/CoinIcon.png")).build(), "w 100%!, h 30px!, span 2 1");
|
||||
pnlShop.add(lblErrShop, "w 100%!, h 30px!, span 2 1");
|
||||
|
||||
constraints1 = "w 60px, h 26px!";
|
||||
@@ -240,7 +240,8 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
private class PrefInput extends JTextField {
|
||||
private final QPref qpref;
|
||||
private final ErrType err;
|
||||
private final Color clrHover, clrActive, clrText;
|
||||
private final JTextComponentSkin<PrefInput> skin;
|
||||
private final FSkin.SkinColor clrHover, clrActive, clrText;
|
||||
private boolean isFocus = false;
|
||||
private String previousText = "";
|
||||
|
||||
@@ -255,16 +256,17 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
|
||||
this.qpref = qp0;
|
||||
this.err = e0;
|
||||
this.skin = FSkin.get(this);
|
||||
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
|
||||
this.setOpaque(false);
|
||||
this.setBorder(null);
|
||||
this.setFont(FSkin.getFont(13));
|
||||
this.setForeground(clrText);
|
||||
this.setCaretColor(clrText);
|
||||
this.setBackground(clrHover);
|
||||
this.skin.setFont(FSkin.getFont(13));
|
||||
this.skin.setForeground(clrText);
|
||||
this.skin.setCaretColor(clrText);
|
||||
this.skin.setBackground(clrHover);
|
||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.setText(prefs.getPref(qpref));
|
||||
this.setPreviousText(prefs.getPref(qpref));
|
||||
@@ -290,14 +292,14 @@ public class QuestPreferencesHandler extends JPanel {
|
||||
public void focusGained(FocusEvent e) {
|
||||
isFocus = true;
|
||||
setOpaque(true);
|
||||
setBackground(clrActive);
|
||||
skin.setBackground(clrActive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
isFocus = false;
|
||||
setOpaque(false);
|
||||
setBackground(clrHover);
|
||||
skin.setBackground(clrHover);
|
||||
|
||||
// TODO for slight performance improvement
|
||||
// check if value has changed before validating
|
||||
|
||||
@@ -124,10 +124,14 @@ public class SSubmenuQuestUtil {
|
||||
|
||||
if (view.equals(VSubmenuChallenges.SINGLETON_INSTANCE)) {
|
||||
view.getLblZep().setVisible(qCtrl.getAssets().hasItem(QuestItemType.ZEPPELIN));
|
||||
view.getLblZep().setEnabled(qCtrl.getAssets().getItemLevel(
|
||||
QuestItemType.ZEPPELIN) == 2 ? false : true);
|
||||
view.getLblZep().setForeground(qCtrl.getAssets().getItemLevel(
|
||||
QuestItemType.ZEPPELIN) == 2 ? Color.gray : FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
if (qCtrl.getAssets().getItemLevel(QuestItemType.ZEPPELIN) == 2) {
|
||||
view.getLblZep().setEnabled(false);
|
||||
FSkin.get(view.getLblZep()).setForeground(Color.gray);
|
||||
}
|
||||
else {
|
||||
view.getLblZep().setEnabled(true);
|
||||
FSkin.get(view.getLblZep()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
}
|
||||
else {
|
||||
view.getLblZep().setVisible(false);
|
||||
@@ -193,7 +197,7 @@ public class SSubmenuQuestUtil {
|
||||
lblCurrentDeck.setText("Build, then select a deck in the \"Decks\" submenu. ");
|
||||
}
|
||||
else {
|
||||
lblCurrentDeck.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.get(lblCurrentDeck).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
lblCurrentDeck.setText("Your current deck is \""
|
||||
+ SSubmenuQuestUtil.getCurrentDeck().getName() + "\".");
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.awt.Font;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
@@ -20,6 +19,7 @@ import forge.gui.home.LblHeader;
|
||||
import forge.gui.home.StartButton;
|
||||
import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
@@ -46,7 +46,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
private final JButton btnStart = new StartButton();
|
||||
private final JComboBox<String> cbxPet = new JComboBox<String>();
|
||||
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
|
||||
private final JCheckBox cbPlant = new FCheckBox("Summon Plant");
|
||||
private final JLabel lblZep = new FLabel.Builder().text("<html>Launch<br>Zeppelin</html>")
|
||||
.hoverable(true).icon(FSkin.getIcon(FSkin.QuestIcons.ICO_ZEP))
|
||||
@@ -109,7 +109,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
pnlStats.add(lblLife, constraints);
|
||||
pnlStats.add(lblWorld, constraints);
|
||||
pnlStats.add(cbPlant, constraints);
|
||||
pnlStats.add(cbxPet, constraints);
|
||||
cbxPet.addTo(pnlStats, constraints);
|
||||
pnlStats.add(lblZep, "w 130px!, h 60px!, gap 0 0 0 5px");
|
||||
pnlStats.setOpaque(false);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComboBox<String> getCbxPet() {
|
||||
public FComboBoxWrapper<String> getCbxPet() {
|
||||
return cbxPet;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.awt.Font;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
@@ -20,6 +19,7 @@ import forge.gui.home.LblHeader;
|
||||
import forge.gui.home.StartButton;
|
||||
import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
@@ -45,7 +45,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
private final JButton btnStart = new StartButton();
|
||||
private final JComboBox<String> cbxPet = new JComboBox<String>();
|
||||
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
|
||||
private final JCheckBox cbPlant = new FCheckBox("Summon Plant");
|
||||
private final JLabel lblZep = new FLabel.Builder().text("Launch Zeppelin").fontSize(14).build();
|
||||
|
||||
@@ -107,7 +107,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
pnlStats.add(lblLife, constraints);
|
||||
pnlStats.add(lblWorld, constraints);
|
||||
pnlStats.add(cbPlant, constraints);
|
||||
pnlStats.add(cbxPet, constraints);
|
||||
cbxPet.addTo(pnlStats, constraints);
|
||||
pnlStats.setOpaque(false);
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComboBox<String> getCbxPet() {
|
||||
public FComboBoxWrapper<String> getCbxPet() {
|
||||
return cbxPet;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
@@ -31,6 +30,7 @@ import forge.gui.home.EMenuGroup;
|
||||
import forge.gui.home.IVSubmenu;
|
||||
import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FRadioButton;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
@@ -79,33 +79,33 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
||||
private final JCheckBox boxFantasy = new FCheckBox("Fantasy Mode");
|
||||
|
||||
private final JLabel lblStartingWorld = new FLabel.Builder().text("Starting world:").build();
|
||||
private final JComboBox<QuestWorld> cbxStartingWorld = new JComboBox<QuestWorld>();
|
||||
private final FComboBoxWrapper<QuestWorld> cbxStartingWorld = new FComboBoxWrapper<QuestWorld>();
|
||||
|
||||
|
||||
/* Second column */
|
||||
|
||||
private final JLabel lblStartingPool = new FLabel.Builder().text("Starting pool:").build();
|
||||
private final JComboBox<StartingPoolType> cbxStartingPool = new JComboBox<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 JLabel lblPreconDeck = new FLabel.Builder().text("Starter/Event deck:").build();
|
||||
private final JComboBox<String> cbxPreconDeck = new JComboBox<String>();
|
||||
private final FComboBoxWrapper<String> cbxPreconDeck = new FComboBoxWrapper<String>();
|
||||
|
||||
private final JLabel lblFormat = new FLabel.Builder().text("Sanctioned format:").build();
|
||||
private final JComboBox<GameFormat> cbxFormat = new JComboBox<GameFormat>();
|
||||
private final FComboBoxWrapper<GameFormat> cbxFormat = new FComboBoxWrapper<GameFormat>();
|
||||
|
||||
private final JLabel lblCustomDeck = new FLabel.Builder().text("Custom deck:").build();
|
||||
private final JComboBox<Deck> cbxCustomDeck = new JComboBox<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 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 JComboBox<Object> cbxPrizedCards = new JComboBox<Object>();
|
||||
private final FComboBoxWrapper<Object> cbxPrizedCards = new FComboBoxWrapper<Object>();
|
||||
|
||||
private final JLabel lblPrizeFormat = new FLabel.Builder().text("Sanctioned format:").build();
|
||||
private final JComboBox<GameFormat> cbxPrizeFormat = new JComboBox<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 JLabel lblPrizeSameAsStarting = new FLabel.Builder().text("Only sets found in starting pool will be available.").build();
|
||||
@@ -199,8 +199,8 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private VSubmenuQuestData() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
lblTitleNew.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitleNew).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
scrQuests.setBorder(null);
|
||||
|
||||
@@ -302,28 +302,28 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
||||
|
||||
pnlRestrictions.setLayout(new MigLayout("insets 0, gap 0, wrap 2", "[120, al right][240, fill]", "[|]12[|]6[]"));
|
||||
pnlRestrictions.add(lblStartingPool, constraints + lblWidthStart);
|
||||
pnlRestrictions.add(cbxStartingPool, constraints + cboWidthStart);
|
||||
cbxStartingPool.addTo(pnlRestrictions, constraints + cboWidthStart);
|
||||
|
||||
/* out of these 3 groups only one will be visible */
|
||||
pnlRestrictions.add(lblUnrestricted, constraints + hidemode + "spanx 2");
|
||||
|
||||
pnlRestrictions.add(lblPreconDeck, constraints + lblWidthStart);
|
||||
pnlRestrictions.add(cbxPreconDeck, constraints + cboWidthStart);
|
||||
cbxPreconDeck.addTo(pnlRestrictions, constraints + cboWidthStart);
|
||||
|
||||
pnlRestrictions.add(lblCustomDeck, constraints + lblWidthStart);
|
||||
pnlRestrictions.add(cbxCustomDeck, constraints + cboWidthStart); // , skip 1
|
||||
cbxCustomDeck.addTo(pnlRestrictions, constraints + cboWidthStart); // , skip 1
|
||||
|
||||
pnlRestrictions.add(lblFormat, constraints + lblWidthStart);
|
||||
pnlRestrictions.add(cbxFormat, constraints + cboWidthStart); // , skip 1
|
||||
cbxFormat.addTo(pnlRestrictions, constraints + cboWidthStart); // , skip 1
|
||||
|
||||
pnlRestrictions.add(btnDefineCustomFormat, constraints + hidemode + "spanx 2, w 240px");
|
||||
|
||||
// Prized cards options
|
||||
pnlRestrictions.add(lblPrizedCards, constraints + lblWidth);
|
||||
pnlRestrictions.add(cbxPrizedCards, constraints + cboWidth);
|
||||
cbxPrizedCards.addTo(pnlRestrictions, constraints + cboWidth);
|
||||
|
||||
pnlRestrictions.add(lblPrizeFormat, constraints + lblWidthStart);
|
||||
pnlRestrictions.add(cbxPrizeFormat, constraints + cboWidthStart); // , skip 1
|
||||
cbxPrizeFormat.addTo(pnlRestrictions, constraints + cboWidthStart); // , skip 1
|
||||
pnlRestrictions.add(btnPrizeDefineCustomFormat, constraints + hidemode + "spanx 2, w 240px");
|
||||
pnlRestrictions.add(lblPrizeSameAsStarting, constraints + hidemode + "spanx 2");
|
||||
pnlRestrictions.add(lblPrizeUnrestricted, constraints + hidemode + "spanx 2");
|
||||
@@ -331,7 +331,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
||||
pnlRestrictions.add(cboAllowUnlocks, constraints + "spanx 2, ax right");
|
||||
|
||||
pnlRestrictions.add(lblStartingWorld, constraints + lblWidthStart);
|
||||
pnlRestrictions.add(cbxStartingWorld, constraints + cboWidthStart);
|
||||
cbxStartingWorld.addTo(pnlRestrictions, constraints + cboWidthStart);
|
||||
|
||||
// cboAllowUnlocks.setOpaque(false);
|
||||
pnlRestrictions.setOpaque(false);
|
||||
|
||||
@@ -44,7 +44,7 @@ public enum VSubmenuQuestDecks implements IVSubmenu<CSubmenuQuestDecks> {
|
||||
* Constructor.
|
||||
*/
|
||||
private VSubmenuQuestDecks() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
scr.setBorder(null);
|
||||
scr.getViewport().setBorder(null);
|
||||
|
||||
@@ -25,6 +25,8 @@ import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.quest.data.QuestPreferences;
|
||||
import forge.quest.data.QuestPreferences.QPref;
|
||||
|
||||
@@ -76,7 +78,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
* Constructor.
|
||||
*/
|
||||
private VSubmenuQuestPrefs() {
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
pnlContent.setOpaque(false);
|
||||
pnlContent.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||
@@ -89,7 +91,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
// Rewards panel
|
||||
final FPanel pnlTitleRewards = new FPanel();
|
||||
pnlTitleRewards.setLayout(new MigLayout("insets 0, align center"));
|
||||
pnlTitleRewards.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlTitleRewards).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnlTitleRewards.add(new FLabel.Builder().text("Rewards")
|
||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
|
||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||
@@ -101,7 +103,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
// Booster panel
|
||||
final FPanel pnlTitleBooster = new FPanel();
|
||||
pnlTitleBooster.setLayout(new MigLayout("insets 0, align center"));
|
||||
pnlTitleBooster.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlTitleBooster).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnlTitleBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
|
||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOOK))
|
||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||
@@ -112,7 +114,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
// Difficulty table panel
|
||||
final FPanel pnlTitleDifficulty = new FPanel();
|
||||
pnlTitleDifficulty.setLayout(new MigLayout("insets 0, align center"));
|
||||
pnlTitleDifficulty.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlTitleDifficulty).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnlTitleDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments")
|
||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_NOTES))
|
||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||
@@ -123,7 +125,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
// Shop panel
|
||||
final FPanel pnlTitleShop = new FPanel();
|
||||
pnlTitleShop.setLayout(new MigLayout("insets 0, align center"));
|
||||
pnlTitleShop.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlTitleShop).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnlTitleShop.add(new FLabel.Builder().text("Shop Preferences")
|
||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
|
||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||
@@ -373,7 +375,8 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
public class PrefInput extends JTextField {
|
||||
private final QPref qpref;
|
||||
private final QuestPreferencesErrType err;
|
||||
private final Color clrHover, clrActive, clrText;
|
||||
private final JTextComponentSkin<PrefInput> skin;
|
||||
private final SkinColor clrHover, clrActive, clrText;
|
||||
private boolean isFocus = false;
|
||||
private String previousText = "";
|
||||
|
||||
@@ -388,16 +391,17 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
|
||||
this.qpref = qp0;
|
||||
this.err = e0;
|
||||
this.skin = FSkin.get(this);
|
||||
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
|
||||
this.setOpaque(false);
|
||||
this.setBorder(null);
|
||||
this.setFont(FSkin.getFont(13));
|
||||
this.setForeground(clrText);
|
||||
this.setCaretColor(clrText);
|
||||
this.setBackground(clrHover);
|
||||
this.skin.setFont(FSkin.getFont(13));
|
||||
this.skin.setForeground(clrText);
|
||||
this.skin.setCaretColor(clrText);
|
||||
this.skin.setBackground(clrHover);
|
||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.setText(prefs.getPref(qpref));
|
||||
this.setPreviousText(prefs.getPref(qpref));
|
||||
@@ -423,14 +427,14 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
||||
public void focusGained(FocusEvent e) {
|
||||
isFocus = true;
|
||||
setOpaque(true);
|
||||
setBackground(clrActive);
|
||||
skin.setBackground(clrActive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
isFocus = false;
|
||||
setOpaque(false);
|
||||
setBackground(clrHover);
|
||||
skin.setBackground(clrHover);
|
||||
|
||||
CSubmenuQuestPrefs.validateAndSave(PrefInput.this);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
|
||||
private VSubmenuConstructed() {
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
pnlStart = new JPanel(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
final String strCheckboxConstraints = "pushy, gap 0 20px 0 0";
|
||||
@@ -59,8 +59,6 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
//pnlStart.add(cbAiVsAi, strCheckboxConstraintsTop);
|
||||
pnlStart.add(cbArtifacts, strCheckboxConstraints);
|
||||
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -79,7 +79,7 @@ public enum VSubmenuDraft implements IVSubmenu<CSubmenuDraft> {
|
||||
lstAI.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
btnStart.setEnabled(false);
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
JXButtonPanel grpPanel = new JXButtonPanel();
|
||||
grpPanel.add(radSingle, "w 200px!, h 30px!");
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FPanel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||
import forge.gui.toolbox.special.DeckLister;
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,7 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
|
||||
private VSubmenuSealed() {
|
||||
btnStart.setEnabled(false);
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -165,9 +166,10 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
|
||||
|
||||
// Init directions text pane
|
||||
final JTextPane tpnDirections = new JTextPane();
|
||||
JTextComponentSkin<JTextPane> tpnDirectionsSkin = FSkin.get(tpnDirections);
|
||||
tpnDirections.setOpaque(false);
|
||||
tpnDirections.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tpnDirections.setFont(FSkin.getFont(15));
|
||||
tpnDirectionsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tpnDirectionsSkin.setFont(FSkin.getFont(15));
|
||||
tpnDirections.setAlignmentX(SwingConstants.CENTER);
|
||||
tpnDirections.setFocusable(false);
|
||||
tpnDirections.setEditable(false);
|
||||
|
||||
@@ -24,6 +24,7 @@ import forge.gui.toolbox.FComboBoxPanel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -199,7 +200,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
File f = new File(fd);
|
||||
f.delete();
|
||||
}
|
||||
|
||||
|
||||
private void initializeGameLogVerbosityComboBox() {
|
||||
FPref userSetting = FPref.DEV_LOG_ENTRY_TYPE;
|
||||
FComboBoxPanel<GameLogEntryType> panel = this.view.getGameLogVerbosityComboBoxPanel();
|
||||
@@ -217,13 +218,22 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
}
|
||||
|
||||
private void initializeSkinsComboBox() {
|
||||
FPref userSetting = FPref.UI_SKIN;
|
||||
FComboBoxPanel<String> panel = this.view.getSkinsComboBoxPanel();
|
||||
final FComboBoxPanel<String> panel = this.view.getSkinsComboBoxPanel();
|
||||
String[] installedSkins = FSkin.getSkinNamesArray(true);
|
||||
validatePreferredSkinName(installedSkins);
|
||||
JComboBox<String> comboBox = createComboBox(installedSkins, userSetting);
|
||||
String selectedItem = this.prefs.getPref(userSetting);
|
||||
final JComboBox<String> comboBox = new JComboBox<String>(installedSkins);
|
||||
String selectedItem = this.prefs.getPref(FPref.UI_SKIN);
|
||||
panel.setComboBox(comboBox, selectedItem);
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(final ItemEvent e) {
|
||||
FSkin.changeSkin(panel.getSelectedItem().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateCurrentSkin() {
|
||||
this.view.getSkinsComboBoxPanel().setSelectedItem(this.prefs.getPref(FPref.UI_SKIN));
|
||||
}
|
||||
|
||||
private void validatePreferredSkinName(String[] installedSkins) {
|
||||
@@ -240,7 +250,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
}
|
||||
|
||||
private <E> void addComboBoxListener(final JComboBox<E> comboBox, final ForgePreferences.FPref setting) {
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void itemStateChanged(final ItemEvent e) {
|
||||
@@ -248,7 +258,6 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
CSubmenuPreferences.this.prefs.setPref(setting, selectedType.toString());
|
||||
CSubmenuPreferences.this.prefs.save();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package forge.gui.home.settings;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
|
||||
@@ -21,6 +19,7 @@ import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
/**
|
||||
@@ -76,7 +75,7 @@ public enum VSubmenuAvatars implements IVSubmenu<CSubmenuAvatars> {
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private void populateAvatars() {
|
||||
final Map<Integer, Image> avatarMap = FSkin.getAvatars();
|
||||
final Map<Integer, SkinImage> avatarMap = FSkin.getAvatars();
|
||||
final JPanel pnlAvatarPics = new JPanel(new WrapLayout());
|
||||
final JPanel pnlAvatarUsers = new JPanel(new MigLayout("insets 0, gap 0, align center"));
|
||||
|
||||
@@ -121,16 +120,16 @@ public enum VSubmenuAvatars implements IVSubmenu<CSubmenuAvatars> {
|
||||
if (humanIndex >= FSkin.getAvatars().size()) { humanIndex = 0; }
|
||||
if (aiIndex >= FSkin.getAvatars().size()) { aiIndex = 0; }
|
||||
|
||||
lblAvatarAI.setIcon(new ImageIcon(FSkin.getAvatars().get(aiIndex)));
|
||||
lblAvatarHuman.setIcon(new ImageIcon(FSkin.getAvatars().get(humanIndex)));
|
||||
lblAvatarAI.setIcon(FSkin.getAvatars().get(aiIndex));
|
||||
lblAvatarHuman.setIcon(FSkin.getAvatars().get(humanIndex));
|
||||
|
||||
Singletons.getModel().getPreferences().setPref(FPref.UI_AVATARS, humanIndex + "," + aiIndex);
|
||||
Singletons.getModel().getPreferences().save();
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private FLabel makeAvatarLabel(final Image img0, final int index0) {
|
||||
final FLabel lbl = new FLabel.Builder().icon(new ImageIcon(img0)).iconScaleFactor(1.0)
|
||||
private FLabel makeAvatarLabel(final SkinImage img0, final int index0) {
|
||||
final FLabel lbl = new FLabel.Builder().icon(img0).iconScaleFactor(1.0)
|
||||
.iconInBackground(true).hoverable(true).build();
|
||||
|
||||
final Dimension size = new Dimension(100, 100);
|
||||
@@ -145,12 +144,12 @@ public enum VSubmenuAvatars implements IVSubmenu<CSubmenuAvatars> {
|
||||
.getPref(FPref.UI_AVATARS).split(",");
|
||||
|
||||
if (lblAvatarAI.getSelected()) {
|
||||
lblAvatarAI.setIcon(new ImageIcon(FSkin.getAvatars().get(index0)));
|
||||
lblAvatarAI.setIcon(FSkin.getAvatars().get(index0));
|
||||
lblAvatarAI.repaintSelf();
|
||||
indices[1] = String.valueOf(index0);
|
||||
}
|
||||
else {
|
||||
lblAvatarHuman.setIcon(new ImageIcon(FSkin.getAvatars().get(index0)));
|
||||
lblAvatarHuman.setIcon(FSkin.getAvatars().get(index0));
|
||||
lblAvatarHuman.repaintSelf();
|
||||
indices[0] = String.valueOf(index0);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,10 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.GameLogEntryType;
|
||||
import forge.Singletons;
|
||||
import forge.control.KeyboardShortcuts;
|
||||
@@ -285,7 +284,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private class OptionsCheckBox extends FCheckBox {
|
||||
public OptionsCheckBox(final String txt0) {
|
||||
super(txt0);
|
||||
setFont(FSkin.getBoldFont(12));
|
||||
FSkin.get(this).setFont(FSkin.getBoldFont(12));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,10 +293,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private class SectionLabel extends JLabel {
|
||||
public SectionLabel(final String txt0) {
|
||||
super(txt0);
|
||||
setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
FSkin.JLabelSkin<SectionLabel> skin = FSkin.get(this);
|
||||
skin.setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
setFont(FSkin.getBoldFont(16));
|
||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setFont(FSkin.getBoldFont(16));
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,8 +306,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private class NoteLabel extends JLabel {
|
||||
public NoteLabel(final String txt0) {
|
||||
super(txt0);
|
||||
setFont(FSkin.getItalicFont(12));
|
||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.JLabelSkin<NoteLabel> skin = FSkin.get(this);
|
||||
skin.setFont(FSkin.getItalicFont(12));
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +331,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
public KeyboardShortcutField(final Shortcut shortcut0) {
|
||||
super();
|
||||
this.setEditable(false);
|
||||
this.setFont(FSkin.getFont(14));
|
||||
FSkin.get(this).setFont(FSkin.getFont(14));
|
||||
final FPref prefKey = shortcut0.getPrefKey();
|
||||
reload(prefKey);
|
||||
|
||||
@@ -344,7 +345,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
this.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusGained(final FocusEvent evt) {
|
||||
KeyboardShortcutField.this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
FSkin.get(KeyboardShortcutField.this).setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,7 +353,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
Singletons.getModel().getPreferences().setPref(prefKey, getCodeString());
|
||||
Singletons.getModel().getPreferences().save();
|
||||
shortcut0.attach();
|
||||
KeyboardShortcutField.this.setBackground(Color.white);
|
||||
FSkin.get(KeyboardShortcutField.this).setBackground(Color.white);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,9 +66,11 @@ public enum VSubmenuReleaseNotes implements IVSubmenu<CSubmenuReleaseNotes> {
|
||||
tar.setWrapStyleWord(true);
|
||||
tar.setEditable(false);
|
||||
tar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
||||
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
|
||||
tar.setFont(FSkin.getFixedFont(16));
|
||||
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tar.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tarSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
scroller = new JScrollPane(tar);
|
||||
pnlMain.add(scroller, "w 100%!, h 100%!");
|
||||
|
||||
@@ -75,7 +75,7 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
|
||||
|
||||
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
|
||||
//and call the method that shows/hides tabs appropriately.
|
||||
|
||||
@@ -71,7 +71,7 @@ public enum VSubmenuCommander implements IVSubmenu<CSubmenuCommander> {
|
||||
|
||||
private VSubmenuCommander() {
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
Vector<Object> cmdDeckListData = new Vector<Object>();
|
||||
if(Singletons.getModel().getDecks().getCommander().size() > 0) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
|
||||
|
||||
private VSubmenuPlanechase() {
|
||||
|
||||
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
|
||||
//and call the method that shows/hides tabs appropriately.
|
||||
|
||||
@@ -87,7 +87,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
||||
|
||||
private VSubmenuVanguard() {
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
Vector<Object> humanListData = new Vector<Object>();
|
||||
Vector<Object> aiListData = new Vector<Object>();
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JMenu;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -63,6 +62,7 @@ import forge.gui.match.nonsingleton.VHand;
|
||||
import forge.gui.match.views.VPlayers;
|
||||
import forge.gui.menubar.IMenuProvider;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.gui.toolbox.special.PhaseLabel;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -92,18 +92,18 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
|
||||
uiEvents.register(visitor);
|
||||
}
|
||||
|
||||
private ImageIcon getPlayerAvatar(final Player p, final int defaultIndex) {
|
||||
private SkinImage getPlayerAvatar(final Player p, final int defaultIndex) {
|
||||
LobbyPlayer lp = p.getLobbyPlayer();
|
||||
if (null != lp.getIconImageKey()) {
|
||||
return ImageCache.getIcon(lp);
|
||||
}
|
||||
|
||||
int avatarIdx = lp.getAvatarIndex();
|
||||
return new ImageIcon(FSkin.getAvatars().get(0 <= avatarIdx ? avatarIdx : defaultIndex));
|
||||
return FSkin.getAvatars().get(0 <= avatarIdx ? avatarIdx : defaultIndex);
|
||||
}
|
||||
|
||||
|
||||
private void setAvatar(VField view, ImageIcon img) {
|
||||
private void setAvatar(VField view, SkinImage img) {
|
||||
view.getLblAvatar().setIcon(img);
|
||||
view.getLblAvatar().getResizeTimer().start();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package forge.gui.match;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
@@ -18,7 +16,6 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.Scrollable;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.plaf.LayerUI;
|
||||
|
||||
@@ -26,13 +23,15 @@ import net.miginfocom.swing.MigLayout;
|
||||
import forge.gui.MouseUtil;
|
||||
import forge.gui.MouseUtil.MouseCursor;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinFont;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GameLogPanel extends JPanel {
|
||||
|
||||
private JScrollPane scrollPane;
|
||||
private MyScrollablePanel scrollablePanel;
|
||||
private Font textFont = UIManager.getDefaults().getFont("TextArea.font");
|
||||
private SkinFont textFont = FSkin.getFont();
|
||||
|
||||
private LayerUI<JScrollPane> layerUI = new GameLogPanelLayerUI();
|
||||
private JLayer<JScrollPane> layer;
|
||||
@@ -146,28 +145,27 @@ public class GameLogPanel extends JPanel {
|
||||
|
||||
}
|
||||
|
||||
public void setTextFont(Font newFont) {
|
||||
public void setTextFont(SkinFont newFont) {
|
||||
this.textFont = newFont;
|
||||
}
|
||||
|
||||
private JTextArea createNewLogEntryJTextArea(String text, boolean useAlternateBackColor) {
|
||||
final JTextArea tar = new JTextArea(text);
|
||||
tar.setFont(textFont);
|
||||
final JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
|
||||
tarSkin.setFont(textFont);
|
||||
tar.setBorder(new EmptyBorder(3, 4, 3, 4));
|
||||
tar.setFocusable(false);
|
||||
tar.setEditable(false);
|
||||
tar.setLineWrap(true);
|
||||
tar.setWrapStyleWord(true);
|
||||
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
setTextAreaBackground(tar, useAlternateBackColor);
|
||||
return tar;
|
||||
}
|
||||
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
private void setTextAreaBackground(JTextArea tar, boolean useAlternateBackColor) {
|
||||
Color skinColor = FSkin.getColor(FSkin.Colors.CLR_THEME2);
|
||||
FSkin.SkinColor skinColor = FSkin.getColor(FSkin.Colors.CLR_THEME2);
|
||||
if (useAlternateBackColor) { skinColor = skinColor.darker(); }
|
||||
tar.setOpaque(true);
|
||||
tar.setBackground(skinColor);
|
||||
tarSkin.setBackground(skinColor);
|
||||
|
||||
return tar;
|
||||
}
|
||||
|
||||
protected final class MyScrollablePanel extends JPanel implements Scrollable {
|
||||
|
||||
@@ -182,7 +182,7 @@ public class GauntletWinLose extends ControlWinLose {
|
||||
final JPanel pnl = this.getView().getPnlCustom();
|
||||
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
|
||||
pnl.setOpaque(true);
|
||||
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnl).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
pnl.add(lblTitle, "gap 0 0 20px 10px, ax center");
|
||||
pnl.add(pnlResults, "w 96%!, growy, pushy, gap 2% 0 0 0");
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ public class LimitedWinLose extends ControlWinLose {
|
||||
// + " Total Wins: " + gauntlet.getWins()
|
||||
// + " Total Losses: " + gauntlet.getLosses());
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setFont(FSkin.getFont(17));
|
||||
FSkin.get(this.lblTemp2).setFont(FSkin.getFont(17));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
this.getView().getPnlCustom().add(this.lblTemp1, LimitedWinLose.CONSTRAINTS_TITLE);
|
||||
@@ -207,7 +207,7 @@ public class LimitedWinLose extends ControlWinLose {
|
||||
private class TitleLabel extends JLabel {
|
||||
TitleLabel(final String msg) {
|
||||
super(msg);
|
||||
this.setFont(FSkin.getFont(18));
|
||||
FSkin.get(this).setFont(FSkin.getFont(18));
|
||||
this.setPreferredSize(new Dimension(200, 40));
|
||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.setForeground(Color.white);
|
||||
|
||||
@@ -19,14 +19,12 @@ package forge.gui.match;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
@@ -55,6 +53,7 @@ import forge.gui.SOverlayUtils;
|
||||
import forge.gui.home.quest.CSubmenuChallenges;
|
||||
import forge.gui.home.quest.CSubmenuDuels;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinIcon;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
@@ -85,7 +84,7 @@ import forge.util.MyRandom;
|
||||
public class QuestWinLose extends ControlWinLose {
|
||||
private final transient boolean wonMatch;
|
||||
private final transient ViewWinLose view;
|
||||
private transient ImageIcon icoTemp;
|
||||
private transient SkinIcon icoTemp;
|
||||
private transient JLabel lblTemp1;
|
||||
private transient JLabel lblTemp2;
|
||||
private final transient boolean isAnte;
|
||||
@@ -472,15 +471,16 @@ public class QuestWinLose extends ControlWinLose {
|
||||
qData.getAssets().addCredits(credTotal);
|
||||
|
||||
// Generate Swing components and attach.
|
||||
this.icoTemp = QuestWinLose.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_GOLD), 0.5);
|
||||
this.icoTemp = FSkin.getIcon(FSkin.QuestIcons.ICO_GOLD).scale(0.5);
|
||||
|
||||
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
||||
|
||||
this.lblTemp2 = new JLabel(sb.toString());
|
||||
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(this.lblTemp2);
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setFont(FSkin.getFont(14));
|
||||
labelSkin.setFont(FSkin.getFont(14));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setIcon(this.icoTemp);
|
||||
labelSkin.setIcon(this.icoTemp);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
|
||||
this.getView().getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
|
||||
@@ -624,15 +624,16 @@ public class QuestWinLose extends ControlWinLose {
|
||||
qData.getAssets().addCredits(questRewardCredits);
|
||||
|
||||
// Generate Swing components and attach.
|
||||
this.icoTemp = QuestWinLose.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOX), 0.5);
|
||||
this.icoTemp = FSkin.getIcon(FSkin.QuestIcons.ICO_BOX).scale(0.5);
|
||||
this.lblTemp1 = new TitleLabel("Challenge Rewards for \"" + ((QuestEventChallenge) qEvent).getTitle() + "\"");
|
||||
|
||||
this.lblTemp2 = new JLabel(sb.toString());
|
||||
this.lblTemp2.setFont(FSkin.getFont(14));
|
||||
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(this.lblTemp2);
|
||||
labelSkin.setFont(FSkin.getFont(14));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
this.lblTemp2.setIcon(this.icoTemp);
|
||||
labelSkin.setIcon(this.icoTemp);
|
||||
|
||||
this.getView().getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
|
||||
this.getView().getPnlCustom().add(this.lblTemp2, QuestWinLose.CONSTRAINTS_TEXT);
|
||||
@@ -697,16 +698,17 @@ public class QuestWinLose extends ControlWinLose {
|
||||
|
||||
private void penalizeLoss() {
|
||||
final int x = Singletons.getModel().getQuestPreferences().getPrefInt(QPref.PENALTY_LOSS);
|
||||
this.icoTemp = QuestWinLose.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_HEART), 0.5);
|
||||
this.icoTemp = FSkin.getIcon(FSkin.QuestIcons.ICO_HEART).scale(0.5);
|
||||
|
||||
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
||||
|
||||
this.lblTemp2 = new JLabel("You lose! You have lost " + x + " credits.");
|
||||
this.lblTemp2.setFont(FSkin.getFont(14));
|
||||
FSkin.JLabelSkin<JLabel> labelSkin = FSkin.get(this.lblTemp2);
|
||||
labelSkin.setFont(FSkin.getFont(14));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
this.lblTemp2.setIcon(this.icoTemp);
|
||||
labelSkin.setIcon(this.icoTemp);
|
||||
|
||||
this.getView().getPnlCustom().add(this.lblTemp1, QuestWinLose.CONSTRAINTS_TITLE);
|
||||
this.getView().getPnlCustom().add(this.lblTemp2, QuestWinLose.CONSTRAINTS_TEXT);
|
||||
@@ -783,24 +785,6 @@ public class QuestWinLose extends ControlWinLose {
|
||||
return credits;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getResizedIcon.
|
||||
* </p>
|
||||
*
|
||||
* @param icon
|
||||
* ImageIcon
|
||||
* @param scale
|
||||
* Double
|
||||
* @return {@link javax.swing.ImageIcon} object
|
||||
*/
|
||||
public static ImageIcon getResizedIcon(final ImageIcon icon, final double scale) {
|
||||
final int w = (int) (icon.getIconWidth() * scale);
|
||||
final int h = (int) (icon.getIconHeight() * scale);
|
||||
|
||||
return new ImageIcon(icon.getImage().getScaledInstance(w, h, Image.SCALE_SMOOTH));
|
||||
}
|
||||
|
||||
/**
|
||||
* JLabel header between reward sections.
|
||||
*
|
||||
@@ -809,7 +793,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
private class TitleLabel extends JLabel {
|
||||
TitleLabel(final String msg) {
|
||||
super(msg);
|
||||
this.setFont(FSkin.getFont(16));
|
||||
FSkin.get(this).setFont(FSkin.getFont(16));
|
||||
this.setPreferredSize(new Dimension(200, 40));
|
||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.setForeground(Color.white);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class QuestWinLoseCardViewer extends FPanel {
|
||||
|
||||
this.setCornerDiameter(20);
|
||||
this.setBorderToggle(false);
|
||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
picture.setOpaque(false);
|
||||
scroller.setBorder(null);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public enum TargetingOverlay {
|
||||
pnl.setOpaque(false);
|
||||
pnl.setVisible(false);
|
||||
pnl.setFocusTraversalKeysEnabled(false);
|
||||
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
FSkin.get(pnl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JPanel} */
|
||||
@@ -300,7 +300,7 @@ public enum TargetingOverlay {
|
||||
return area;
|
||||
}
|
||||
|
||||
private void drawArrow(Graphics2D g2d, int startX, int startY, int endX, int endY, Color color) {
|
||||
private void drawArrow(Graphics2D g2d, int startX, int startY, int endX, int endY, FSkin.SkinColor skinColor) {
|
||||
float ex = endX - startX;
|
||||
float ey = endY - startY;
|
||||
if (ex == 0 && ey == 0) { return; }
|
||||
@@ -318,7 +318,7 @@ public enum TargetingOverlay {
|
||||
g2d.translate(startX, startY);
|
||||
g2d.rotate(Math.atan2(ey, ex));
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75f));
|
||||
g2d.setColor(color);
|
||||
FSkin.get(this).setGraphicsColor(g2d, skinColor);
|
||||
g2d.fill(arrow);
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.draw(arrow);
|
||||
@@ -347,7 +347,7 @@ public enum TargetingOverlay {
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
Color color = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
FSkin.SkinColor skinColor = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
|
||||
for (Point[] p : arcs) {
|
||||
if (p[0] == null || p[1] == null) {
|
||||
@@ -359,7 +359,7 @@ public enum TargetingOverlay {
|
||||
int startX = (int) p[1].getX();
|
||||
int startY = (int) p[1].getY();
|
||||
|
||||
drawArrow(g2d, startX, startY, endX, endY, color);
|
||||
drawArrow(g2d, startX, startY, endX, endY, skinColor);
|
||||
}
|
||||
|
||||
FView.SINGLETON_INSTANCE.getFrame().repaint(); // repaint the match UI
|
||||
|
||||
@@ -33,8 +33,6 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Card;
|
||||
import forge.CounterType;
|
||||
@@ -113,7 +111,7 @@ public class VAssignDamage {
|
||||
if (!damage.containsKey(source)) source = null; // to get player instead of fake card
|
||||
|
||||
FSkin.Colors brdrColor = VAssignDamage.this.canAssignTo(source) ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE;
|
||||
((CardPanel) evt.getSource()).setBorder(new LineBorder(FSkin.getColor(brdrColor), 2));
|
||||
FSkin.get((CardPanel) evt.getSource()).setLineBorder(FSkin.getColor(brdrColor), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,7 +153,7 @@ public class VAssignDamage {
|
||||
// Top-level UI stuff
|
||||
final JPanel overlay = SOverlayUtils.genericOverlay();
|
||||
final JPanel pnlMain = new JPanel();
|
||||
pnlMain.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(pnlMain).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
// Attacker area
|
||||
final CardPanel pnlAttacker = new CardPanel(attacker0);
|
||||
|
||||
@@ -91,24 +91,24 @@ public class ViewWinLose {
|
||||
|
||||
lblTitle.setForeground(Color.white);
|
||||
lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblTitle.setFont(FSkin.getFont().deriveFont(Font.BOLD, 30));
|
||||
FSkin.get(lblTitle).setFont(FSkin.getBoldFont(30));
|
||||
|
||||
lblStats.setForeground(Color.white);
|
||||
lblStats.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblStats.setFont(FSkin.getFont().deriveFont(Font.PLAIN, 26));
|
||||
FSkin.get(lblStats).setFont(FSkin.getFont(26));
|
||||
|
||||
btnContinue.setText("Continue");
|
||||
btnContinue.setFont(FSkin.getFont(22));
|
||||
FSkin.get(btnContinue).setFont(FSkin.getFont(22));
|
||||
btnRestart.setText("Restart");
|
||||
btnRestart.setFont(FSkin.getFont(22));
|
||||
FSkin.get(btnRestart).setFont(FSkin.getFont(22));
|
||||
btnQuit.setText("Quit");
|
||||
btnQuit.setFont(FSkin.getFont(22));
|
||||
FSkin.get(btnQuit).setFont(FSkin.getFont(22));
|
||||
btnContinue.setEnabled(!game.getMatch().isMatchOver());
|
||||
|
||||
// Assemble game log scroller.
|
||||
final FTextArea txtLog = new FTextArea();
|
||||
txtLog.setText(game.getGameLog().getLogText(null));
|
||||
txtLog.setFont(FSkin.getFont(14));
|
||||
FSkin.get(txtLog).setFont(FSkin.getFont(14));
|
||||
txtLog.setFocusable(true); // allow highlighting and copying of log
|
||||
|
||||
FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build();
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
@@ -16,6 +15,7 @@ import forge.Singletons;
|
||||
import forge.gui.match.controllers.CDock;
|
||||
import forge.gui.menubar.MenuUtil;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinIcon;
|
||||
import forge.gui.toolbox.FSkin.SkinProp;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
@@ -70,7 +70,7 @@ public final class GameMenu {
|
||||
|
||||
private static JMenuItem getMenuItem_Concede() {
|
||||
JMenuItem menuItem = new JMenuItem("Concede");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_CONCEDE) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_CONCEDE) : null));
|
||||
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_Q));
|
||||
menuItem.addActionListener(getConcedeAction());
|
||||
return menuItem;
|
||||
@@ -92,7 +92,7 @@ public final class GameMenu {
|
||||
|
||||
private static JMenuItem getMenuItem_AlphaStrike() {
|
||||
JMenuItem menuItem = new JMenuItem("Alpha Strike");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ALPHASTRIKE) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ALPHASTRIKE) : null));
|
||||
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_A));
|
||||
menuItem.addActionListener(getAlphaStrikeAction());
|
||||
return menuItem;
|
||||
@@ -109,7 +109,7 @@ public final class GameMenu {
|
||||
|
||||
private static JMenuItem getMenuItem_EndTurn() {
|
||||
JMenuItem menuItem = new JMenuItem("End Turn");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ENDTURN) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ENDTURN) : null));
|
||||
menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_E));
|
||||
menuItem.addActionListener(getEndTurnAction());
|
||||
return menuItem;
|
||||
@@ -129,7 +129,7 @@ public final class GameMenu {
|
||||
JMenu menu = new JMenu("Targeting Arcs");
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
|
||||
ImageIcon menuIcon = MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ARCSOFF);
|
||||
SkinIcon menuIcon = MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ARCSOFF);
|
||||
|
||||
JRadioButtonMenuItem menuItem;
|
||||
menuItem = getTargetingArcRadioButton("Off", FSkin.DockIcons.ICO_ARCSOFF, 0);
|
||||
@@ -144,7 +144,7 @@ public final class GameMenu {
|
||||
if (menuItem.isSelected()) { menuIcon = MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_ARCSON); }
|
||||
group.add(menuItem);
|
||||
|
||||
menu.setIcon((showIcons ? menuIcon : null));
|
||||
FSkin.get(menu).setIcon((showIcons ? menuIcon : null));
|
||||
menu.add(menuItem);
|
||||
|
||||
return menu;
|
||||
@@ -152,7 +152,7 @@ public final class GameMenu {
|
||||
|
||||
private static JRadioButtonMenuItem getTargetingArcRadioButton(String caption, SkinProp icon, final int arcState) {
|
||||
final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(caption);
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(icon) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(icon) : null));
|
||||
menuItem.setSelected(arcState == controller.getArcState());
|
||||
menuItem.addActionListener(getTargetingRadioButtonAction(arcState));
|
||||
return menuItem;
|
||||
@@ -178,7 +178,7 @@ public final class GameMenu {
|
||||
|
||||
private static JMenuItem getMenuItem_ViewDeckList() {
|
||||
JMenuItem menuItem = new JMenuItem("Deck List");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_DECKLIST) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_DECKLIST) : null));
|
||||
menuItem.addActionListener(getViewDeckListAction());
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ package forge.gui.match.nonsingleton;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.zone.ZoneType;
|
||||
@@ -71,8 +69,7 @@ public class VCommand implements IVDoc<CCommand> {
|
||||
|
||||
control = new CCommand(player, this);
|
||||
|
||||
tabletop.setBorder(new MatteBorder(0, 1, 0, 0,
|
||||
FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
FSkin.get(tabletop).setMatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
tabletop.setOpaque(false);
|
||||
|
||||
scroller.setViewportView(this.tabletop);
|
||||
|
||||
@@ -26,8 +26,6 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
import forge.game.player.Player;
|
||||
@@ -73,7 +71,6 @@ public class VField implements IVDoc<CField> {
|
||||
private final PhaseIndicator phaseInidicator = new PhaseIndicator();
|
||||
|
||||
private final Border borderAvatarSimple = new LineBorder(new Color(0, 0, 0, 0), 1);
|
||||
private final Border borderAvatarHover = new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1);
|
||||
private final Border borderAvatarHighlited = new LineBorder(Color.red, 2);
|
||||
|
||||
|
||||
@@ -102,7 +99,7 @@ public class VField implements IVDoc<CField> {
|
||||
control = new CField(player, this, playerViewer);
|
||||
|
||||
avatarArea.setOpaque(false);
|
||||
avatarArea.setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
|
||||
FSkin.get(avatarArea).setBackground(FSkin.getColor(FSkin.Colors.CLR_HOVER));
|
||||
avatarArea.setLayout(new MigLayout("insets 0, gap 0"));
|
||||
avatarArea.add(lblAvatar, "w 100%!, h 70%!, wrap, gaptop 4%");
|
||||
avatarArea.add(lblLife, "w 100%!, h 30%!, gaptop 4%");
|
||||
@@ -113,7 +110,7 @@ public class VField implements IVDoc<CField> {
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
avatarArea.setOpaque(true);
|
||||
if (!isHighlited())
|
||||
avatarArea.setBorder(borderAvatarHover);
|
||||
FSkin.get(avatarArea).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -124,8 +121,7 @@ public class VField implements IVDoc<CField> {
|
||||
}
|
||||
});
|
||||
|
||||
tabletop.setBorder(new MatteBorder(0, 1, 0, 0,
|
||||
FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
FSkin.get(tabletop).setMatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
tabletop.setOpaque(false);
|
||||
|
||||
scroller.setViewportView(this.tabletop);
|
||||
@@ -261,9 +257,12 @@ public class VField implements IVDoc<CField> {
|
||||
detailsPanel.updateDetails();
|
||||
|
||||
this.getLblLife().setText("" + player.getLife());
|
||||
Color lifeFg = player.getLife() <= 5 ? Color.red : FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
this.getLblLife().setForeground(lifeFg);
|
||||
|
||||
if (player.getLife() > 5) {
|
||||
FSkin.get(this.getLblLife()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
else {
|
||||
FSkin.get(this.getLblLife()).setForeground(Color.red);
|
||||
}
|
||||
|
||||
boolean highlited = isHighlited();
|
||||
this.avatarArea.setBorder(highlited ? borderAvatarHighlited : borderAvatarSimple );
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
package forge.gui.match.views;
|
||||
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
@@ -44,9 +42,10 @@ public enum VCombat implements IVDoc<CCombat> {
|
||||
final JTextArea tar = new JTextArea();
|
||||
|
||||
private VCombat() {
|
||||
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
|
||||
tar.setOpaque(false);
|
||||
tar.setBorder(new MatteBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tarSkin.setMatteBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tar.setFocusable(false);
|
||||
tar.setLineWrap(true);
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@ public enum VDetail implements IVDoc<CDetail> {
|
||||
|
||||
// Top-level containers
|
||||
private final CardDetailPanel pnlDetail = new CardDetailPanel(null);
|
||||
private final JLabel lblFlipcard = new JLabel(
|
||||
FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
|
||||
private final JLabel lblFlipcard = new JLabel();
|
||||
|
||||
//========= Constructor
|
||||
private VDetail() {
|
||||
FSkin.get(lblFlipcard).setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
|
||||
lblFlipcard.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.gui.match.views;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@@ -239,9 +238,9 @@ public enum VDev implements IVDoc<CDev> {
|
||||
public class DevLabel extends JLabel {
|
||||
private static final long serialVersionUID = 7917311680519060700L;
|
||||
|
||||
private Color defaultBG = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
private final Color hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final Color pressedBG = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private FSkin.SkinColor defaultBG = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||
private final FSkin.SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final FSkin.SkinColor pressedBG = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private boolean enabled;
|
||||
private final String enabledText, disabledText;
|
||||
private int w, h; // Width, height, radius, insets (for paintComponent)
|
||||
@@ -285,27 +284,27 @@ public enum VDev implements IVDoc<CDev> {
|
||||
this.r = 6; // Radius (for paintComponent)
|
||||
this.i = 2; // Insets (for paintComponent)
|
||||
this.setEnabled(true);
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
DevLabel.this.setBackground(DevLabel.this.pressedBG);
|
||||
FSkin.get(DevLabel.this).setBackground(DevLabel.this.pressedBG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {
|
||||
DevLabel.this.setBackground(DevLabel.this.defaultBG);
|
||||
FSkin.get(DevLabel.this).setBackground(DevLabel.this.defaultBG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
DevLabel.this.setBackground(DevLabel.this.hoverBG);
|
||||
FSkin.get(DevLabel.this).setBackground(DevLabel.this.hoverBG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
DevLabel.this.setBackground(DevLabel.this.defaultBG);
|
||||
FSkin.get(DevLabel.this).setBackground(DevLabel.this.defaultBG);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -330,7 +329,7 @@ public enum VDev implements IVDoc<CDev> {
|
||||
this.enabled = b;
|
||||
this.setText(s);
|
||||
this.setToolTipText(s);
|
||||
this.setBackground(this.defaultBG);
|
||||
FSkin.get(this).setBackground(this.defaultBG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,11 +21,9 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
@@ -36,6 +34,9 @@ import forge.gui.framework.IVDoc;
|
||||
import forge.gui.match.controllers.CDock;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of button dock area.
|
||||
@@ -193,10 +194,11 @@ public enum VDock implements IVDoc<CDock> {
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
private class DockButton extends JLabel {
|
||||
private final Image img;
|
||||
private final Color hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final SkinImage img;
|
||||
private final JLabelSkin<DockButton> skin;
|
||||
private final SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final Color defaultBG = new Color(0, 0, 0, 0);
|
||||
private Color clrBorders = new Color(0, 0, 0, 0);
|
||||
private final Color defaultBorderColor = new Color(0, 0, 0, 0);
|
||||
private int w, h;
|
||||
|
||||
/**
|
||||
@@ -207,12 +209,13 @@ public enum VDock implements IVDoc<CDock> {
|
||||
* @param s0
|
||||
*   Tooltip string
|
||||
*/
|
||||
public DockButton(final ImageIcon i0, final String s0) {
|
||||
public DockButton(final SkinImage i0, final String s0) {
|
||||
super();
|
||||
this.skin = FSkin.get(this);
|
||||
this.setToolTipText(s0);
|
||||
this.setOpaque(false);
|
||||
this.setBackground(this.defaultBG);
|
||||
this.img = i0.getImage();
|
||||
this.img = i0;
|
||||
|
||||
Dimension size = new Dimension(30, 30);
|
||||
this.setMinimumSize(size);
|
||||
@@ -222,13 +225,11 @@ public enum VDock implements IVDoc<CDock> {
|
||||
this.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
DockButton.this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
|
||||
DockButton.this.setBackground(DockButton.this.hoverBG);
|
||||
DockButton.this.skin.setBackground(DockButton.this.hoverBG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
DockButton.this.clrBorders = new Color(0, 0, 0, 0);
|
||||
DockButton.this.setBackground(DockButton.this.defaultBG);
|
||||
}
|
||||
});
|
||||
@@ -245,9 +246,14 @@ public enum VDock implements IVDoc<CDock> {
|
||||
this.h = this.getHeight();
|
||||
g.setColor(this.getBackground());
|
||||
g.fillRect(0, 0, this.w, this.h);
|
||||
g.setColor(this.clrBorders);
|
||||
if (skin.getBackground() == this.hoverBG) {
|
||||
skin.setGraphicsColor(g, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
}
|
||||
else {
|
||||
g.setColor(this.defaultBorderColor);
|
||||
}
|
||||
g.drawRect(0, 0, this.w - 1, this.h - 1);
|
||||
g.drawImage(this.img, 0, 0, this.w, this.h, null);
|
||||
skin.drawImage(g, this.img, 0, 0, this.w, this.h);
|
||||
super.paintComponent(g);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.gui.match.views;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,6 +36,7 @@ import forge.gui.framework.IVDoc;
|
||||
import forge.gui.match.GameLogPanel;
|
||||
import forge.gui.match.controllers.CLog;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinFont;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of game log report.
|
||||
@@ -186,9 +186,8 @@ public enum VLog implements IVDoc<CLog> {
|
||||
}
|
||||
}
|
||||
|
||||
private Font getJTextAreaFont(GameLogEntryType logEntryType) {
|
||||
private SkinFont getJTextAreaFont(GameLogEntryType logEntryType) {
|
||||
boolean isNewTurn = (logEntryType == GameLogEntryType.TURN);
|
||||
return (isNewTurn ? FSkin.getBoldFont() : FSkin.getFont());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import forge.gui.match.controllers.CMessage;
|
||||
import forge.gui.toolbox.FButton;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
/**
|
||||
@@ -69,13 +70,14 @@ public enum VMessage implements IVDoc<CMessage> {
|
||||
.opaque()
|
||||
.build();
|
||||
|
||||
JTextComponentSkin<JTextArea> tarMessageSkin = FSkin.get(tarMessage);
|
||||
tarMessage.setOpaque(false);
|
||||
tarMessage.setFocusable(false);
|
||||
tarMessage.setEditable(false);
|
||||
tarMessage.setLineWrap(true);
|
||||
tarMessage.setWrapStyleWord(true);
|
||||
tarMessage.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tarMessage.setFont(FSkin.getFont(14));
|
||||
tarMessageSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tarMessageSkin.setFont(FSkin.getFont(14));
|
||||
tarMessage.setMargin(new Insets(5, 5, 5, 5));
|
||||
|
||||
// Prevent scroll-bar from automatically scrolling to bottom of JTextArea.
|
||||
|
||||
@@ -43,11 +43,11 @@ public enum VPicture implements IVDoc<CPicture> {
|
||||
|
||||
// Top-level containers
|
||||
private final CardPicturePanel pnlPicture = new CardPicturePanel();
|
||||
private final JLabel lblFlipcard = new JLabel(
|
||||
FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
|
||||
private final JLabel lblFlipcard = new JLabel();
|
||||
|
||||
//========= Constructor
|
||||
private VPicture() {
|
||||
FSkin.get(lblFlipcard).setIcon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_FLIPCARD));
|
||||
pnlPicture.setOpaque(false);
|
||||
lblFlipcard.setVisible(false);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
@@ -96,7 +94,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
|
||||
this.infoLBLs.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords, antes, cmd });
|
||||
|
||||
// Set border on bottom label, and larger font on player name
|
||||
cmd.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
FSkin.get(cmd).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
name.setText(p.getName());
|
||||
}
|
||||
}
|
||||
@@ -195,7 +193,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
|
||||
private class InfoLabel extends JLabel {
|
||||
public InfoLabel() {
|
||||
super();
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,13 +131,10 @@ public enum VStack implements IVDoc<CStack> {
|
||||
tab.setText("Stack : " + stack.size());
|
||||
|
||||
final Border border = new EmptyBorder(5, 5, 5, 5);
|
||||
Color[] scheme;
|
||||
|
||||
stackTARs.clear();
|
||||
boolean isFirst = true;
|
||||
for (final SpellAbilityStackInstance spell : stack) {
|
||||
scheme = getSpellColor(spell);
|
||||
|
||||
String isOptional = spell.getSpellAbility().isOptionalTrigger()
|
||||
&& spell.getSourceCard().getController().getController().getLobbyPlayer().equals(viewer) ? "(OPTIONAL) " : "";
|
||||
String txt = (count++) + ". " + isOptional + spell.getStackDescription();
|
||||
@@ -145,8 +142,7 @@ public enum VStack implements IVDoc<CStack> {
|
||||
tar.setToolTipText(txt);
|
||||
tar.setOpaque(true);
|
||||
tar.setBorder(border);
|
||||
tar.setForeground(scheme[1]);
|
||||
tar.setBackground(scheme[0]);
|
||||
this.setSpellColor(tar, spell);
|
||||
|
||||
tar.setFocusable(false);
|
||||
tar.setEditable(false);
|
||||
@@ -203,23 +199,43 @@ public enum VStack implements IVDoc<CStack> {
|
||||
parentCell.getBody().repaint();
|
||||
}
|
||||
|
||||
/** Returns array with [background, foreground] colors. */
|
||||
private Color[] getSpellColor(SpellAbilityStackInstance s0) {
|
||||
if (s0.getStackDescription().startsWith("Morph "))
|
||||
return new Color[] { new Color(0, 0, 0, 0), FSkin.getColor(FSkin.Colors.CLR_TEXT) };
|
||||
if (CardUtil.getColors(s0.getSourceCard()).isMulticolor())
|
||||
return new Color[] { new Color(253, 175, 63), Color.black };
|
||||
|
||||
if (s0.getSourceCard().isBlack()) return new Color[] { Color.black, Color.white };
|
||||
if (s0.getSourceCard().isBlue()) return new Color[] { new Color(71, 108, 191), Color.white };
|
||||
if (s0.getSourceCard().isGreen()) return new Color[] { new Color(23, 95, 30), Color.white };
|
||||
if (s0.getSourceCard().isRed()) return new Color[] { new Color(214, 8, 8), Color.white };
|
||||
if (s0.getSourceCard().isWhite()) return new Color[] { Color.white, Color.black };
|
||||
|
||||
if (s0.getSourceCard().isArtifact() || s0.getSourceCard().isLand())
|
||||
return new Color[] { new Color(111, 75, 43), Color.white };
|
||||
|
||||
return new Color[] { new Color(0, 0, 0, 0), FSkin.getColor(FSkin.Colors.CLR_TEXT) };
|
||||
private void setSpellColor(JTextArea tar, SpellAbilityStackInstance s0) {
|
||||
if (s0.getStackDescription().startsWith("Morph ")) {
|
||||
tar.setBackground(new Color(0, 0, 0, 0));
|
||||
FSkin.get(tar).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
else if (CardUtil.getColors(s0.getSourceCard()).isMulticolor()) {
|
||||
tar.setBackground(new Color(253, 175, 63));
|
||||
tar.setForeground(Color.black);
|
||||
}
|
||||
else if (s0.getSourceCard().isBlack()) {
|
||||
tar.setBackground(Color.black);
|
||||
tar.setForeground(Color.white);
|
||||
}
|
||||
else if (s0.getSourceCard().isBlue()) {
|
||||
tar.setBackground(new Color(71, 108, 191));
|
||||
tar.setForeground(Color.white);
|
||||
}
|
||||
else if (s0.getSourceCard().isGreen()) {
|
||||
tar.setBackground(new Color(23, 95, 30));
|
||||
tar.setForeground(Color.white);
|
||||
}
|
||||
else if (s0.getSourceCard().isRed()) {
|
||||
tar.setBackground(new Color(214, 8, 8));
|
||||
tar.setForeground(Color.white);
|
||||
}
|
||||
else if (s0.getSourceCard().isWhite()) {
|
||||
tar.setBackground(Color.white);
|
||||
tar.setForeground(Color.black);
|
||||
}
|
||||
else if (s0.getSourceCard().isArtifact() || s0.getSourceCard().isLand()) {
|
||||
tar.setBackground(new Color(111, 75, 43));
|
||||
tar.setForeground(Color.white);
|
||||
}
|
||||
else {
|
||||
tar.setBackground(new Color(0, 0, 0, 0));
|
||||
FSkin.get(tar).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
}
|
||||
|
||||
//========= Custom class handling
|
||||
|
||||
@@ -2,6 +2,7 @@ package forge.gui.menubar;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JFrame;
|
||||
@@ -13,50 +14,73 @@ import forge.gui.menus.ForgeMenu;
|
||||
import forge.gui.menus.HelpMenu;
|
||||
import forge.gui.menus.LayoutMenu;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FMenuBar extends JMenuBar {
|
||||
|
||||
JLabel statusCaption;
|
||||
private String statusText;
|
||||
private JLabel lblStatus;
|
||||
private IMenuProvider provider;
|
||||
|
||||
public FMenuBar(JFrame f) {
|
||||
f.setJMenuBar(this);
|
||||
setPreferredSize(new Dimension(f.getWidth(), 26));
|
||||
setupMenuBar(null);
|
||||
refresh();
|
||||
setStatusText(""); //set default status text
|
||||
}
|
||||
|
||||
public void setupMenuBar(IMenuProvider provider) {
|
||||
public void setupMenuBar(IMenuProvider provider0) {
|
||||
provider = provider0;
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
removeAll();
|
||||
add(ForgeMenu.getMenu());
|
||||
addProviderMenus(provider);
|
||||
addProviderMenus();
|
||||
add(LayoutMenu.getMenu());
|
||||
add(HelpMenu.getMenu());
|
||||
setStatusCaption();
|
||||
repaint();
|
||||
addStatusLabel();
|
||||
revalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a label to the right-hand side of the MenuBar which can
|
||||
* be used to show hints or status information.
|
||||
*/
|
||||
private void setStatusCaption() {
|
||||
private void addStatusLabel() {
|
||||
add(Box.createHorizontalGlue()); // align right hack/patch.
|
||||
statusCaption = new JLabel();
|
||||
statusCaption.setForeground(getForeground());
|
||||
statusCaption.setFont(FSkin.getItalicFont(11));
|
||||
statusCaption.setOpaque(false);
|
||||
add(statusCaption);
|
||||
lblStatus = new JLabel(statusText);
|
||||
JLabelSkin<JLabel> labelSkin = FSkin.get(lblStatus);
|
||||
if (FSkin.isLookAndFeelSet()) {
|
||||
labelSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
else { //ensure status is visible on default menu bar
|
||||
labelSkin.setForeground(getForeground());
|
||||
}
|
||||
labelSkin.setFont(FSkin.getItalicFont(11));
|
||||
lblStatus.setOpaque(false);
|
||||
add(lblStatus);
|
||||
}
|
||||
|
||||
public void setStatusText(String text) {
|
||||
statusCaption.setText(text.trim() + " ");
|
||||
statusText = text.trim();
|
||||
if (statusText.isEmpty()) {
|
||||
statusText = "F1 : hide menu"; //show shortcut to hide menu if no other status to show
|
||||
}
|
||||
statusText += " "; //add padding from right edge of menu bar
|
||||
lblStatus.setText(statusText);
|
||||
}
|
||||
|
||||
private void addProviderMenus(IMenuProvider provider) {
|
||||
if (provider != null && provider.getMenus() != null) {
|
||||
for (JMenu m : provider.getMenus()) {
|
||||
m.setBorderPainted(false);
|
||||
add(m);
|
||||
private void addProviderMenus() {
|
||||
if (provider != null) {
|
||||
List<JMenu> menus = provider.getMenus();
|
||||
if (menus != null) {
|
||||
for (JMenu m : menus) {
|
||||
m.setBorderPainted(false);
|
||||
add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package forge.gui.menubar;
|
||||
import java.awt.Toolkit;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
@@ -36,7 +35,7 @@ public final class MenuUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static ImageIcon getMenuIcon(SkinProp ico) {
|
||||
public static FSkin.SkinIcon getMenuIcon(SkinProp ico) {
|
||||
return ImageUtil.getMenuIcon(FSkin.getIcon(ico));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import javax.swing.ButtonGroup;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
|
||||
import forge.Singletons;
|
||||
@@ -92,25 +91,7 @@ public final class LayoutMenu {
|
||||
private static final ActionListener changeSkin = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String skin = e.getActionCommand();
|
||||
if (!skin.equals(prefs.getPref(FPref.UI_SKIN))) {
|
||||
prefs.setPref(FPref.UI_SKIN, skin);
|
||||
prefs.save();
|
||||
|
||||
Object[] options = {"Restart Now", "Restart Later"};
|
||||
int reply = JOptionPane.showOptionDialog(
|
||||
null,
|
||||
"You must restart Forge for " + skin + " theme to take effect.",
|
||||
"Change Theme",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.INFORMATION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0]);
|
||||
if (reply == JOptionPane.YES_OPTION) {
|
||||
RestartUtil.restartApplication(null);
|
||||
}
|
||||
}
|
||||
FSkin.changeSkin(e.getActionCommand());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -156,7 +137,7 @@ public final class LayoutMenu {
|
||||
}
|
||||
private static JMenuItem getMenuItem_SaveLayout() {
|
||||
JMenuItem menuItem = new JMenuItem("Save Current Layout");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_SAVELAYOUT) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_SAVELAYOUT) : null));
|
||||
menuItem.addActionListener(getSaveLayoutAction());
|
||||
return menuItem;
|
||||
}
|
||||
@@ -172,7 +153,7 @@ public final class LayoutMenu {
|
||||
|
||||
private static JMenuItem getMenuItem_OpenLayout() {
|
||||
JMenuItem menuItem = new JMenuItem("Open...");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_OPENLAYOUT) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_OPENLAYOUT) : null));
|
||||
menuItem.addActionListener(getOpenLayoutAction());
|
||||
return menuItem;
|
||||
}
|
||||
@@ -188,7 +169,7 @@ public final class LayoutMenu {
|
||||
|
||||
private static JMenuItem getMenuItem_RevertLayout() {
|
||||
JMenuItem menuItem = new JMenuItem("Refresh");
|
||||
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_REVERTLAYOUT) : null));
|
||||
FSkin.get(menuItem).setIcon((showIcons ? MenuUtil.getMenuIcon(FSkin.DockIcons.ICO_REVERTLAYOUT) : null));
|
||||
menuItem.addActionListener(getRevertLayoutAction());
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package forge.gui.toolbox;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,6 +27,8 @@ import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostShard;
|
||||
import forge.gui.toolbox.FSkin.ComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -39,7 +40,7 @@ import forge.card.mana.ManaCostShard;
|
||||
*/
|
||||
public class CardFaceSymbols {
|
||||
/** Constant <code>manaImages</code>. */
|
||||
private static final Map<String, Image> MANA_IMAGES = new HashMap<String, Image>();
|
||||
private static final Map<String, SkinImage> MANA_IMAGES = new HashMap<String, SkinImage>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -143,7 +144,7 @@ public class CardFaceSymbols {
|
||||
* @param y
|
||||
* a int.
|
||||
*/
|
||||
public static void draw(Graphics g, ManaCost manaCost, int x, int y) {
|
||||
public static void draw(final ComponentSkin<?> skin, Graphics g, ManaCost manaCost, int x, int y) {
|
||||
if (manaCost.isNoCost()) {
|
||||
return;
|
||||
}
|
||||
@@ -156,12 +157,12 @@ public class CardFaceSymbols {
|
||||
final int offset = 14;
|
||||
if (hasGeneric) {
|
||||
final String sGeneric = Integer.toString(genericManaCost);
|
||||
CardFaceSymbols.drawSymbol(sGeneric, g, xpos, y);
|
||||
CardFaceSymbols.drawSymbol(sGeneric, skin, g, xpos, y);
|
||||
xpos += offset;
|
||||
}
|
||||
|
||||
for (final ManaCostShard s : shards) {
|
||||
CardFaceSymbols.drawSymbol(s.getImageKey(), g, xpos, y);
|
||||
CardFaceSymbols.drawSymbol(s.getImageKey(), skin, g, xpos, y);
|
||||
xpos += offset;
|
||||
}
|
||||
}
|
||||
@@ -176,7 +177,7 @@ public class CardFaceSymbols {
|
||||
* @param w an int
|
||||
* @param h and int
|
||||
*/
|
||||
public static void drawOther(final Graphics g, String s, int x, final int y, final int w, final int h) {
|
||||
public static void drawOther(final ComponentSkin<?> skin, final Graphics g, String s, int x, final int y, final int w, final int h) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -184,13 +185,12 @@ public class CardFaceSymbols {
|
||||
StringTokenizer tok = new StringTokenizer(s, " ");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String symbol = tok.nextToken();
|
||||
Image image = MANA_IMAGES.get(symbol);
|
||||
SkinImage image = MANA_IMAGES.get(symbol);
|
||||
if (image == null) {
|
||||
Log.info("Symbol not recognized \"" + symbol + "\" in string: " + s);
|
||||
continue;
|
||||
}
|
||||
// g.drawImage(image, x, y, null);
|
||||
g.drawImage(image, x, y, w, h, null);
|
||||
skin.drawImage(g, image, x, y, w, h);
|
||||
x += symbol.length() > 2 ? 10 : 14; // slash.png is only 10 pixels
|
||||
// wide.
|
||||
}
|
||||
@@ -208,9 +208,8 @@ public class CardFaceSymbols {
|
||||
* @param y
|
||||
* a int.
|
||||
*/
|
||||
public static void drawAttack(final Graphics g, final int x, final int y) {
|
||||
Image image = MANA_IMAGES.get("attack");
|
||||
g.drawImage(image, x, y, null);
|
||||
public static void drawAttack(final ComponentSkin<?> skin, final Graphics g, final int x, final int y) {
|
||||
skin.drawImage(g, MANA_IMAGES.get("attack"), x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,9 +226,8 @@ public class CardFaceSymbols {
|
||||
* @param y
|
||||
* a int.
|
||||
*/
|
||||
public static void drawSymbol(final String imageName, final Graphics g, final int x, final int y) {
|
||||
Image image = MANA_IMAGES.get(imageName);
|
||||
g.drawImage(image, x, y, null);
|
||||
public static void drawSymbol(final String imageName, final ComponentSkin<?> skin, final Graphics g, final int x, final int y) {
|
||||
skin.drawImage(g, MANA_IMAGES.get(imageName), x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Insets;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.FocusAdapter;
|
||||
@@ -35,6 +34,8 @@ import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
|
||||
import forge.gui.framework.ILocalRepaint;
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
|
||||
/**
|
||||
* The core JButton used throughout the Forge project. Follows skin font and
|
||||
@@ -45,9 +46,10 @@ import forge.gui.framework.ILocalRepaint;
|
||||
public class FButton extends JButton implements ILocalRepaint {
|
||||
|
||||
/** The img r. */
|
||||
private Image imgL;
|
||||
private Image imgM;
|
||||
private Image imgR;
|
||||
private final JComponentSkin<FButton> skin;
|
||||
private SkinImage imgL;
|
||||
private SkinImage imgM;
|
||||
private SkinImage imgR;
|
||||
private int w, h = 0;
|
||||
private boolean allImagesPresent = false;
|
||||
private boolean toggle = false;
|
||||
@@ -65,16 +67,17 @@ public class FButton extends JButton implements ILocalRepaint {
|
||||
public FButton(final String label) {
|
||||
super(label);
|
||||
this.setOpaque(false);
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setBackground(Color.red);
|
||||
skin = FSkin.get(this);
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setBackground(Color.red);
|
||||
this.setFocusPainted(false);
|
||||
this.setBorder(BorderFactory.createEmptyBorder());
|
||||
this.setContentAreaFilled(false);
|
||||
this.setMargin(new Insets(0, 25, 0, 25));
|
||||
this.setFont(FSkin.getBoldFont(14));
|
||||
this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
|
||||
this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
|
||||
this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
|
||||
skin.setFont(FSkin.getBoldFont(14));
|
||||
this.imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT);
|
||||
this.imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER);
|
||||
this.imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT);
|
||||
|
||||
if ((this.imgL != null) && (this.imgM != null) && (this.imgR != null)) {
|
||||
this.allImagesPresent = true;
|
||||
@@ -110,9 +113,9 @@ public class FButton extends JButton implements ILocalRepaint {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent evt) {
|
||||
if (isToggled() || !isEnabled()) { return; }
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DOWN_RIGHT);
|
||||
repaintSelf();
|
||||
}
|
||||
|
||||
@@ -146,27 +149,27 @@ public class FButton extends JButton implements ILocalRepaint {
|
||||
|
||||
private void resetImg() {
|
||||
if (hovered) {
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_OVER_RIGHT);
|
||||
}
|
||||
else if (isFocusOwner()) {
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_FOCUS_RIGHT);
|
||||
} else {
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_UP_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean b0) {
|
||||
if (!b0) {
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT);
|
||||
}
|
||||
else {
|
||||
resetImg();
|
||||
@@ -188,17 +191,17 @@ public class FButton extends JButton implements ILocalRepaint {
|
||||
/** @param b0   boolean. */
|
||||
public void setToggled(boolean b0) {
|
||||
if (b0) {
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_TOGGLE_RIGHT);
|
||||
}
|
||||
else if (isEnabled()) {
|
||||
resetImg();
|
||||
}
|
||||
else {
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT).getImage();
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER).getImage();
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT).getImage();
|
||||
imgL = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_LEFT);
|
||||
imgM = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_CENTER);
|
||||
imgR = FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_DISABLED_RIGHT);
|
||||
}
|
||||
this.toggle = b0;
|
||||
repaintSelf();
|
||||
@@ -230,9 +233,9 @@ public class FButton extends JButton implements ILocalRepaint {
|
||||
w = getWidth();
|
||||
h = getHeight();
|
||||
|
||||
g2d.drawImage(imgL, 0, 0, this.h, this.h, null);
|
||||
g2d.drawImage(imgM, this.h, 0, this.w - (2 * this.h), this.h, null);
|
||||
g2d.drawImage(imgR, this.w - this.h, 0, this.h, this.h, null);
|
||||
skin.drawImage(g2d, imgL, 0, 0, this.h, this.h);
|
||||
skin.drawImage(g2d, imgM, this.h, 0, this.w - (2 * this.h), this.h);
|
||||
skin.drawImage(g2d, imgR, this.w - this.h, 0, this.h, this.h);
|
||||
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package forge.gui.toolbox;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
|
||||
/**
|
||||
* A custom instance of JCheckBox using Forge skin properties.
|
||||
*/
|
||||
@@ -13,8 +15,9 @@ public class FCheckBox extends JCheckBox {
|
||||
|
||||
public FCheckBox(final String s0) {
|
||||
super(s0);
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setFont(FSkin.getFont(14));
|
||||
JComponentSkin<FCheckBox> skin = FSkin.get(this);
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setFont(FSkin.getFont(14));
|
||||
this.setOpaque(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package forge.gui.toolbox;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
@@ -11,22 +13,32 @@ import javax.swing.ListCellRenderer;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
* Panel with combo box and caption (either FComboBoxWrapper or FComboBoxPanel should be used instead of JComboBox so skinning works)
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FComboBoxPanel<E> extends JPanel {
|
||||
|
||||
|
||||
private static ArrayList<FComboBoxPanel<?>> allPanels = new ArrayList<FComboBoxPanel<?>>();
|
||||
|
||||
public static void refreshAllSkins() {
|
||||
for (FComboBoxPanel<?> panel : allPanels) {
|
||||
panel.refreshSkin();
|
||||
}
|
||||
}
|
||||
|
||||
private String comboBoxCaption = "";
|
||||
private JComboBox<E> comboBox = null;
|
||||
|
||||
public FComboBoxPanel(String comboBoxCaption) {
|
||||
super();
|
||||
this.comboBoxCaption = comboBoxCaption;
|
||||
applyLayoutAndSkin();
|
||||
applyLayoutAndSkin();
|
||||
allPanels.add(this);
|
||||
}
|
||||
|
||||
public void setComboBox(JComboBox<E> comboBox, E selectedItem) {
|
||||
@@ -58,10 +70,10 @@ public class FComboBoxPanel<E> extends JPanel {
|
||||
|
||||
private void setLabelLayout() {
|
||||
if (this.comboBoxCaption != null && !this.comboBoxCaption.isEmpty()) {
|
||||
JLabel comboLabel;
|
||||
comboLabel = new JLabel(this.comboBoxCaption);
|
||||
comboLabel.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
comboLabel.setFont(FSkin.getBoldFont(12));
|
||||
JLabel comboLabel = new JLabel(this.comboBoxCaption);
|
||||
JLabelSkin<JLabel> labelSkin = FSkin.get(comboLabel);
|
||||
labelSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
labelSkin.setFont(FSkin.getBoldFont(12));
|
||||
this.add(comboLabel);
|
||||
}
|
||||
}
|
||||
@@ -69,9 +81,10 @@ public class FComboBoxPanel<E> extends JPanel {
|
||||
private void setComboBoxLayout() {
|
||||
if (this.comboBox != null) {
|
||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) {
|
||||
this.comboBox.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
this.comboBox.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.comboBox.setFont(FSkin.getFont(12));
|
||||
FSkin.JComponentSkin<JComboBox<E>> comboBoxSkin = FSkin.get(this.comboBox);
|
||||
comboBoxSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
comboBoxSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
comboBoxSkin.setFont(FSkin.getFont(12));
|
||||
this.comboBox.setRenderer(new ComplexCellRenderer<E>());
|
||||
}
|
||||
this.comboBox.setEditable(false);
|
||||
@@ -80,6 +93,18 @@ public class FComboBoxPanel<E> extends JPanel {
|
||||
this.add(this.comboBox);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectedItem(Object item) {
|
||||
this.comboBox.setSelectedItem(item);
|
||||
}
|
||||
|
||||
public Object getSelectedItem() {
|
||||
return this.comboBox.getSelectedItem();
|
||||
}
|
||||
|
||||
private void refreshSkin() {
|
||||
this.comboBox = FComboBoxWrapper.refreshComboBoxSkin(this.comboBox);
|
||||
}
|
||||
|
||||
private class ComplexCellRenderer<E1> implements ListCellRenderer<E1> {
|
||||
|
||||
@@ -96,12 +121,9 @@ public class FComboBoxPanel<E> extends JPanel {
|
||||
lst0, val0, i0, isSelected, cellHasFocus);
|
||||
|
||||
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
|
||||
lblItem.setFont(FSkin.getFont(12));
|
||||
FSkin.get(lblItem).setFont(FSkin.getFont(12));
|
||||
lblItem.setOpaque(isSelected);
|
||||
return lblItem;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
186
src/main/java/forge/gui/toolbox/FComboBoxWrapper.java
Normal file
186
src/main/java/forge/gui/toolbox/FComboBoxWrapper.java
Normal file
@@ -0,0 +1,186 @@
|
||||
package forge.gui.toolbox;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
/**
|
||||
* Wrapper for combo box with extra logic (either FComboBoxWrapper or FComboBoxPanel should be used instead of JComboBox so skinning works)
|
||||
*
|
||||
*/
|
||||
public class FComboBoxWrapper<E> {
|
||||
|
||||
private static ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();
|
||||
|
||||
public static void refreshAllSkins() {
|
||||
for (FComboBoxWrapper<?> wrapper : allWrappers) {
|
||||
wrapper.refreshSkin();
|
||||
}
|
||||
}
|
||||
|
||||
private JComboBox<E> comboBox;
|
||||
private Object constraints;
|
||||
|
||||
public FComboBoxWrapper() {
|
||||
super();
|
||||
this.comboBox = new JComboBox<E>();
|
||||
allWrappers.add(this);
|
||||
}
|
||||
|
||||
public FComboBoxWrapper(E[] items) {
|
||||
super();
|
||||
this.comboBox = new JComboBox<E>(items);
|
||||
allWrappers.add(this);
|
||||
}
|
||||
|
||||
public FComboBoxWrapper(Vector<E> items) {
|
||||
super();
|
||||
this.comboBox = new JComboBox<E>(items);
|
||||
allWrappers.add(this);
|
||||
}
|
||||
|
||||
public FComboBoxWrapper(ComboBoxModel<E> aModel) {
|
||||
super();
|
||||
this.comboBox = new JComboBox<E>(aModel);
|
||||
allWrappers.add(this);
|
||||
}
|
||||
|
||||
public void addItem(E item) {
|
||||
this.comboBox.addItem(item);
|
||||
}
|
||||
|
||||
public void removeItem(E item) {
|
||||
this.comboBox.removeItem(item);
|
||||
}
|
||||
|
||||
public void removeAllItems() {
|
||||
this.comboBox.removeAllItems();
|
||||
}
|
||||
|
||||
public Object getSelectedItem() {
|
||||
return this.comboBox.getSelectedItem();
|
||||
}
|
||||
|
||||
public void setSelectedItem(Object item) {
|
||||
this.comboBox.setSelectedItem(item);
|
||||
}
|
||||
|
||||
public int getSelectedIndex() {
|
||||
return this.comboBox.getSelectedIndex();
|
||||
}
|
||||
|
||||
public void setSelectedIndex(int index) {
|
||||
this.comboBox.setSelectedIndex(index);
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return this.comboBox.getItemCount();
|
||||
}
|
||||
|
||||
public E getItemAt(int index) {
|
||||
return this.comboBox.getItemAt(index);
|
||||
}
|
||||
|
||||
public void addActionListener(ActionListener l) {
|
||||
this.comboBox.addActionListener(l);
|
||||
}
|
||||
|
||||
public void addItemListener(ItemListener l) {
|
||||
this.comboBox.addItemListener(l);
|
||||
}
|
||||
|
||||
public void addKeyListener(KeyListener l) {
|
||||
this.comboBox.addKeyListener(l);
|
||||
}
|
||||
|
||||
public void setRenderer(ListCellRenderer<? super E> aRenderer) {
|
||||
this.comboBox.setRenderer(aRenderer);
|
||||
}
|
||||
|
||||
public void setVisible(boolean aFlag) {
|
||||
this.comboBox.setVisible(aFlag);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean aFlag) {
|
||||
this.comboBox.setVisible(aFlag);
|
||||
}
|
||||
|
||||
public void addTo(Container container) {
|
||||
addTo(container, null);
|
||||
}
|
||||
|
||||
public void addTo(Container container, Object constraints0) {
|
||||
container.add(this.comboBox, constraints0);
|
||||
this.constraints = constraints0;
|
||||
}
|
||||
|
||||
private void refreshSkin() {
|
||||
this.comboBox = refreshComboBoxSkin(this.comboBox, this.constraints);
|
||||
}
|
||||
|
||||
//refresh combo box skin by replacing it with a copy of itself
|
||||
//TODO: Figure out if there's a better way, as calling updateUI doesn't seem to work
|
||||
public static <E> JComboBox<E> refreshComboBoxSkin(JComboBox<E> comboBox) {
|
||||
return refreshComboBoxSkin(comboBox, null);
|
||||
}
|
||||
public static <E> JComboBox<E> refreshComboBoxSkin(JComboBox<E> comboBox, Object constraints) {
|
||||
//find index of combo box within parent
|
||||
Container parent = comboBox.getParent();
|
||||
if (parent == null) { return comboBox; }
|
||||
|
||||
int index;
|
||||
for (index = 0; index < parent.getComponentCount(); index++) {
|
||||
if (parent.getComponent(index) == comboBox) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//create copy of combo box
|
||||
JComboBox<E> newComboBox = new JComboBox<E>();
|
||||
for (int i = 0; i < comboBox.getItemCount(); i++) {
|
||||
newComboBox.addItem(comboBox.getItemAt(i));
|
||||
}
|
||||
newComboBox.setSelectedIndex(comboBox.getSelectedIndex());
|
||||
|
||||
ActionListener[] actionListeners = newComboBox.getActionListeners();
|
||||
for (ActionListener l : actionListeners) {
|
||||
newComboBox.removeActionListener(l); //remove default action listeners to prevent duplicates
|
||||
}
|
||||
actionListeners = comboBox.getActionListeners();
|
||||
for (ActionListener l : actionListeners) {
|
||||
newComboBox.addActionListener(l);
|
||||
}
|
||||
|
||||
ItemListener[] itemListeners = newComboBox.getItemListeners();
|
||||
for (ItemListener l : itemListeners) {
|
||||
newComboBox.removeItemListener(l); //remove default item listener to prevent duplicates
|
||||
}
|
||||
itemListeners = comboBox.getItemListeners();
|
||||
for (ItemListener l : itemListeners) {
|
||||
newComboBox.addItemListener(l);
|
||||
}
|
||||
|
||||
KeyListener[] keyListeners = newComboBox.getKeyListeners();
|
||||
for (KeyListener l : keyListeners) {
|
||||
newComboBox.removeKeyListener(l); //remove default key listeners to prevent duplicates
|
||||
}
|
||||
keyListeners = comboBox.getKeyListeners();
|
||||
for (KeyListener l : keyListeners) {
|
||||
newComboBox.addKeyListener(l);
|
||||
}
|
||||
|
||||
newComboBox.setRenderer(comboBox.getRenderer());
|
||||
|
||||
//replace combo box with its copy so skin updated
|
||||
parent.remove(index);
|
||||
parent.add(newComboBox, constraints, index);
|
||||
return newComboBox;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
package forge.gui.toolbox;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
@@ -31,6 +29,9 @@ import javax.swing.event.AncestorListener;
|
||||
|
||||
import forge.Command;
|
||||
import forge.gui.framework.ILocalRepaint;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
|
||||
/**
|
||||
* Uses the Builder pattern to facilitate/encourage inline styling.
|
||||
@@ -76,7 +77,7 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
private boolean bldEnabled = true;
|
||||
|
||||
protected String bldText, bldToolTip;
|
||||
private ImageIcon bldIcon;
|
||||
private SkinImage bldIcon;
|
||||
private int bldFontAlign;
|
||||
protected Command bldCmd;
|
||||
|
||||
@@ -93,9 +94,9 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
* @return {@link forge.gui.toolbox.Builder} */
|
||||
public Builder tooltip(final String s0) { this.bldToolTip = s0; return this; }
|
||||
|
||||
/**@param i0   {@link javax.swing.ImageIcon}
|
||||
/**@param i0   {@link forge.gui.toolbox.FSkin.SkinIcon}
|
||||
* @return {@link forge.gui.toolbox.Builder} */
|
||||
public Builder icon(final ImageIcon i0) { this.bldIcon = i0; return this; }
|
||||
public Builder icon(final SkinImage i0) { this.bldIcon = i0; return this; }
|
||||
|
||||
/**@param i0   SwingConstants.CENTER, .LEFT, or .RIGHT
|
||||
* @return {@link forge.gui.toolbox.Builder} */
|
||||
@@ -186,6 +187,8 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
// Call this using FLabel.Builder()...
|
||||
protected FLabel(final Builder b0) {
|
||||
super(b0.bldText);
|
||||
|
||||
this.skin = FSkin.get(this);
|
||||
|
||||
// Init fields from builder
|
||||
this.iconScaleFactor = b0.bldIconScaleFactor;
|
||||
@@ -230,8 +233,8 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
|
||||
if (b0.bldUseSkinColors) {
|
||||
// Non-custom display properties
|
||||
this.setForeground(clrText);
|
||||
this.setBackground(clrMain);
|
||||
this.skin.setForeground(clrText);
|
||||
this.skin.setBackground(clrMain);
|
||||
}
|
||||
|
||||
// Resize adapter
|
||||
@@ -245,15 +248,16 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
|
||||
//========== Variable initialization
|
||||
// Final inits
|
||||
private final Color clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final Color clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
private final Color clrMain = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private final Color d50 = FSkin.stepColor(clrMain, -50);
|
||||
private final Color d30 = FSkin.stepColor(clrMain, -30);
|
||||
private final Color d10 = FSkin.stepColor(clrMain, -10);
|
||||
private final Color l10 = FSkin.stepColor(clrMain, 10);
|
||||
private final Color l20 = FSkin.stepColor(clrMain, 20);
|
||||
private final Color l30 = FSkin.stepColor(clrMain, 30);
|
||||
private final JLabelSkin<FLabel> skin;
|
||||
private final SkinColor clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||
private final SkinColor clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
private final SkinColor clrMain = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private final SkinColor d50 = clrMain.stepColor(-50);
|
||||
private final SkinColor d30 = clrMain.stepColor(-30);
|
||||
private final SkinColor d10 = clrMain.stepColor(-10);
|
||||
private final SkinColor l10 = clrMain.stepColor(10);
|
||||
private final SkinColor l20 = clrMain.stepColor(20);
|
||||
private final SkinColor l30 = clrMain.stepColor(30);
|
||||
|
||||
// Custom properties, assigned either at realization (using builder)
|
||||
// or dynamically (using methods below).
|
||||
@@ -391,9 +395,9 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
|
||||
private void setFontSize(final int i0) {
|
||||
switch(this.fontStyle) {
|
||||
case Font.BOLD: this.setFont(FSkin.getBoldFont(i0)); break;
|
||||
case Font.ITALIC: this.setFont(FSkin.getItalicFont(i0)); break;
|
||||
default: this.setFont(FSkin.getFont(i0));
|
||||
case Font.BOLD: skin.setFont(FSkin.getBoldFont(i0)); break;
|
||||
case Font.ITALIC: skin.setFont(FSkin.getItalicFont(i0)); break;
|
||||
default: skin.setFont(FSkin.getFont(i0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,21 +443,31 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
return this.cmdRightClick;
|
||||
}
|
||||
|
||||
public void setIcon(FSkin.SkinImage icon) {
|
||||
this.skin.setIcon(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Must be public.
|
||||
public void setIcon(final Icon i0) {
|
||||
if (i0 == null) { this.img = null; return; }
|
||||
// Will need image (not icon) for scaled and non-scaled.
|
||||
if (iconInBackground) { this.img = ((ImageIcon) i0).getImage(); }
|
||||
// Will need image if not in background, but scaled.
|
||||
else if (iconScaleAuto) { this.img = ((ImageIcon) i0).getImage(); }
|
||||
// If not in background, not scaled, can use original icon.
|
||||
else { super.setIcon(i0); }
|
||||
|
||||
if (img != null) {
|
||||
iw = img.getWidth(null);
|
||||
ih = img.getHeight(null);
|
||||
iar = ((double) iw) / ((double) ih);
|
||||
if (iconInBackground || iconScaleAuto) {
|
||||
if (i0 != null) {
|
||||
img = ((ImageIcon) i0).getImage();
|
||||
iw = img.getWidth(null);
|
||||
ih = img.getHeight(null);
|
||||
iar = ((double) iw) / ((double) ih);
|
||||
}
|
||||
else {
|
||||
img = null;
|
||||
iw = 0;
|
||||
ih = 0;
|
||||
iar = 0;
|
||||
}
|
||||
}
|
||||
else { // If not in background, not scaled, can use original icon.
|
||||
super.setIcon(i0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,38 +552,36 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
||||
}
|
||||
|
||||
private void paintFocus(final Graphics2D g, int w, int h) {
|
||||
g.setColor(clrHover);
|
||||
skin.setGraphicsColor(g, clrHover);
|
||||
g.drawRect(0, 0, w - 2, h - 2);
|
||||
g.setColor(l30);
|
||||
skin.setGraphicsColor(g, l30);
|
||||
g.drawRect(1, 1, w - 4, h - 4);
|
||||
}
|
||||
|
||||
private void paintUp(final Graphics2D g, int w, int h) {
|
||||
GradientPaint gradient = new GradientPaint(0, h, d10, 0, 0, l20);
|
||||
g.setPaint(gradient);
|
||||
skin.setGraphicsGradientPaint(g, 0, h, d10, 0, 0, l20);
|
||||
g.fillRect(0, 0, w, h);
|
||||
|
||||
g.setColor(d50);
|
||||
skin.setGraphicsColor(g, d50);
|
||||
g.drawRect(0, 0, w - 2, h - 2);
|
||||
g.setColor(l10);
|
||||
skin.setGraphicsColor(g, l10);
|
||||
g.drawRect(1, 1, w - 4, h - 4);
|
||||
}
|
||||
|
||||
private void paintBorder(final Graphics2D g, int w, int h) {
|
||||
g.setColor(l10);
|
||||
skin.setGraphicsColor(g, l10);
|
||||
g.drawRect(0, 0, w - 2, h - 2);
|
||||
g.setColor(l30);
|
||||
skin.setGraphicsColor(g, l30);
|
||||
g.drawRect(1, 1, w - 4, h - 4);
|
||||
}
|
||||
|
||||
private void paintDown(final Graphics2D g, int w, int h) {
|
||||
GradientPaint gradient = new GradientPaint(0, h, d30, 0, 0, l10);
|
||||
g.setPaint(gradient);
|
||||
skin.setGraphicsGradientPaint(g, 0, h, d30, 0, 0, l10);
|
||||
g.fillRect(0, 0, w - 1, h - 1);
|
||||
|
||||
g.setColor(d30);
|
||||
skin.setGraphicsColor(g, d30);
|
||||
g.drawRect(0, 0, w - 2, h - 2);
|
||||
g.setColor(l10);
|
||||
skin.setGraphicsColor(g, l10);
|
||||
g.drawRect(1, 1, w - 4, h - 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class FList<E> extends JList<E> {
|
||||
* TODO: Write javadoc for this method.
|
||||
*/
|
||||
private void applySkin() {
|
||||
setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
|
||||
ListCellRenderer<E> renderer = new ComplexCellRenderer<E>();
|
||||
setCellRenderer(renderer);
|
||||
@@ -61,10 +61,11 @@ public class FList<E> extends JList<E> {
|
||||
JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
|
||||
lst0, val0, i0, isSelected, cellHasFocus);
|
||||
|
||||
FSkin.JLabelSkin<JLabel> lblItemSkin = FSkin.get(lblItem);
|
||||
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
|
||||
lblItem.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
|
||||
lblItem.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
lblItem.setFont(FSkin.getFont(13));
|
||||
lblItemSkin.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
|
||||
lblItemSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
lblItemSkin.setFont(FSkin.getFont(13));
|
||||
lblItem.setOpaque(isSelected);
|
||||
return lblItem;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.gui.toolbox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
@@ -36,6 +35,7 @@ import javax.swing.SwingConstants;
|
||||
|
||||
import forge.Command;
|
||||
import forge.gui.framework.ILocalRepaint;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
|
||||
/**
|
||||
* Core panel used in UI.
|
||||
@@ -51,13 +51,14 @@ import forge.gui.framework.ILocalRepaint;
|
||||
@SuppressWarnings("serial")
|
||||
public class FPanel extends JPanel implements ILocalRepaint {
|
||||
//========== Variable initialization
|
||||
protected final FSkin.FPanelSkin<FPanel> skin;
|
||||
// Defaults for adjustable values
|
||||
private boolean selectable = false;
|
||||
private boolean hoverable = false;
|
||||
private boolean foregroundStretch = false;
|
||||
private Image foregroundImage = null;
|
||||
private Image backgroundTexture = null;
|
||||
private Color borderColor = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
|
||||
private FSkin.SkinColor borderColor = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
|
||||
private boolean borderToggle = true;
|
||||
private int cornerDiameter = 20;
|
||||
private int foregroundAlign = SwingConstants.CENTER;
|
||||
@@ -85,7 +86,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
this.setOpaque(false);
|
||||
|
||||
// Background will follow skin theme.
|
||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
skin = FSkin.get(this);
|
||||
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
}
|
||||
|
||||
// Mouse event handler
|
||||
@@ -138,13 +140,15 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
/** @param bool0   boolean */
|
||||
public void setSelected(final boolean bool0) {
|
||||
selected = bool0;
|
||||
if (bool0) { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
||||
else { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||
if (bool0) { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
||||
else { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||
repaintSelf();
|
||||
}
|
||||
|
||||
/** @param img0   {@link java.awt.Image} */
|
||||
public void setForegroundImage(final Image img0) {
|
||||
skin.resetForegroundImage(); //must reset if non-skin image set
|
||||
|
||||
if (img0 == null) {
|
||||
this.foregroundImage = null;
|
||||
return;
|
||||
@@ -161,6 +165,11 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
setForegroundImage(ii0.getImage());
|
||||
}
|
||||
|
||||
/** @param ii0   {@link javax.swing.ImageIcon} */
|
||||
public void setForegroundImage(final SkinImage skinImage) {
|
||||
skin.setForegroundImage(skinImage);
|
||||
}
|
||||
|
||||
/** Aligns NON-STRETCHED foreground image.
|
||||
* Must use SwingConstants.
|
||||
* @param i0   int
|
||||
@@ -186,6 +195,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
|
||||
/** @param img0   {@link java.awt.Image} */
|
||||
public void setBackgroundTexture(final Image img0) {
|
||||
skin.resetBackgroundTexture(); //must reset if non-skin image set
|
||||
|
||||
if (img0 == null) { return; }
|
||||
|
||||
this.backgroundTexture = img0;
|
||||
@@ -197,14 +208,19 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
public void setBackgroundTexture(final ImageIcon ii0) {
|
||||
setBackgroundTexture(ii0.getImage());
|
||||
}
|
||||
|
||||
/** @param ii0   {@link javax.swing.ImageIcon} */
|
||||
public void setBackgroundTexture(final SkinImage skinImage) {
|
||||
skin.setBackgroundTexture(skinImage);
|
||||
}
|
||||
|
||||
/** @param bool0   boolean */
|
||||
public void setBorderToggle(final boolean bool0) {
|
||||
this.borderToggle = bool0;
|
||||
}
|
||||
|
||||
/** @param clr0   {@link java.awt.Color} */
|
||||
public void setBorderColor(final Color clr0) {
|
||||
/** @param clr0   {@link forge.gui.toolbox.FSkin.SkinColor} */
|
||||
public void setBorderColor(final FSkin.SkinColor clr0) {
|
||||
this.borderColor = clr0;
|
||||
}
|
||||
|
||||
@@ -260,10 +276,10 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
//========== Special draw methods
|
||||
private void drawBackgroundColor(final Graphics2D g2d0) {
|
||||
// Color background as appropriate
|
||||
if (selected) { g2d0.setColor(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
||||
else if (hovered) { g2d0.setColor(FSkin.getColor(FSkin.Colors.CLR_HOVER)); }
|
||||
else if (selectable) { g2d0.setColor(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||
else { g2d0.setColor(getBackground()); }
|
||||
if (selected) { skin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
||||
else if (hovered) { skin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_HOVER)); }
|
||||
else if (selectable) { skin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||
else { skin.setGraphicsColor(g2d0, skin.getBackground()); }
|
||||
|
||||
g2d0.fillRoundRect(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter);
|
||||
}
|
||||
@@ -327,7 +343,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
||||
}
|
||||
|
||||
private void drawBorder(final Graphics2D g2d0) {
|
||||
g2d0.setColor(borderColor);
|
||||
skin.setGraphicsColor(g2d0, borderColor);
|
||||
g2d0.drawRoundRect(0, 0, pnlW - 1, pnlH - 1, cornerDiameter, cornerDiameter);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package forge.gui.toolbox;
|
||||
|
||||
import javax.swing.JRadioButton;
|
||||
|
||||
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||
|
||||
/**
|
||||
* A custom instance of JRadioButton using Forge skin properties.
|
||||
*/
|
||||
@@ -16,8 +18,9 @@ public class FRadioButton extends JRadioButton {
|
||||
public FRadioButton(String s0) {
|
||||
super();
|
||||
this.setText(s0);
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setFont(FSkin.getFont(14));
|
||||
JComponentSkin<FRadioButton> skin = FSkin.get(this);
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setFont(FSkin.getFont(14));
|
||||
this.setOpaque(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.awt.Component;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
/**
|
||||
* A very basic extension of JScrollPane to centralize common styling changes.
|
||||
@@ -33,7 +32,7 @@ public class FScrollPane extends JScrollPane {
|
||||
super(c0, vertical0, horizontal0);
|
||||
getVerticalScrollBar().setUnitIncrement(16);
|
||||
getViewport().setOpaque(false);
|
||||
setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1));
|
||||
FSkin.get(this).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||
setOpaque(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.LayoutManager;
|
||||
@@ -40,6 +39,8 @@ import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.Timer;
|
||||
|
||||
import forge.gui.framework.ILocalRepaint;
|
||||
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinColor;
|
||||
|
||||
/**
|
||||
* An extension of JScrollPane that can be used as a panel and supports using arrow buttons to scroll instead of scrollbars
|
||||
@@ -195,12 +196,13 @@ public class FScrollPanel extends JScrollPane {
|
||||
}
|
||||
|
||||
private abstract class ArrowButton extends JLabel implements ILocalRepaint {
|
||||
private final Color clrFore = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
private final Color clrBack = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private final Color d50 = FSkin.stepColor(clrBack, -50);
|
||||
private final Color d10 = FSkin.stepColor(clrBack, -10);
|
||||
private final Color l10 = FSkin.stepColor(clrBack, 10);
|
||||
private final Color l20 = FSkin.stepColor(clrBack, 20);
|
||||
private final JLabelSkin<ArrowButton> skin;
|
||||
private final SkinColor clrFore = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||
private final SkinColor clrBack = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||
private final SkinColor d50 = clrBack.stepColor(-50);
|
||||
private final SkinColor d10 = clrBack.stepColor(-10);
|
||||
private final SkinColor l10 = clrBack.stepColor(10);
|
||||
private final SkinColor l20 = clrBack.stepColor(20);
|
||||
private final AlphaComposite alphaDefault = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f);
|
||||
private final AlphaComposite alphaHovered = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f);
|
||||
protected final int arrowSize = 6;
|
||||
@@ -210,6 +212,7 @@ public class FScrollPanel extends JScrollPane {
|
||||
|
||||
protected ArrowButton(final JScrollBar scrollBar0, final int incrementDirection0) {
|
||||
super("");
|
||||
skin = FSkin.get(this);
|
||||
scrollBar = scrollBar0;
|
||||
incrementDirection = incrementDirection0;
|
||||
timer.setInitialDelay(500); //wait half a second after mouse down before starting timer
|
||||
@@ -235,16 +238,15 @@ public class FScrollPanel extends JScrollPane {
|
||||
Composite oldComp = g2d.getComposite();
|
||||
g2d.setComposite(hovered ? alphaHovered : alphaDefault);
|
||||
|
||||
GradientPaint gradient = new GradientPaint(0, h, d10, 0, 0, l20);
|
||||
g2d.setPaint(gradient);
|
||||
skin.setGraphicsGradientPaint(g2d, 0, h, d10, 0, 0, l20);
|
||||
g.fillRect(0, 0, w, h);
|
||||
|
||||
g.setColor(d50);
|
||||
skin.setGraphicsColor(g, d50);
|
||||
g.drawRect(0, 0, w - 1, h - 1);
|
||||
g.setColor(l10);
|
||||
skin.setGraphicsColor(g, l10);
|
||||
g.drawRect(1, 1, w - 3, h - 3);
|
||||
|
||||
g.setColor(clrFore);
|
||||
skin.setGraphicsColor(g, clrFore);
|
||||
drawArrow(g);
|
||||
|
||||
super.paintComponent(g);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,9 +37,10 @@ public class FSpinner extends JSpinner {
|
||||
this.setEditor(new JSpinner.NumberEditor(this, "##"));
|
||||
JFormattedTextField txt = ((JSpinner.NumberEditor)this.getEditor()).getTextField();
|
||||
((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false);
|
||||
txt.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
txt.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
txt.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.JTextComponentSkin<JFormattedTextField> txtSkin = FSkin.get(txt);
|
||||
txtSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
txtSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
txtSkin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
txt.setMargin(new Insets(5, 5, 5, 5));
|
||||
txt.setOpaque(true);
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ public class FTabbedPane extends JTabbedPane {
|
||||
private static final long serialVersionUID = 2207172560817790885L;
|
||||
|
||||
public FTabbedPane() {
|
||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.JComponentSkin<FTabbedPane> skin = FSkin.get(this);
|
||||
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,9 @@ public class FTextArea extends JTextArea {
|
||||
/** */
|
||||
public FTextArea() {
|
||||
super();
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
FSkin.JTextComponentSkin<FTextArea> skin = FSkin.get(this);
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setOpaque(false);
|
||||
this.setWrapStyleWord(true);
|
||||
this.setLineWrap(true);
|
||||
|
||||
@@ -49,14 +49,16 @@ public class FTextField extends JTextField {
|
||||
}
|
||||
|
||||
public static final int HEIGHT = 25; //TODO: calculate this somehow instead of hard-coding it
|
||||
|
||||
|
||||
private final FSkin.JTextComponentSkin<FTextField> skin;
|
||||
private String ghostText;
|
||||
private boolean showGhostTextWithFocus;
|
||||
|
||||
private FTextField(Builder builder) {
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin = FSkin.get(this);
|
||||
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
this.setMargin(new Insets(3, 3, 2, 3));
|
||||
this.setOpaque(true);
|
||||
|
||||
@@ -115,7 +117,7 @@ public class FTextField extends JTextField {
|
||||
final Insets margin = this.getMargin();
|
||||
final Graphics2D g2d = (Graphics2D)g.create();
|
||||
g2d.setFont(this.getFont());
|
||||
g2d.setColor(FSkin.stepColor(this.getForeground(), 20));
|
||||
skin.setGraphicsColor(g2d, skin.getForeground().stepColor(20));
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.drawString(this.ghostText, margin.left + 2, margin.top + 15); //account for borders (TODO: why +15?)
|
||||
g2d.dispose();
|
||||
|
||||
@@ -25,6 +25,7 @@ import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.ImageCache;
|
||||
import forge.gui.toolbox.CardFaceSymbols;
|
||||
import forge.gui.toolbox.FSkin.ComponentSkin;
|
||||
|
||||
/**
|
||||
* Common image-related routines specific to Forge images.
|
||||
@@ -35,11 +36,11 @@ import forge.gui.toolbox.CardFaceSymbols;
|
||||
public final class FImageUtil {
|
||||
private FImageUtil() {}
|
||||
|
||||
public static BufferedImage getImage(Card card, CardCharacteristicName state) {
|
||||
public static BufferedImage getImage(Card card, CardCharacteristicName state, ComponentSkin<?> skin) {
|
||||
BufferedImage image = ImageCache.getOriginalImage(card.getImageKey(state), true);
|
||||
int foilIndex = card.getFoil();
|
||||
if (image != null && foilIndex > 0) {
|
||||
image = getImageWithFoilEffect(image, foilIndex);
|
||||
image = getImageWithFoilEffect(image, foilIndex, skin);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
@@ -52,11 +53,11 @@ public final class FImageUtil {
|
||||
* For double-sided cards, returns the front-side image.<br>
|
||||
* For flip cards, returns the un-flipped image.
|
||||
*/
|
||||
public static BufferedImage getImage(Card card) {
|
||||
public static BufferedImage getImage(Card card, ComponentSkin<?> skin) {
|
||||
BufferedImage image = ImageCache.getOriginalImage(card.getImageKey(), true);
|
||||
int foilIndex = card.getFoil();
|
||||
if (image != null && foilIndex > 0) {
|
||||
image = getImageWithFoilEffect(image, foilIndex);
|
||||
image = getImageWithFoilEffect(image, foilIndex, skin);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
@@ -64,11 +65,11 @@ public final class FImageUtil {
|
||||
/**
|
||||
* Applies a foil effect to a card image.
|
||||
*/
|
||||
private static BufferedImage getImageWithFoilEffect(BufferedImage plainImage, int foilIndex) {
|
||||
private static BufferedImage getImageWithFoilEffect(BufferedImage plainImage, int foilIndex, ComponentSkin<?> skin) {
|
||||
ColorModel cm = plainImage.getColorModel();
|
||||
BufferedImage foilImage = new BufferedImage(cm, plainImage.copyData(null), cm.isAlphaPremultiplied(), null);
|
||||
final String fl = String.format("foil%02d", foilIndex);
|
||||
CardFaceSymbols.drawOther(foilImage.getGraphics(), fl, 0, 0, foilImage.getWidth(), foilImage.getHeight());
|
||||
CardFaceSymbols.drawOther(skin, foilImage.getGraphics(), fl, 0, 0, foilImage.getWidth(), foilImage.getHeight());
|
||||
return foilImage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
package forge.gui.toolbox.imaging;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import forge.gui.toolbox.FSkin.SkinIcon;
|
||||
|
||||
/**
|
||||
* Useful general imaging routines.
|
||||
@@ -32,10 +30,8 @@ import javax.swing.ImageIcon;
|
||||
public final class ImageUtil {
|
||||
private ImageUtil() {}
|
||||
|
||||
public static ImageIcon getMenuIcon(ImageIcon sourceIcon) {
|
||||
Image img = sourceIcon.getImage();
|
||||
Image newimg = img.getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH);
|
||||
return new ImageIcon(newimg);
|
||||
public static SkinIcon getMenuIcon(SkinIcon sourceIcon) {
|
||||
return sourceIcon.resize(16, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forge.gui.toolbox.itemmanager;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
@@ -11,6 +9,7 @@ import forge.card.CardRulesPredicates;
|
||||
import forge.gui.deckeditor.views.VCardCatalog;
|
||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.item.ItemPoolView;
|
||||
@@ -48,12 +47,12 @@ public final class SItemManagerUtil {
|
||||
INSTANT (FSkin.EditorImages.IMG_INSTANT, CardRulesPredicates.Presets.IS_INSTANT, 2),
|
||||
SORCERY (FSkin.EditorImages.IMG_SORCERY, CardRulesPredicates.Presets.IS_SORCERY, 2);
|
||||
|
||||
public final ImageIcon img;
|
||||
public final SkinImage img;
|
||||
public final Predicate<CardRules> predicate;
|
||||
public final int group;
|
||||
|
||||
StatTypes(FSkin.SkinProp prop, Predicate<CardRules> pred, int grp) {
|
||||
img = new ImageIcon(FSkin.getImage(prop, 18, 18));
|
||||
img = FSkin.getImage(prop, 18, 18);
|
||||
predicate = pred;
|
||||
group = grp;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.gui.toolbox.itemmanager.filters;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
@@ -31,7 +30,7 @@ public abstract class ItemFilter<T extends InventoryItem> {
|
||||
if (this.panel == null) {
|
||||
this.panel = new JPanel(new MigLayout("insets 0, gap 2"));
|
||||
this.panel.setOpaque(false);
|
||||
this.panel.setBorder(BorderFactory.createMatteBorder(1, 2, 1, 2, FSkin.getColor(FSkin.Colors.CLR_TEXT)));
|
||||
FSkin.get(this.panel).setMatteBorder(1, 2, 1, 2, FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
|
||||
this.lblPanelTitle = new FLabel.Builder().fontSize(10).build();
|
||||
this.panel.add(this.lblPanelTitle, "top");
|
||||
|
||||
@@ -3,11 +3,11 @@ package forge.gui.toolbox.itemmanager.filters;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import forge.Command;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FSkin.SkinImage;
|
||||
import forge.gui.toolbox.itemmanager.ItemManager;
|
||||
import forge.gui.toolbox.itemmanager.SItemManagerUtil.StatTypes;
|
||||
import forge.item.InventoryItem;
|
||||
@@ -30,7 +30,7 @@ public abstract class ToggleButtonsFilter<T extends InventoryItem> extends ItemF
|
||||
addToggleButton(panel, s.toLabelString(), s.img);
|
||||
}
|
||||
|
||||
protected void addToggleButton(JPanel panel, String filterName, ImageIcon icon) {
|
||||
protected void addToggleButton(JPanel panel, String filterName, SkinImage icon) {
|
||||
final FLabel button = new FLabel.Builder()
|
||||
.icon(icon).iconScaleAuto(false)
|
||||
.fontSize(11)
|
||||
|
||||
@@ -53,6 +53,7 @@ import forge.item.InventoryItem;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public final class ItemTable<T extends InventoryItem> extends JTable {
|
||||
private final FSkin.JTableSkin<ItemTable<T>> skin;
|
||||
private final ItemManager<T> itemManager;
|
||||
private final ItemTableModel<T> tableModel;
|
||||
|
||||
@@ -71,19 +72,20 @@ public final class ItemTable<T extends InventoryItem> extends JTable {
|
||||
this.tableModel = new ItemTableModel<T>(this, model0);
|
||||
|
||||
// use different selection highlight colors for focused vs. unfocused tables
|
||||
setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
skin = FSkin.get(this);
|
||||
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
skin.setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
if (!e.isTemporary()) {
|
||||
setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||
// if nothing selected when we gain focus, select the first row (if exists)
|
||||
if (-1 == getSelectedRow() && 0 < getRowCount()) {
|
||||
setRowSelectionInterval(0, 0);
|
||||
@@ -91,7 +93,7 @@ public final class ItemTable<T extends InventoryItem> extends JTable {
|
||||
}
|
||||
});
|
||||
|
||||
setFont(FSkin.getFont(12));
|
||||
skin.setFont(FSkin.getFont(12));
|
||||
setBorder(null);
|
||||
getTableHeader().setBorder(null);
|
||||
setRowHeight(18);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user