mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Refactor skin colors and support tracking skinned components
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -15129,7 +15129,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/IncorrectPacketSrv.java -text
|
||||||
src/main/java/forge/net/protocol/toserver/package-info.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/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/ForgePreferences.java svneol=native#text/plain
|
||||||
src/main/java/forge/properties/NewConstants.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
|
src/main/java/forge/properties/Preferences.java svneol=native#text/plain
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ import forge.gui.menubar.FMenuBar;
|
|||||||
import forge.gui.menubar.MenuUtil;
|
import forge.gui.menubar.MenuUtil;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
import forge.properties.ForgeLookAndFeel;
|
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
@@ -175,11 +174,6 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
// Preloads skin components (using progress bar).
|
// Preloads skin components (using progress bar).
|
||||||
FSkin.loadFull();
|
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();
|
|
||||||
|
|
||||||
createMenuBar();
|
createMenuBar();
|
||||||
|
|
||||||
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts();
|
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts();
|
||||||
@@ -223,11 +217,6 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
manager.addKeyEventDispatcher(this);
|
manager.addKeyEventDispatcher(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setForgeLookAndFeel() {
|
|
||||||
ForgeLookAndFeel laf = new ForgeLookAndFeel();
|
|
||||||
laf.setForgeLookAndFeel(Singletons.getView().getFrame());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createMenuBar() {
|
private void createMenuBar() {
|
||||||
this.menuBar = new FMenuBar(Singletons.getView().getFrame());
|
this.menuBar = new FMenuBar(Singletons.getView().getFrame());
|
||||||
this.menuBar.setVisible(MenuUtil.isMenuBarVisible());
|
this.menuBar.setVisible(MenuUtil.isMenuBarVisible());
|
||||||
|
|||||||
@@ -91,8 +91,9 @@ public class CardDetailPanel extends FPanel {
|
|||||||
labelConstrains.weightx = 1.0;
|
labelConstrains.weightx = 1.0;
|
||||||
|
|
||||||
final JPanel cdLabels = new JPanel(new GridLayout(0, 1, 0, 5));
|
final JPanel cdLabels = new JPanel(new GridLayout(0, 1, 0, 5));
|
||||||
cdLabels.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
final FSkin.JComponentSkin<JPanel> cdLabelsSkin = FSkin.get(cdLabels);
|
||||||
cdLabels.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
cdLabelsSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||||
|
cdLabelsSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.nameCostLabel = new FLabel.Builder().build();
|
this.nameCostLabel = new FLabel.Builder().build();
|
||||||
this.typeLabel = new FLabel.Builder().build();
|
this.typeLabel = new FLabel.Builder().build();
|
||||||
this.powerToughnessLabel = new FLabel.Builder().build();
|
this.powerToughnessLabel = new FLabel.Builder().build();
|
||||||
@@ -101,8 +102,9 @@ public class CardDetailPanel extends FPanel {
|
|||||||
cdLabels.add(this.powerToughnessLabel);
|
cdLabels.add(this.powerToughnessLabel);
|
||||||
|
|
||||||
final JPanel idr = new JPanel(new GridBagLayout());
|
final JPanel idr = new JPanel(new GridBagLayout());
|
||||||
idr.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
FSkin.JComponentSkin<JPanel> idrSkin = FSkin.get(idr);
|
||||||
idr.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
idrSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||||
|
idrSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
final GridBagConstraints c1 = new GridBagConstraints();
|
final GridBagConstraints c1 = new GridBagConstraints();
|
||||||
final GridBagConstraints c2 = new GridBagConstraints();
|
final GridBagConstraints c2 = new GridBagConstraints();
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ public class DualListBox<T> extends FPanel {
|
|||||||
|
|
||||||
setPreferredSize(new Dimension(650, 300));
|
setPreferredSize(new Dimension(650, 300));
|
||||||
setLayout(new GridLayout(0, 3));
|
setLayout(new GridLayout(0, 3));
|
||||||
setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
this.skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
this.skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
|
||||||
final Runnable onAdd = new Runnable() {
|
final Runnable onAdd = new Runnable() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.awt.event.ActionListener;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
@@ -68,10 +67,11 @@ public enum FNetOverlay {
|
|||||||
* Semi-transparent overlay panel. Should be used with layered panes.
|
* Semi-transparent overlay panel. Should be used with layered panes.
|
||||||
*/
|
*/
|
||||||
private FNetOverlay() {
|
private FNetOverlay() {
|
||||||
|
FSkin.JComponentSkin<JPanel> pnlSkin = FSkin.get(pnl);
|
||||||
pnl.setOpaque(false);
|
pnl.setOpaque(false);
|
||||||
pnl.setVisible(false);
|
pnl.setVisible(false);
|
||||||
pnl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
pnlSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||||
pnl.setBorder(BorderFactory.createLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
pnlSkin.setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
|
|
||||||
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 2"));
|
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 2"));
|
||||||
// pnl.add(new FLabel.Builder().text("Loading new game...").fontSize(22).build(), "h 40px!, align center");
|
// pnl.add(new FLabel.Builder().text("Loading new game...").fontSize(22).build(), "h 40px!, align center");
|
||||||
@@ -80,7 +80,7 @@ public enum FNetOverlay {
|
|||||||
|
|
||||||
txtLog.setOpaque(true);
|
txtLog.setOpaque(true);
|
||||||
txtLog.setFocusable(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);
|
JScrollPane _operationLogScroller = new JScrollPane(txtLog);
|
||||||
_operationLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
_operationLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||||
@@ -88,7 +88,7 @@ public enum FNetOverlay {
|
|||||||
new SmartScroller(_operationLogScroller);
|
new SmartScroller(_operationLogScroller);
|
||||||
pnl.add(_operationLogScroller, "pushx, hmin 24, pushy, growy, growx, gap 2px 2px 2px 0, sx 2");
|
pnl.add(_operationLogScroller, "pushx, hmin 24, pushy, growy, growx, gap 2px 2px 2px 0, sx 2");
|
||||||
|
|
||||||
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(txtInput, "pushx, growx, h 26px!, gap 2px 2px 2px 0");
|
||||||
pnl.add(cmdSend, "w 60px!, h 28px!, gap 0 0 2px 0");
|
pnl.add(cmdSend, "w 60px!, h 28px!, gap 0 0 2px 0");
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.match.TargetingOverlay;
|
import forge.gui.match.TargetingOverlay;
|
||||||
@@ -44,7 +42,7 @@ public final class SOverlayUtils {
|
|||||||
// (which is preset with null layout and close button)
|
// (which is preset with null layout and close button)
|
||||||
final FPanel pnl = new FPanel();
|
final FPanel pnl = new FPanel();
|
||||||
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap"));
|
pnl.setLayout(new MigLayout("insets 0, gap 0, ax center, wrap"));
|
||||||
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.setBounds(new Rectangle(((w - pnlW) / 2), ((h - pnlH) / 2), pnlW, pnlH));
|
||||||
|
|
||||||
pnl.add(new FLabel.Builder().icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_LOGO)).build(),
|
pnl.add(new FLabel.Builder().icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_LOGO)).build(),
|
||||||
@@ -70,7 +68,7 @@ public final class SOverlayUtils {
|
|||||||
|
|
||||||
final JLabel lblLoading = new JLabel("");
|
final JLabel lblLoading = new JLabel("");
|
||||||
lblLoading.setOpaque(true);
|
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));
|
lblLoading.setMinimumSize(new Dimension(0, 20));
|
||||||
|
|
||||||
pnlLoading.setBounds(((w - 170) / 2), ((h - 80) / 2), 170, 80);
|
pnlLoading.setBounds(((w - 170) / 2), ((h - 80) / 2), 170, 80);
|
||||||
@@ -104,9 +102,10 @@ public final class SOverlayUtils {
|
|||||||
final int w = overlay.getWidth();
|
final int w = overlay.getWidth();
|
||||||
|
|
||||||
final JButton btnCloseTopRight = new JButton("X");
|
final JButton btnCloseTopRight = new JButton("X");
|
||||||
|
final FSkin.JComponentSkin<JButton> btnCloseTopRightSkin = FSkin.get(btnCloseTopRight);
|
||||||
btnCloseTopRight.setBounds(w - 25, 10, 15, 15);
|
btnCloseTopRight.setBounds(w - 25, 10, 15, 15);
|
||||||
btnCloseTopRight.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
btnCloseTopRightSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
btnCloseTopRight.setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT), 1));
|
btnCloseTopRightSkin.setLineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
btnCloseTopRight.setOpaque(false);
|
btnCloseTopRight.setOpaque(false);
|
||||||
btnCloseTopRight.setBackground(new Color(0, 0, 0));
|
btnCloseTopRight.setBackground(new Color(0, 0, 0));
|
||||||
btnCloseTopRight.setFocusPainted(false);
|
btnCloseTopRight.setFocusPainted(false);
|
||||||
|
|||||||
@@ -439,7 +439,12 @@ public enum CDeckEditorUI implements ICDoc, IMenuProvider {
|
|||||||
|
|
||||||
// show a popup with the current search string, highlighted in red if not found
|
// show a popup with the current search string, highlighted in red if not found
|
||||||
popupLabel.setText(searchStr + " (hit Enter for next match, Esc to cancel)");
|
popupLabel.setText(searchStr + " (hit Enter for next match, Esc to cancel)");
|
||||||
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) {
|
if (popupShowing) {
|
||||||
_setPopupSize();
|
_setPopupSize();
|
||||||
@@ -448,7 +453,7 @@ public enum CDeckEditorUI implements ICDoc, IMenuProvider {
|
|||||||
PopupFactory factory = PopupFactory.getSharedInstance();
|
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||||
Point tableLoc = tableView.getTable().getTableHeader().getLocationOnScreen();
|
Point tableLoc = tableView.getTable().getTableHeader().getLocationOnScreen();
|
||||||
popup = factory.getPopup(null, popupLabel, tableLoc.x + 10, tableLoc.y + 10);
|
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() {
|
popupTimer = new Timer(5000, new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.awt.FlowLayout;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -264,7 +263,7 @@ public enum VCardCatalog implements IVDoc<CCardCatalog> {
|
|||||||
final JPanel pnl = new JPanel(new MigLayout("insets 2, gap 2, h 30!"));
|
final JPanel pnl = new JPanel(new MigLayout("insets 2, gap 2, h 30!"));
|
||||||
|
|
||||||
pnl.setOpaque(false);
|
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(component, "h 30!, center");
|
||||||
pnl.add(new FLabel.Builder().text("X").fontSize(10).hoverable(true)
|
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.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.gui.deckeditor.controllers.CEditorPreferences;
|
import forge.gui.deckeditor.controllers.CEditorPreferences;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
@@ -74,10 +72,10 @@ public enum VEditorPreferences implements IVDoc<CEditorPreferences> {
|
|||||||
|
|
||||||
//========== Constructor
|
//========== Constructor
|
||||||
private VEditorPreferences() {
|
private VEditorPreferences() {
|
||||||
lblStats.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));
|
||||||
lblCatalog.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
FSkin.get(lblCatalog).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
lblDeck.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
FSkin.get(lblDeck).setMatteBorder(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(lblDisplay).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
|
|
||||||
chbCatalogColor.setFont(FSkin.getFont(12));
|
chbCatalogColor.setFont(FSkin.getFont(12));
|
||||||
chbCatalogRarity.setFont(FSkin.getFont(12));
|
chbCatalogRarity.setFont(FSkin.getFont(12));
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.deck.DeckBase;
|
import forge.deck.DeckBase;
|
||||||
import forge.gui.deckeditor.CDeckEditorUI;
|
import forge.gui.deckeditor.CDeckEditorUI;
|
||||||
@@ -66,10 +64,13 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
|
|||||||
scroller.getViewport().setBorder(null);
|
scroller.getViewport().setBorder(null);
|
||||||
scroller.getVerticalScrollBar().setUnitIncrement(16);
|
scroller.getVerticalScrollBar().setUnitIncrement(16);
|
||||||
|
|
||||||
lblSampleHand.setBorder(new MatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
FSkin.JComponentSkin<JLabel> labelSkin = FSkin.get(lblSampleHand);
|
||||||
lblSampleHand.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
labelSkin.setMatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
lblRemainingDraws.setBorder(new MatteBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
labelSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
lblRemainingDraws.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
|
// Core layout
|
||||||
pnlContent.add(lblReshuffle, "w 96%!, h 29px!, gap 2% 0 5px 5px");
|
pnlContent.add(lblReshuffle, "w 96%!, h 29px!, gap 2% 0 5px 5px");
|
||||||
@@ -188,7 +189,7 @@ public enum VProbabilities implements IVDoc<CProbabilities> {
|
|||||||
|
|
||||||
if (zebra) {
|
if (zebra) {
|
||||||
lbl.setOpaque(true);
|
lbl.setOpaque(true);
|
||||||
lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lbl;
|
return lbl;
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ public enum VStatistics implements IVDoc<CStatistics> {
|
|||||||
|
|
||||||
if (zebra) {
|
if (zebra) {
|
||||||
lbl.setOpaque(true);
|
lbl.setOpaque(true);
|
||||||
lbl.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lbl).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lbl;
|
return lbl;
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import javax.swing.JTextField;
|
|||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
|
|||||||
radProxySocks.addChangeListener(new ProxyHandler(2));
|
radProxySocks.addChangeListener(new ProxyHandler(2));
|
||||||
radProxyNone.setSelected(true);
|
radProxyNone.setSelected(true);
|
||||||
|
|
||||||
btnClose.setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT), 1));
|
FSkin.get(btnClose).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
btnStart.setFont(FSkin.getFont(18));
|
btnStart.setFont(FSkin.getFont(18));
|
||||||
btnStart.setVisible(false);
|
btnStart.setVisible(false);
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import forge.gui.toolbox.FSkin;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public final class DragTab extends JLabel implements ILocalRepaint {
|
public final class DragTab extends JLabel implements ILocalRepaint {
|
||||||
|
private final FSkin.JComponentSkin<DragTab> skin;
|
||||||
private boolean selected = false;
|
private boolean selected = false;
|
||||||
private int priority = 10;
|
private int priority = 10;
|
||||||
|
|
||||||
@@ -27,11 +28,12 @@ public final class DragTab extends JLabel implements ILocalRepaint {
|
|||||||
*/
|
*/
|
||||||
public DragTab(final String title0) {
|
public DragTab(final String title0) {
|
||||||
super(title0);
|
super(title0);
|
||||||
|
skin = FSkin.get(this);
|
||||||
setToolTipText(title0);
|
setToolTipText(title0);
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setSelected(false);
|
setSelected(false);
|
||||||
setBorder(new EmptyBorder(2, 5, 2, 5));
|
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.addMouseListener(SRearrangingUtil.getRearrangeClickEvent());
|
||||||
this.addMouseMotionListener(SRearrangingUtil.getRearrangeDragEvent());
|
this.addMouseMotionListener(SRearrangingUtil.getRearrangeDragEvent());
|
||||||
@@ -76,15 +78,15 @@ public final class DragTab extends JLabel implements ILocalRepaint {
|
|||||||
@Override
|
@Override
|
||||||
public void paintComponent(final Graphics g) {
|
public void paintComponent(final Graphics g) {
|
||||||
if (!selected) {
|
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.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);
|
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() * 2, 6, 6);
|
||||||
}
|
}
|
||||||
else {
|
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.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);
|
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() * 2, 6, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package forge.gui.home;
|
package forge.gui.home;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
@@ -14,6 +12,8 @@ import javax.swing.JLabel;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.framework.ILocalRepaint;
|
import forge.gui.framework.ILocalRepaint;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,12 +28,13 @@ public class LblGroup extends JLabel implements ILocalRepaint {
|
|||||||
|
|
||||||
private boolean hovered = false;
|
private boolean hovered = false;
|
||||||
|
|
||||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
private final JComponentSkin<LblGroup> skin;
|
||||||
private final Color l20 = FSkin.stepColor(clrTheme, 20);
|
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||||
private final Color l25 = FSkin.stepColor(clrTheme, 25);
|
private final SkinColor l20 = clrTheme.stepColor(20);
|
||||||
private final Color l40 = FSkin.stepColor(clrTheme, 40);
|
private final SkinColor l25 = clrTheme.stepColor(25);
|
||||||
private final Color d20 = FSkin.stepColor(clrTheme, -20);
|
private final SkinColor l40 = clrTheme.stepColor(40);
|
||||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
private final SkinColor d20 = clrTheme.stepColor(-20);
|
||||||
|
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom JLabel for title of menu item groups.
|
* Custom JLabel for title of menu item groups.
|
||||||
@@ -45,8 +46,9 @@ public class LblGroup extends JLabel implements ILocalRepaint {
|
|||||||
|
|
||||||
super(" " + e0.getTitle());
|
super(" " + e0.getTitle());
|
||||||
|
|
||||||
|
skin = FSkin.get(this);
|
||||||
this.setFont(FSkin.getBoldFont(14));
|
this.setFont(FSkin.getBoldFont(14));
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
|
||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -128,16 +130,15 @@ public class LblGroup extends JLabel implements ILocalRepaint {
|
|||||||
int w = getWidth();
|
int w = getWidth();
|
||||||
int h = getHeight();
|
int h = getHeight();
|
||||||
|
|
||||||
g.setColor(l20);
|
skin.setGraphicsColor(g, l20);
|
||||||
g.fillRect(0, 0, getWidth(), getHeight());
|
g.fillRect(0, 0, getWidth(), getHeight());
|
||||||
|
|
||||||
GradientPaint edge = new GradientPaint(w - 10, 0, l25, w, 0, d80, false);
|
skin.setGraphicsGradientPaint(g2d, w - 10, 0, l25, w, 0, d80);
|
||||||
g2d.setPaint(edge);
|
|
||||||
g2d.fillRect(w - 10, 0, w, h);
|
g2d.fillRect(w - 10, 0, w, h);
|
||||||
|
|
||||||
g2d.setColor(l40);
|
skin.setGraphicsColor(g, l40);
|
||||||
g2d.drawLine(0, 0, w - 6, 0);
|
g2d.drawLine(0, 0, w - 6, 0);
|
||||||
g2d.setColor(d20);
|
skin.setGraphicsColor(g, d20);
|
||||||
g2d.drawLine(0, h - 1, w - 6, h - 1);
|
g2d.drawLine(0, h - 1, w - 6, h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.gui.home;
|
package forge.gui.home;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
|
||||||
@@ -8,16 +7,19 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standardized header label for top of menu display panel.
|
* Standardized header label for top of menu display panel.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class LblHeader extends JLabel {
|
public class LblHeader extends JLabel {
|
||||||
private final Color clr = FSkin.stepColor(FSkin.getColor(FSkin.Colors.CLR_THEME), 0);
|
private final JComponentSkin<LblHeader> skin;
|
||||||
private final Color a100 = FSkin.alphaColor(clr, 100);
|
private final SkinColor clr = FSkin.getColor(FSkin.Colors.CLR_THEME).stepColor(0);
|
||||||
private final Color d40 = FSkin.stepColor(clr, -40);
|
private final SkinColor a100 = clr.alphaColor(100);
|
||||||
private final Color d80 = FSkin.stepColor(clr, -80);
|
private final SkinColor d40 = clr.stepColor(-40);
|
||||||
|
private final SkinColor d80 = clr.stepColor(-80);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -25,7 +27,8 @@ public class LblHeader extends JLabel {
|
|||||||
*/
|
*/
|
||||||
public LblHeader(final String txt0) {
|
public LblHeader(final String txt0) {
|
||||||
super(txt0);
|
super(txt0);
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin = FSkin.get(this);
|
||||||
|
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setFont(FSkin.getFont(18));
|
this.setFont(FSkin.getFont(18));
|
||||||
this.setBorder(new EmptyBorder(5, 30, 0, 0));
|
this.setBorder(new EmptyBorder(5, 30, 0, 0));
|
||||||
}
|
}
|
||||||
@@ -36,13 +39,13 @@ public class LblHeader extends JLabel {
|
|||||||
int w = getWidth();
|
int w = getWidth();
|
||||||
int h = getHeight();
|
int h = getHeight();
|
||||||
|
|
||||||
g2d.setColor(d80);
|
skin.setGraphicsColor(g2d, d80);
|
||||||
g2d.fillRect(0, 5, w, h - 5);
|
g2d.fillRect(0, 5, w, h - 5);
|
||||||
|
|
||||||
g2d.setColor(a100);
|
skin.setGraphicsColor(g2d, a100);
|
||||||
g2d.fillRect(5, 0, w - 5, h - 5);
|
g2d.fillRect(5, 0, w - 5, h - 5);
|
||||||
|
|
||||||
g2d.setColor(d40);
|
skin.setGraphicsColor(g2d, d40);
|
||||||
g2d.drawRect(5, 0, w - 6, h - 6);
|
g2d.drawRect(5, 0, w - 6, h - 6);
|
||||||
|
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package forge.gui.home;
|
package forge.gui.home;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
@@ -13,6 +11,8 @@ import javax.swing.JLabel;
|
|||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.framework.ILocalRepaint;
|
import forge.gui.framework.ILocalRepaint;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom JLabel for an item in the menu. Handles listening
|
* 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 selected = false;
|
||||||
private boolean hovered = false;
|
private boolean hovered = false;
|
||||||
|
|
||||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
private final JComponentSkin<LblMenuItem> skin;
|
||||||
private final Color l00 = FSkin.stepColor(clrTheme, 0);
|
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||||
private final Color l20 = FSkin.stepColor(clrTheme, 20);
|
private final SkinColor l00 = clrTheme.stepColor(0);
|
||||||
private final Color d20 = FSkin.stepColor(clrTheme, -20);
|
private final SkinColor l20 = clrTheme.stepColor(20);
|
||||||
private final Color d60 = FSkin.stepColor(clrTheme, -60);
|
private final SkinColor d20 = clrTheme.stepColor(-20);
|
||||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
private final SkinColor d60 = clrTheme.stepColor(-60);
|
||||||
|
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||||
private final GradientPaint edge = new GradientPaint(200 - 8, 0, l00, 200, 0, d80, false);
|
private final SkinColor alpha100 = l00.alphaColor(100);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom JLabel for an item in the menu. Handles listening
|
* 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) {
|
public LblMenuItem(final IVSubmenu<? extends ICDoc> doc0) {
|
||||||
super(" " + doc0.getMenuTitle());
|
super(" " + doc0.getMenuTitle());
|
||||||
|
|
||||||
|
skin = FSkin.get(this);
|
||||||
this.setFont(FSkin.getFont(14));
|
this.setFont(FSkin.getFont(14));
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
|
||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -82,23 +84,23 @@ public class LblMenuItem extends JLabel implements ILocalRepaint {
|
|||||||
int h = getHeight();
|
int h = getHeight();
|
||||||
|
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
g2d.setColor(FSkin.alphaColor(l00, 100));
|
skin.setGraphicsColor(g2d, alpha100);
|
||||||
g2d.fillRect(0, 0, w, h);
|
g2d.fillRect(0, 0, w, h);
|
||||||
g2d.setColor(d20);
|
skin.setGraphicsColor(g2d, d20);
|
||||||
g2d.drawLine(0, 0, w - 3, 0);
|
g2d.drawLine(0, 0, w - 3, 0);
|
||||||
g2d.setColor(l20);
|
skin.setGraphicsColor(g2d, l20);
|
||||||
g2d.drawLine(0, h - 1, w - 3, h - 1);
|
g2d.drawLine(0, h - 1, w - 3, h - 1);
|
||||||
}
|
}
|
||||||
else if (this.hovered) {
|
else if (this.hovered) {
|
||||||
g2d.setColor(d60);
|
skin.setGraphicsColor(g2d, d60);
|
||||||
g2d.fillRect(0, 0, getWidth(), h);
|
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.fillRect(w - 2, 0, w, h);
|
||||||
|
|
||||||
g2d.setColor(d20);
|
skin.setGraphicsColor(g2d, d20);
|
||||||
g2d.drawLine(0, 0, w - 3, 0);
|
g2d.drawLine(0, 0, w - 3, 0);
|
||||||
g2d.setColor(l20);
|
skin.setGraphicsColor(g2d, l20);
|
||||||
g2d.drawLine(0, h - 1, w - 3, h - 1);
|
g2d.drawLine(0, h - 1, w - 3, h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package forge.gui.home;
|
package forge.gui.home;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
|
||||||
@@ -10,6 +8,8 @@ import javax.swing.JPanel;
|
|||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom JPanel for containing LblMenuItem components.
|
* Custom JPanel for containing LblMenuItem components.
|
||||||
@@ -17,20 +17,22 @@ import forge.gui.toolbox.FSkin;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class PnlGroup extends JPanel {
|
public class PnlGroup extends JPanel {
|
||||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
private final JComponentSkin<PnlGroup> skin;
|
||||||
private final Color l00 = FSkin.stepColor(clrTheme, 0);
|
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||||
private final Color l10 = FSkin.stepColor(clrTheme, 10);
|
private final SkinColor l00 = clrTheme.stepColor(0);
|
||||||
private final Color d20 = FSkin.stepColor(clrTheme, -20);
|
private final SkinColor l10 = clrTheme.stepColor(10);
|
||||||
private final Color d60 = FSkin.stepColor(clrTheme, -60);
|
private final SkinColor d20 = clrTheme.stepColor(-20);
|
||||||
private final Color d80 = FSkin.stepColor(clrTheme, -80);
|
private final SkinColor d60 = clrTheme.stepColor(-60);
|
||||||
|
private final SkinColor d80 = clrTheme.stepColor(-80);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom JPanel for containing LblMenuItem components.
|
* Custom JPanel for containing LblMenuItem components.
|
||||||
* Mostly just handles repainting.
|
* Mostly just handles repainting.
|
||||||
*/
|
*/
|
||||||
public PnlGroup() {
|
public PnlGroup() {
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
this.setLayout(new MigLayout("insets 10px 0 10px 0, gap 0, wrap"));
|
this.setLayout(new MigLayout("insets 10px 0 10px 0, gap 0, wrap"));
|
||||||
this.setBackground(d20);
|
this.skin.setBackground(d20);
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,15 +46,14 @@ public class PnlGroup extends JPanel {
|
|||||||
final int w = getWidth();
|
final int w = getWidth();
|
||||||
final int h = getHeight();
|
final int h = getHeight();
|
||||||
|
|
||||||
g2d.setColor(d20);
|
skin.setGraphicsColor(g2d, d20);
|
||||||
|
|
||||||
// Selected in this group, don't draw background under selected label.
|
// Selected in this group, don't draw background under selected label.
|
||||||
if (getY() < yTop && yTop < getY() + h) {
|
if (getY() < yTop && yTop < getY() + h) {
|
||||||
g2d.fillRect(0, 0, w, lbl.getY());
|
g2d.fillRect(0, 0, w, lbl.getY());
|
||||||
g2d.fillRect(0, lbl.getY() + lbl.getHeight(), w, h);
|
g2d.fillRect(0, lbl.getY() + lbl.getHeight(), w, h);
|
||||||
|
|
||||||
GradientPaint edge = new GradientPaint(w - 8, 0, l00, w, 0, d80, false);
|
skin.setGraphicsGradientPaint(g2d, w - 8, 0, l00, w, 0, d80);
|
||||||
g2d.setPaint(edge);
|
|
||||||
g2d.fillRect(w - 6, 0, w, lbl.getY());
|
g2d.fillRect(w - 6, 0, w, lbl.getY());
|
||||||
g2d.fillRect(w - 6, lbl.getY() + lbl.getHeight(), w, h);
|
g2d.fillRect(w - 6, lbl.getY() + lbl.getHeight(), w, h);
|
||||||
}
|
}
|
||||||
@@ -60,15 +61,14 @@ public class PnlGroup extends JPanel {
|
|||||||
else {
|
else {
|
||||||
g2d.fillRect(0, 0, w, h);
|
g2d.fillRect(0, 0, w, h);
|
||||||
|
|
||||||
GradientPaint edge = new GradientPaint(w - 8, 0, l00, w, 0, d80, false);
|
skin.setGraphicsGradientPaint(g2d, w - 8, 0, l00, w, 0, d80);
|
||||||
g2d.setPaint(edge);
|
|
||||||
g2d.fillRect(w - 6, 0, w, h);
|
g2d.fillRect(w - 6, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
g2d.setColor(l10);
|
skin.setGraphicsColor(g2d, l10);
|
||||||
g2d.drawLine(0, h - 1, w - 1, h - 1);
|
g2d.drawLine(0, h - 1, w - 1, h - 1);
|
||||||
|
|
||||||
g2d.setColor(d60);
|
skin.setGraphicsColor(g2d, d60);
|
||||||
g2d.drawLine(0, 0, w - 1, 0);
|
g2d.drawLine(0, 0, w - 1, 0);
|
||||||
|
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
|
|||||||
@@ -17,9 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package forge.gui.home;
|
package forge.gui.home;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -33,6 +31,7 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.framework.EDocID;
|
import forge.gui.framework.EDocID;
|
||||||
@@ -61,6 +60,8 @@ import forge.gui.home.variant.VSubmenuVanguard;
|
|||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
import forge.gui.toolbox.FScrollPanel;
|
import forge.gui.toolbox.FScrollPanel;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.view.FView;
|
import forge.view.FView;
|
||||||
@@ -77,8 +78,8 @@ public enum VHomeUI implements IVTopLevelUI {
|
|||||||
/** */
|
/** */
|
||||||
SINGLETON_INSTANCE;
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
||||||
private final Color l00 = FSkin.stepColor(clrTheme, 0);
|
private final SkinColor l00 = clrTheme.stepColor(0);
|
||||||
|
|
||||||
private final List<IVSubmenu<? extends ICDoc>> allSubmenus = new ArrayList<IVSubmenu<? extends ICDoc>>();
|
private final List<IVSubmenu<? extends ICDoc>> allSubmenus = new ArrayList<IVSubmenu<? extends ICDoc>>();
|
||||||
private final Map<EDocID, LblMenuItem> allSubmenuLabels = new HashMap<EDocID, LblMenuItem>();
|
private final Map<EDocID, LblMenuItem> allSubmenuLabels = new HashMap<EDocID, LblMenuItem>();
|
||||||
@@ -188,7 +189,7 @@ public enum VHomeUI implements IVTopLevelUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pnlMenu.add(pnlSubmenus, "w 100%!, h 100% - " + pnlMainMenuHeight + "px!");
|
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} */
|
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
|
||||||
@@ -279,9 +280,11 @@ public enum VHomeUI implements IVTopLevelUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class PnlMenu extends JPanel {
|
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() {
|
public PnlMenu() {
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
this.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
this.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
}
|
}
|
||||||
@@ -313,15 +316,14 @@ public enum VHomeUI implements IVTopLevelUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g2d.setColor(l00);
|
skin.setGraphicsColor(g2d, l00);
|
||||||
g2d.fillRect(0, y1, w, h1);
|
g2d.fillRect(0, y1, w, h1);
|
||||||
if (h2 > 0) {
|
if (h2 > 0) {
|
||||||
g2d.fillRect(0, y2, w, h2);
|
g2d.fillRect(0, y2, w, h2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = w - 8;
|
int x = w - 8;
|
||||||
GradientPaint edge = new GradientPaint(x, 0, l00, w, 0, d80, false);
|
skin.setGraphicsGradientPaint(g2d, x, 0, l00, w, 0, d80);
|
||||||
g2d.setPaint(edge);
|
|
||||||
g2d.fillRect(x, y1, w, h1);
|
g2d.fillRect(x, y1, w, h1);
|
||||||
if (h2 > 0) {
|
if (h2 > 0) {
|
||||||
g2d.fillRect(x, y2, w, h2);
|
g2d.fillRect(x, y2, w, h2);
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.gauntlet.GauntletData;
|
import forge.gauntlet.GauntletData;
|
||||||
@@ -30,7 +28,8 @@ public class ContestGauntletLister extends JPanel {
|
|||||||
private RowPanel previousSelect;
|
private RowPanel previousSelect;
|
||||||
private RowPanel[] rows;
|
private RowPanel[] rows;
|
||||||
private Command cmdRowSelect;
|
private Command cmdRowSelect;
|
||||||
private final Color clrDefault, clrHover, clrActive, clrBorders;
|
private final Color clrDefault;
|
||||||
|
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public ContestGauntletLister() {
|
public ContestGauntletLister() {
|
||||||
@@ -61,7 +60,7 @@ public class ContestGauntletLister extends JPanel {
|
|||||||
// Note: careful with the widths of the rows here;
|
// Note: careful with the widths of the rows here;
|
||||||
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
||||||
final JPanel rowTitle = new JPanel();
|
final 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.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
rowTitle.add(new FLabel.Builder().build(),
|
rowTitle.add(new FLabel.Builder().build(),
|
||||||
"w 30px!, h 20px!, gap 1% 0 5px 0");
|
"w 30px!, h 20px!, gap 1% 0 5px 0");
|
||||||
@@ -129,21 +128,21 @@ public class ContestGauntletLister extends JPanel {
|
|||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setBackground(new Color(0, 0, 0, 0));
|
setBackground(new Color(0, 0, 0, 0));
|
||||||
setLayout(new MigLayout("insets 0, gap 0"));
|
setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
setBorder(new MatteBorder(0, 0, 1, 0, clrBorders));
|
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
|
||||||
gauntletData = gd0;
|
gauntletData = gd0;
|
||||||
|
|
||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(clrHover);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
|
||||||
((RowPanel) e.getSource()).setOpaque(true);
|
((RowPanel) e.getSource()).setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(clrDefault);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
|
||||||
((RowPanel) e.getSource()).setOpaque(false);
|
((RowPanel) e.getSource()).setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +156,7 @@ public class ContestGauntletLister extends JPanel {
|
|||||||
public void setSelected(boolean b0) {
|
public void setSelected(boolean b0) {
|
||||||
selected = b0;
|
selected = b0;
|
||||||
setOpaque(b0);
|
setOpaque(b0);
|
||||||
setBackground(b0 ? clrActive : clrHover);
|
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelected() {
|
public boolean isSelected() {
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.gauntlet.GauntletData;
|
import forge.gauntlet.GauntletData;
|
||||||
@@ -35,7 +33,8 @@ public class QuickGauntletLister extends JPanel {
|
|||||||
private RowPanel previousSelect;
|
private RowPanel previousSelect;
|
||||||
private RowPanel[] rows;
|
private RowPanel[] rows;
|
||||||
private Command cmdRowSelect, cmdRowDelete;
|
private Command cmdRowSelect, cmdRowDelete;
|
||||||
private final Color clrDefault, clrHover, clrActive, clrBorders;
|
private final Color clrDefault;
|
||||||
|
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public QuickGauntletLister() {
|
public QuickGauntletLister() {
|
||||||
@@ -70,7 +69,7 @@ public class QuickGauntletLister extends JPanel {
|
|||||||
// Note: careful with the widths of the rows here;
|
// Note: careful with the widths of the rows here;
|
||||||
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
||||||
final JPanel rowTitle = new JPanel();
|
final 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.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
rowTitle.add(new FLabel.Builder().build(),
|
rowTitle.add(new FLabel.Builder().build(),
|
||||||
"w 30px!, h 20px!, gap 1% 0 5px 0");
|
"w 30px!, h 20px!, gap 1% 0 5px 0");
|
||||||
@@ -140,14 +139,14 @@ public class QuickGauntletLister extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(clrHover);
|
FSkin.get(r0).setBackground(clrHover);
|
||||||
r0.setOpaque(true);
|
r0.setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(clrDefault);
|
FSkin.get(r0).setBackground(clrDefault);
|
||||||
r0.setOpaque(false);
|
r0.setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,21 +167,21 @@ public class QuickGauntletLister extends JPanel {
|
|||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setBackground(new Color(0, 0, 0, 0));
|
setBackground(new Color(0, 0, 0, 0));
|
||||||
setLayout(new MigLayout("insets 0, gap 0"));
|
setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
setBorder(new MatteBorder(0, 0, 1, 0, clrBorders));
|
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
|
||||||
gauntletData = gd0;
|
gauntletData = gd0;
|
||||||
|
|
||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(clrHover);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
|
||||||
((RowPanel) e.getSource()).setOpaque(true);
|
((RowPanel) e.getSource()).setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(clrDefault);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
|
||||||
((RowPanel) e.getSource()).setOpaque(false);
|
((RowPanel) e.getSource()).setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +195,7 @@ public class QuickGauntletLister extends JPanel {
|
|||||||
public void setSelected(boolean b0) {
|
public void setSelected(boolean b0) {
|
||||||
selected = b0;
|
selected = b0;
|
||||||
setOpaque(b0);
|
setOpaque(b0);
|
||||||
setBackground(b0 ? clrActive : clrHover);
|
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelected() {
|
public boolean isSelected() {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public enum VSubmenuGauntletBuild implements IVSubmenu<CSubmenuGauntletBuild> {
|
|||||||
.text(" ").hoverable(true).build();
|
.text(" ").hoverable(true).build();
|
||||||
|
|
||||||
private VSubmenuGauntletBuild() {
|
private VSubmenuGauntletBuild() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
|
|
||||||
// File handling panel
|
// 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();
|
.text("A gauntlet that has been started will keep the same deck until it is finished.").build();
|
||||||
|
|
||||||
private VSubmenuGauntletContests() {
|
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.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(lblLoad, "h 30px!, w 94%!, gap 1% 0 0 5px, ax center");
|
||||||
// pnlLoad.add(new FLabel.Builder().text("If a gauntlet has been started, its deck is frozen.").build(),
|
// pnlLoad.add(new FLabel.Builder().text("If a gauntlet has been started, its deck is frozen.").build(),
|
||||||
// "gap 0 0 0 5px, ax center");
|
// "gap 0 0 0 5px, ax center");
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public enum VSubmenuGauntletLoad implements IVSubmenu<CSubmenuGauntletLoad> {
|
|||||||
private final StartButton btnStart = new StartButton();
|
private final StartButton btnStart = new StartButton();
|
||||||
|
|
||||||
private VSubmenuGauntletLoad() {
|
private VSubmenuGauntletLoad() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
scrLoad.setBorder(null);
|
scrLoad.setBorder(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
|||||||
private final StartButton btnStart = new StartButton();
|
private final StartButton btnStart = new StartButton();
|
||||||
|
|
||||||
private VSubmenuGauntletQuick() {
|
private VSubmenuGauntletQuick() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
boxUserDecks.setSelected(true);
|
boxUserDecks.setSelected(true);
|
||||||
boxQuestDecks.setSelected(true);
|
boxQuestDecks.setSelected(true);
|
||||||
@@ -95,7 +95,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
|||||||
sliOpponents.setPaintLabels(true);
|
sliOpponents.setPaintLabels(true);
|
||||||
sliOpponents.setSnapToTicks(true);
|
sliOpponents.setSnapToTicks(true);
|
||||||
sliOpponents.setOpaque(false);
|
sliOpponents.setOpaque(false);
|
||||||
sliOpponents.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(sliOpponents).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
sliOpponents.setFont(FSkin.getFont(12));
|
sliOpponents.setFont(FSkin.getFont(12));
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu<CSubmenuGauntletQuick> {
|
|||||||
scrLoad.getViewport().setOpaque(false);
|
scrLoad.getViewport().setOpaque(false);
|
||||||
scrLoad.setBorder(null);
|
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(lblOptions, "h 30px!, w 96%!, gap 2% 0 0 5px");
|
||||||
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
|
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
|
||||||
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");
|
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
import forge.ImageCache;
|
import forge.ImageCache;
|
||||||
import forge.gui.toolbox.FRadioButton;
|
import forge.gui.toolbox.FRadioButton;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
import forge.gui.toolbox.FTextArea;
|
import forge.gui.toolbox.FTextArea;
|
||||||
import forge.quest.QuestEvent;
|
import forge.quest.QuestEvent;
|
||||||
|
|
||||||
@@ -36,9 +38,10 @@ class PnlEvent extends JPanel {
|
|||||||
private final int hImg = 100;
|
private final int hImg = 100;
|
||||||
private final int hRfl = 20;
|
private final int hRfl = 20;
|
||||||
|
|
||||||
|
private final JComponentSkin<PnlEvent> skin;
|
||||||
private final Color clr1 = new Color(255, 0, 255, 100);
|
private final Color clr1 = new Color(255, 0, 255, 100);
|
||||||
private final Color clr2 = new Color(255, 255, 0, 0);
|
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>
|
* Panels for displaying duels and challenges.<br>
|
||||||
@@ -49,6 +52,7 @@ class PnlEvent extends JPanel {
|
|||||||
*/
|
*/
|
||||||
public PnlEvent(final QuestEvent e0) {
|
public PnlEvent(final QuestEvent e0) {
|
||||||
super();
|
super();
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
this.event = e0;
|
this.event = e0;
|
||||||
img = ImageCache.getIcon(e0).getImage();
|
img = ImageCache.getIcon(e0).getImage();
|
||||||
|
|
||||||
@@ -93,7 +97,7 @@ class PnlEvent extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void paintComponent(final Graphics g) {
|
public void paintComponent(final Graphics g) {
|
||||||
Graphics2D g2d = (Graphics2D) g.create();
|
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());
|
g2d.fillRect(0, 0, getWidth(), getHeight());
|
||||||
|
|
||||||
// Padding here
|
// Padding here
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
@@ -33,7 +31,8 @@ public class QuestFileLister extends JPanel {
|
|||||||
private RowPanel previousSelect;
|
private RowPanel previousSelect;
|
||||||
private RowPanel[] rows;
|
private RowPanel[] rows;
|
||||||
private Command cmdRowSelect, cmdRowDelete, cmdRowEdit;
|
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() {
|
public QuestFileLister() {
|
||||||
@@ -81,7 +80,7 @@ public class QuestFileLister extends JPanel {
|
|||||||
// Note: careful with the widths of the rows here;
|
// Note: careful with the widths of the rows here;
|
||||||
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
// scroll panes will have difficulty dynamically resizing if 100% width is set.
|
||||||
final JPanel rowTitle = new JPanel();
|
final 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.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("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");
|
rowTitle.add(new FLabel.Builder().text("Rename").fontAlign(SwingConstants.CENTER).build(), "w 15%!, h 20px!, gap 0 0 5px 0");
|
||||||
@@ -131,14 +130,14 @@ public class QuestFileLister extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(clrHover);
|
FSkin.get(r0).setBackground(clrHover);
|
||||||
r0.setOpaque(true);
|
r0.setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(clrDefault);
|
FSkin.get(r0).setBackground(clrDefault);
|
||||||
r0.setOpaque(false);
|
r0.setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,14 +166,14 @@ public class QuestFileLister extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(clrHover);
|
FSkin.get(r0).setBackground(clrHover);
|
||||||
r0.setOpaque(true);
|
r0.setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(clrDefault);
|
FSkin.get(r0).setBackground(clrDefault);
|
||||||
r0.setOpaque(false);
|
r0.setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,21 +194,21 @@ public class QuestFileLister extends JPanel {
|
|||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setBackground(new Color(0, 0, 0, 0));
|
setBackground(new Color(0, 0, 0, 0));
|
||||||
setLayout(new MigLayout("insets 0, gap 0"));
|
setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
setBorder(new MatteBorder(0, 0, 1, 0, clrBorders));
|
FSkin.get(this).setMatteBorder(0, 0, 1, 0, clrBorders);
|
||||||
questData = qd0;
|
questData = qd0;
|
||||||
|
|
||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(clrHover);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(clrHover);
|
||||||
((RowPanel) e.getSource()).setOpaque(true);
|
((RowPanel) e.getSource()).setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(clrDefault);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(clrDefault);
|
||||||
((RowPanel) e.getSource()).setOpaque(false);
|
((RowPanel) e.getSource()).setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +222,7 @@ public class QuestFileLister extends JPanel {
|
|||||||
public void setSelected(boolean b0) {
|
public void setSelected(boolean b0) {
|
||||||
selected = b0;
|
selected = b0;
|
||||||
setOpaque(b0);
|
setOpaque(b0);
|
||||||
setBackground(b0 ? clrActive : clrHover);
|
FSkin.get(this).setBackground(b0 ? clrActive : clrHover);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelected() {
|
public boolean isSelected() {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
|
|
||||||
@@ -240,7 +241,8 @@ public class QuestPreferencesHandler extends JPanel {
|
|||||||
private class PrefInput extends JTextField {
|
private class PrefInput extends JTextField {
|
||||||
private final QPref qpref;
|
private final QPref qpref;
|
||||||
private final ErrType err;
|
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 boolean isFocus = false;
|
||||||
private String previousText = "";
|
private String previousText = "";
|
||||||
|
|
||||||
@@ -255,6 +257,7 @@ public class QuestPreferencesHandler extends JPanel {
|
|||||||
|
|
||||||
this.qpref = qp0;
|
this.qpref = qp0;
|
||||||
this.err = e0;
|
this.err = e0;
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||||
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||||
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||||
@@ -262,9 +265,9 @@ public class QuestPreferencesHandler extends JPanel {
|
|||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setBorder(null);
|
this.setBorder(null);
|
||||||
this.setFont(FSkin.getFont(13));
|
this.setFont(FSkin.getFont(13));
|
||||||
this.setForeground(clrText);
|
this.skin.setForeground(clrText);
|
||||||
this.setCaretColor(clrText);
|
this.skin.setCaretColor(clrText);
|
||||||
this.setBackground(clrHover);
|
this.skin.setBackground(clrHover);
|
||||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
this.setText(prefs.getPref(qpref));
|
this.setText(prefs.getPref(qpref));
|
||||||
this.setPreviousText(prefs.getPref(qpref));
|
this.setPreviousText(prefs.getPref(qpref));
|
||||||
@@ -290,14 +293,14 @@ public class QuestPreferencesHandler extends JPanel {
|
|||||||
public void focusGained(FocusEvent e) {
|
public void focusGained(FocusEvent e) {
|
||||||
isFocus = true;
|
isFocus = true;
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
setBackground(clrActive);
|
skin.setBackground(clrActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
isFocus = false;
|
isFocus = false;
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setBackground(clrHover);
|
skin.setBackground(clrHover);
|
||||||
|
|
||||||
// TODO for slight performance improvement
|
// TODO for slight performance improvement
|
||||||
// check if value has changed before validating
|
// check if value has changed before validating
|
||||||
|
|||||||
@@ -124,10 +124,14 @@ public class SSubmenuQuestUtil {
|
|||||||
|
|
||||||
if (view.equals(VSubmenuChallenges.SINGLETON_INSTANCE)) {
|
if (view.equals(VSubmenuChallenges.SINGLETON_INSTANCE)) {
|
||||||
view.getLblZep().setVisible(qCtrl.getAssets().hasItem(QuestItemType.ZEPPELIN));
|
view.getLblZep().setVisible(qCtrl.getAssets().hasItem(QuestItemType.ZEPPELIN));
|
||||||
view.getLblZep().setEnabled(qCtrl.getAssets().getItemLevel(
|
if (qCtrl.getAssets().getItemLevel(QuestItemType.ZEPPELIN) == 2) {
|
||||||
QuestItemType.ZEPPELIN) == 2 ? false : true);
|
view.getLblZep().setEnabled(false);
|
||||||
view.getLblZep().setForeground(qCtrl.getAssets().getItemLevel(
|
FSkin.get(view.getLblZep()).setForeground(Color.gray);
|
||||||
QuestItemType.ZEPPELIN) == 2 ? Color.gray : FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
}
|
||||||
|
else {
|
||||||
|
view.getLblZep().setEnabled(true);
|
||||||
|
FSkin.get(view.getLblZep()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
view.getLblZep().setVisible(false);
|
view.getLblZep().setVisible(false);
|
||||||
@@ -193,7 +197,7 @@ public class SSubmenuQuestUtil {
|
|||||||
lblCurrentDeck.setText("Build, then select a deck in the \"Decks\" submenu. ");
|
lblCurrentDeck.setText("Build, then select a deck in the \"Decks\" submenu. ");
|
||||||
}
|
}
|
||||||
else {
|
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 \""
|
lblCurrentDeck.setText("Your current deck is \""
|
||||||
+ SSubmenuQuestUtil.getCurrentDeck().getName() + "\".");
|
+ SSubmenuQuestUtil.getCurrentDeck().getName() + "\".");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,8 +199,8 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private VSubmenuQuestData() {
|
private VSubmenuQuestData() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
lblTitleNew.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitleNew).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
scrQuests.setBorder(null);
|
scrQuests.setBorder(null);
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public enum VSubmenuQuestDecks implements IVSubmenu<CSubmenuQuestDecks> {
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
private VSubmenuQuestDecks() {
|
private VSubmenuQuestDecks() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
scr.setBorder(null);
|
scr.setBorder(null);
|
||||||
scr.getViewport().setBorder(null);
|
scr.getViewport().setBorder(null);
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import forge.gui.toolbox.FLabel;
|
|||||||
import forge.gui.toolbox.FPanel;
|
import forge.gui.toolbox.FPanel;
|
||||||
import forge.gui.toolbox.FScrollPane;
|
import forge.gui.toolbox.FScrollPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JTextComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
private VSubmenuQuestPrefs() {
|
private VSubmenuQuestPrefs() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
pnlContent.setOpaque(false);
|
pnlContent.setOpaque(false);
|
||||||
pnlContent.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
pnlContent.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
@@ -89,7 +91,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
// Rewards panel
|
// Rewards panel
|
||||||
final FPanel pnlTitleRewards = new FPanel();
|
final FPanel pnlTitleRewards = new FPanel();
|
||||||
pnlTitleRewards.setLayout(new MigLayout("insets 0, align center"));
|
pnlTitleRewards.setLayout(new MigLayout("insets 0, align center"));
|
||||||
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")
|
pnlTitleRewards.add(new FLabel.Builder().text("Rewards")
|
||||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
|
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
|
||||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||||
@@ -101,7 +103,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
// Booster panel
|
// Booster panel
|
||||||
final FPanel pnlTitleBooster = new FPanel();
|
final FPanel pnlTitleBooster = new FPanel();
|
||||||
pnlTitleBooster.setLayout(new MigLayout("insets 0, align center"));
|
pnlTitleBooster.setLayout(new MigLayout("insets 0, align center"));
|
||||||
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")
|
pnlTitleBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
|
||||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOOK))
|
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOOK))
|
||||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||||
@@ -112,7 +114,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
// Difficulty table panel
|
// Difficulty table panel
|
||||||
final FPanel pnlTitleDifficulty = new FPanel();
|
final FPanel pnlTitleDifficulty = new FPanel();
|
||||||
pnlTitleDifficulty.setLayout(new MigLayout("insets 0, align center"));
|
pnlTitleDifficulty.setLayout(new MigLayout("insets 0, align center"));
|
||||||
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")
|
pnlTitleDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments")
|
||||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_NOTES))
|
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_NOTES))
|
||||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||||
@@ -123,7 +125,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
// Shop panel
|
// Shop panel
|
||||||
final FPanel pnlTitleShop = new FPanel();
|
final FPanel pnlTitleShop = new FPanel();
|
||||||
pnlTitleShop.setLayout(new MigLayout("insets 0, align center"));
|
pnlTitleShop.setLayout(new MigLayout("insets 0, align center"));
|
||||||
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")
|
pnlTitleShop.add(new FLabel.Builder().text("Shop Preferences")
|
||||||
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
|
.icon(FSkin.getIcon(FSkin.QuestIcons.ICO_COIN))
|
||||||
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
.fontSize(16).build(), "h 95%!, gap 0 0 2.5% 0");
|
||||||
@@ -373,7 +375,8 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
public class PrefInput extends JTextField {
|
public class PrefInput extends JTextField {
|
||||||
private final QPref qpref;
|
private final QPref qpref;
|
||||||
private final QuestPreferencesErrType err;
|
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 boolean isFocus = false;
|
||||||
private String previousText = "";
|
private String previousText = "";
|
||||||
|
|
||||||
@@ -388,6 +391,7 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
|
|
||||||
this.qpref = qp0;
|
this.qpref = qp0;
|
||||||
this.err = e0;
|
this.err = e0;
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||||
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||||
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||||
@@ -395,9 +399,9 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setBorder(null);
|
this.setBorder(null);
|
||||||
this.setFont(FSkin.getFont(13));
|
this.setFont(FSkin.getFont(13));
|
||||||
this.setForeground(clrText);
|
this.skin.setForeground(clrText);
|
||||||
this.setCaretColor(clrText);
|
this.skin.setCaretColor(clrText);
|
||||||
this.setBackground(clrHover);
|
this.skin.setBackground(clrHover);
|
||||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
this.setText(prefs.getPref(qpref));
|
this.setText(prefs.getPref(qpref));
|
||||||
this.setPreviousText(prefs.getPref(qpref));
|
this.setPreviousText(prefs.getPref(qpref));
|
||||||
@@ -423,14 +427,14 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
|
|||||||
public void focusGained(FocusEvent e) {
|
public void focusGained(FocusEvent e) {
|
||||||
isFocus = true;
|
isFocus = true;
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
setBackground(clrActive);
|
skin.setBackground(clrActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
isFocus = false;
|
isFocus = false;
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setBackground(clrHover);
|
skin.setBackground(clrHover);
|
||||||
|
|
||||||
CSubmenuQuestPrefs.validateAndSave(PrefInput.this);
|
CSubmenuQuestPrefs.validateAndSave(PrefInput.this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
|||||||
|
|
||||||
private VSubmenuConstructed() {
|
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"));
|
pnlStart = new JPanel(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||||
final String strCheckboxConstraints = "pushy, gap 0 20px 0 0";
|
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(cbAiVsAi, strCheckboxConstraintsTop);
|
||||||
pnlStart.add(cbArtifacts, strCheckboxConstraints);
|
pnlStart.add(cbArtifacts, strCheckboxConstraints);
|
||||||
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
|
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public enum VSubmenuDraft implements IVSubmenu<CSubmenuDraft> {
|
|||||||
lstAI.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
lstAI.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
btnStart.setEnabled(false);
|
btnStart.setEnabled(false);
|
||||||
|
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
JXButtonPanel grpPanel = new JXButtonPanel();
|
JXButtonPanel grpPanel = new JXButtonPanel();
|
||||||
grpPanel.add(radSingle, "w 200px!, h 30px!");
|
grpPanel.add(radSingle, "w 200px!, h 30px!");
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
|
|||||||
private VSubmenuSealed() {
|
private VSubmenuSealed() {
|
||||||
btnStart.setEnabled(false);
|
btnStart.setEnabled(false);
|
||||||
|
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -166,7 +166,7 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
|
|||||||
// Init directions text pane
|
// Init directions text pane
|
||||||
final JTextPane tpnDirections = new JTextPane();
|
final JTextPane tpnDirections = new JTextPane();
|
||||||
tpnDirections.setOpaque(false);
|
tpnDirections.setOpaque(false);
|
||||||
tpnDirections.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(tpnDirections).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
tpnDirections.setFont(FSkin.getFont(15));
|
tpnDirections.setFont(FSkin.getFont(15));
|
||||||
tpnDirections.setAlignmentX(SwingConstants.CENTER);
|
tpnDirections.setAlignmentX(SwingConstants.CENTER);
|
||||||
tpnDirections.setFocusable(false);
|
tpnDirections.setFocusable(false);
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.GameLogEntryType;
|
import forge.GameLogEntryType;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.control.KeyboardShortcuts;
|
import forge.control.KeyboardShortcuts;
|
||||||
@@ -294,10 +293,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
|||||||
private class SectionLabel extends JLabel {
|
private class SectionLabel extends JLabel {
|
||||||
public SectionLabel(final String txt0) {
|
public SectionLabel(final String txt0) {
|
||||||
super(txt0);
|
super(txt0);
|
||||||
setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
FSkin.JComponentSkin<SectionLabel> skin = FSkin.get(this);
|
||||||
|
skin.setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
setHorizontalAlignment(SwingConstants.CENTER);
|
setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
setFont(FSkin.getBoldFont(16));
|
setFont(FSkin.getBoldFont(16));
|
||||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,8 +306,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
|||||||
private class NoteLabel extends JLabel {
|
private class NoteLabel extends JLabel {
|
||||||
public NoteLabel(final String txt0) {
|
public NoteLabel(final String txt0) {
|
||||||
super(txt0);
|
super(txt0);
|
||||||
|
FSkin.JComponentSkin<NoteLabel> skin = FSkin.get(this);
|
||||||
setFont(FSkin.getItalicFont(12));
|
setFont(FSkin.getItalicFont(12));
|
||||||
setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +345,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
|||||||
this.addFocusListener(new FocusAdapter() {
|
this.addFocusListener(new FocusAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void focusGained(final FocusEvent evt) {
|
public void focusGained(final FocusEvent evt) {
|
||||||
KeyboardShortcutField.this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
FSkin.get(KeyboardShortcutField.this).setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -352,7 +353,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
|||||||
Singletons.getModel().getPreferences().setPref(prefKey, getCodeString());
|
Singletons.getModel().getPreferences().setPref(prefKey, getCodeString());
|
||||||
Singletons.getModel().getPreferences().save();
|
Singletons.getModel().getPreferences().save();
|
||||||
shortcut0.attach();
|
shortcut0.attach();
|
||||||
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.setWrapStyleWord(true);
|
||||||
tar.setEditable(false);
|
tar.setEditable(false);
|
||||||
tar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
tar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||||
|
|
||||||
|
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
|
||||||
tar.setFont(FSkin.getFixedFont(16));
|
tar.setFont(FSkin.getFixedFont(16));
|
||||||
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
tar.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
tarSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
scroller = new JScrollPane(tar);
|
scroller = new JScrollPane(tar);
|
||||||
pnlMain.add(scroller, "w 100%!, h 100%!");
|
pnlMain.add(scroller, "w 100%!, h 100%!");
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
|
|||||||
|
|
||||||
private VSubmenuArchenemy() {
|
private VSubmenuArchenemy() {
|
||||||
|
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
//This listener will look for any of the radio buttons being selected
|
//This listener will look for any of the radio buttons being selected
|
||||||
//and call the method that shows/hides tabs appropriately.
|
//and call the method that shows/hides tabs appropriately.
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
|
|||||||
|
|
||||||
private VSubmenuPlanechase() {
|
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
|
//This listener will look for any of the radio buttons being selected
|
||||||
//and call the method that shows/hides tabs appropriately.
|
//and call the method that shows/hides tabs appropriately.
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
|
|||||||
|
|
||||||
private VSubmenuVanguard() {
|
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> humanListData = new Vector<Object>();
|
||||||
Vector<Object> aiListData = new Vector<Object>();
|
Vector<Object> aiListData = new Vector<Object>();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package forge.gui.match;
|
package forge.gui.match;
|
||||||
|
|
||||||
import java.awt.AWTEvent;
|
import java.awt.AWTEvent;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
@@ -158,16 +157,16 @@ public class GameLogPanel extends JPanel {
|
|||||||
tar.setEditable(false);
|
tar.setEditable(false);
|
||||||
tar.setLineWrap(true);
|
tar.setLineWrap(true);
|
||||||
tar.setWrapStyleWord(true);
|
tar.setWrapStyleWord(true);
|
||||||
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(tar).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
setTextAreaBackground(tar, useAlternateBackColor);
|
setTextAreaBackground(tar, useAlternateBackColor);
|
||||||
return tar;
|
return tar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTextAreaBackground(JTextArea tar, boolean useAlternateBackColor) {
|
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(); }
|
if (useAlternateBackColor) { skinColor = skinColor.darker(); }
|
||||||
tar.setOpaque(true);
|
tar.setOpaque(true);
|
||||||
tar.setBackground(skinColor);
|
FSkin.get(tar).setBackground(skinColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final class MyScrollablePanel extends JPanel implements Scrollable {
|
protected final class MyScrollablePanel extends JPanel implements Scrollable {
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class GauntletWinLose extends ControlWinLose {
|
|||||||
final JPanel pnl = this.getView().getPnlCustom();
|
final JPanel pnl = this.getView().getPnlCustom();
|
||||||
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
|
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
|
||||||
pnl.setOpaque(true);
|
pnl.setOpaque(true);
|
||||||
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(lblTitle, "gap 0 0 20px 10px, ax center");
|
||||||
pnl.add(pnlResults, "w 96%!, growy, pushy, gap 2% 0 0 0");
|
pnl.add(pnlResults, "w 96%!, growy, pushy, gap 2% 0 0 0");
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class QuestWinLoseCardViewer extends FPanel {
|
|||||||
|
|
||||||
this.setCornerDiameter(20);
|
this.setCornerDiameter(20);
|
||||||
this.setBorderToggle(false);
|
this.setBorderToggle(false);
|
||||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
picture.setOpaque(false);
|
picture.setOpaque(false);
|
||||||
scroller.setBorder(null);
|
scroller.setBorder(null);
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public enum TargetingOverlay {
|
|||||||
pnl.setOpaque(false);
|
pnl.setOpaque(false);
|
||||||
pnl.setVisible(false);
|
pnl.setVisible(false);
|
||||||
pnl.setFocusTraversalKeysEnabled(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} */
|
/** @return {@link javax.swing.JPanel} */
|
||||||
@@ -300,7 +300,7 @@ public enum TargetingOverlay {
|
|||||||
return area;
|
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 ex = endX - startX;
|
||||||
float ey = endY - startY;
|
float ey = endY - startY;
|
||||||
if (ex == 0 && ey == 0) { return; }
|
if (ex == 0 && ey == 0) { return; }
|
||||||
@@ -318,7 +318,7 @@ public enum TargetingOverlay {
|
|||||||
g2d.translate(startX, startY);
|
g2d.translate(startX, startY);
|
||||||
g2d.rotate(Math.atan2(ey, ex));
|
g2d.rotate(Math.atan2(ey, ex));
|
||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75f));
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75f));
|
||||||
g2d.setColor(color);
|
FSkin.get(this).setGraphicsColor(g2d, skinColor);
|
||||||
g2d.fill(arrow);
|
g2d.fill(arrow);
|
||||||
g2d.setColor(Color.BLACK);
|
g2d.setColor(Color.BLACK);
|
||||||
g2d.draw(arrow);
|
g2d.draw(arrow);
|
||||||
@@ -347,7 +347,7 @@ public enum TargetingOverlay {
|
|||||||
|
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
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) {
|
for (Point[] p : arcs) {
|
||||||
if (p[0] == null || p[1] == null) {
|
if (p[0] == null || p[1] == null) {
|
||||||
@@ -359,7 +359,7 @@ public enum TargetingOverlay {
|
|||||||
int startX = (int) p[1].getX();
|
int startX = (int) p[1].getX();
|
||||||
int startY = (int) p[1].getY();
|
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
|
FView.SINGLETON_INSTANCE.getFrame().repaint(); // repaint the match UI
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CounterType;
|
import forge.CounterType;
|
||||||
@@ -113,7 +111,7 @@ public class VAssignDamage {
|
|||||||
if (!damage.containsKey(source)) source = null; // to get player instead of fake card
|
if (!damage.containsKey(source)) source = null; // to get player instead of fake card
|
||||||
|
|
||||||
FSkin.Colors brdrColor = VAssignDamage.this.canAssignTo(source) ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE;
|
FSkin.Colors brdrColor = VAssignDamage.this.canAssignTo(source) ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE;
|
||||||
((CardPanel) evt.getSource()).setBorder(new LineBorder(FSkin.getColor(brdrColor), 2));
|
FSkin.get((CardPanel) evt.getSource()).setLineBorder(FSkin.getColor(brdrColor), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -155,7 +153,7 @@ public class VAssignDamage {
|
|||||||
// Top-level UI stuff
|
// Top-level UI stuff
|
||||||
final JPanel overlay = SOverlayUtils.genericOverlay();
|
final JPanel overlay = SOverlayUtils.genericOverlay();
|
||||||
final JPanel pnlMain = new JPanel();
|
final JPanel pnlMain = new JPanel();
|
||||||
pnlMain.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(pnlMain).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
// Attacker area
|
// Attacker area
|
||||||
final CardPanel pnlAttacker = new CardPanel(attacker0);
|
final CardPanel pnlAttacker = new CardPanel(attacker0);
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ package forge.gui.match.nonsingleton;
|
|||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
@@ -71,8 +69,7 @@ public class VCommand implements IVDoc<CCommand> {
|
|||||||
|
|
||||||
control = new CCommand(player, this);
|
control = new CCommand(player, this);
|
||||||
|
|
||||||
tabletop.setBorder(new MatteBorder(0, 1, 0, 0,
|
FSkin.get(tabletop).setMatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
|
||||||
tabletop.setOpaque(false);
|
tabletop.setOpaque(false);
|
||||||
|
|
||||||
scroller.setViewportView(this.tabletop);
|
scroller.setViewportView(this.tabletop);
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import javax.swing.JScrollPane;
|
|||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.game.player.LobbyPlayer;
|
import forge.game.player.LobbyPlayer;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
@@ -73,7 +71,6 @@ public class VField implements IVDoc<CField> {
|
|||||||
private final PhaseIndicator phaseInidicator = new PhaseIndicator();
|
private final PhaseIndicator phaseInidicator = new PhaseIndicator();
|
||||||
|
|
||||||
private final Border borderAvatarSimple = new LineBorder(new Color(0, 0, 0, 0), 1);
|
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);
|
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);
|
control = new CField(player, this, playerViewer);
|
||||||
|
|
||||||
avatarArea.setOpaque(false);
|
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.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
avatarArea.add(lblAvatar, "w 100%!, h 70%!, wrap, gaptop 4%");
|
avatarArea.add(lblAvatar, "w 100%!, h 70%!, wrap, gaptop 4%");
|
||||||
avatarArea.add(lblLife, "w 100%!, h 30%!, gaptop 4%");
|
avatarArea.add(lblLife, "w 100%!, h 30%!, gaptop 4%");
|
||||||
@@ -113,7 +110,7 @@ public class VField implements IVDoc<CField> {
|
|||||||
public void mouseEntered(final MouseEvent e) {
|
public void mouseEntered(final MouseEvent e) {
|
||||||
avatarArea.setOpaque(true);
|
avatarArea.setOpaque(true);
|
||||||
if (!isHighlited())
|
if (!isHighlited())
|
||||||
avatarArea.setBorder(borderAvatarHover);
|
FSkin.get(avatarArea).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -124,8 +121,7 @@ public class VField implements IVDoc<CField> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tabletop.setBorder(new MatteBorder(0, 1, 0, 0,
|
FSkin.get(tabletop).setMatteBorder(0, 1, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
|
||||||
tabletop.setOpaque(false);
|
tabletop.setOpaque(false);
|
||||||
|
|
||||||
scroller.setViewportView(this.tabletop);
|
scroller.setViewportView(this.tabletop);
|
||||||
@@ -261,9 +257,12 @@ public class VField implements IVDoc<CField> {
|
|||||||
detailsPanel.updateDetails();
|
detailsPanel.updateDetails();
|
||||||
|
|
||||||
this.getLblLife().setText("" + player.getLife());
|
this.getLblLife().setText("" + player.getLife());
|
||||||
Color lifeFg = player.getLife() <= 5 ? Color.red : FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
if (player.getLife() > 5) {
|
||||||
this.getLblLife().setForeground(lifeFg);
|
FSkin.get(this.getLblLife()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FSkin.get(this.getLblLife()).setForeground(Color.red);
|
||||||
|
}
|
||||||
|
|
||||||
boolean highlited = isHighlited();
|
boolean highlited = isHighlited();
|
||||||
this.avatarArea.setBorder(highlited ? borderAvatarHighlited : borderAvatarSimple );
|
this.avatarArea.setBorder(highlited ? borderAvatarHighlited : borderAvatarSimple );
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
package forge.gui.match.views;
|
package forge.gui.match.views;
|
||||||
|
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
import forge.gui.framework.DragTab;
|
import forge.gui.framework.DragTab;
|
||||||
@@ -44,9 +42,10 @@ public enum VCombat implements IVDoc<CCombat> {
|
|||||||
final JTextArea tar = new JTextArea();
|
final JTextArea tar = new JTextArea();
|
||||||
|
|
||||||
private VCombat() {
|
private VCombat() {
|
||||||
|
FSkin.JTextComponentSkin<JTextArea> tarSkin = FSkin.get(tar);
|
||||||
tar.setOpaque(false);
|
tar.setOpaque(false);
|
||||||
tar.setBorder(new MatteBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
tarSkin.setMatteBorder(0, 0, 0, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
tar.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
tarSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
tar.setFocusable(false);
|
tar.setFocusable(false);
|
||||||
tar.setLineWrap(true);
|
tar.setLineWrap(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package forge.gui.match.views;
|
package forge.gui.match.views;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@@ -239,9 +238,9 @@ public enum VDev implements IVDoc<CDev> {
|
|||||||
public class DevLabel extends JLabel {
|
public class DevLabel extends JLabel {
|
||||||
private static final long serialVersionUID = 7917311680519060700L;
|
private static final long serialVersionUID = 7917311680519060700L;
|
||||||
|
|
||||||
private Color defaultBG = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
private FSkin.SkinColor defaultBG = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
|
||||||
private final Color hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
private final FSkin.SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||||
private final Color pressedBG = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
private final FSkin.SkinColor pressedBG = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private final String enabledText, disabledText;
|
private final String enabledText, disabledText;
|
||||||
private int w, h; // Width, height, radius, insets (for paintComponent)
|
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.r = 6; // Radius (for paintComponent)
|
||||||
this.i = 2; // Insets (for paintComponent)
|
this.i = 2; // Insets (for paintComponent)
|
||||||
this.setEnabled(true);
|
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() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
DevLabel.this.setBackground(DevLabel.this.pressedBG);
|
FSkin.get(DevLabel.this).setBackground(DevLabel.this.pressedBG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(final MouseEvent e) {
|
public void mouseReleased(final MouseEvent e) {
|
||||||
DevLabel.this.setBackground(DevLabel.this.defaultBG);
|
FSkin.get(DevLabel.this).setBackground(DevLabel.this.defaultBG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(final MouseEvent e) {
|
public void mouseEntered(final MouseEvent e) {
|
||||||
DevLabel.this.setBackground(DevLabel.this.hoverBG);
|
FSkin.get(DevLabel.this).setBackground(DevLabel.this.hoverBG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(final MouseEvent e) {
|
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.enabled = b;
|
||||||
this.setText(s);
|
this.setText(s);
|
||||||
this.setToolTipText(s);
|
this.setToolTipText(s);
|
||||||
this.setBackground(this.defaultBG);
|
FSkin.get(this).setBackground(this.defaultBG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import forge.gui.framework.IVDoc;
|
|||||||
import forge.gui.match.controllers.CDock;
|
import forge.gui.match.controllers.CDock;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles Swing components of button dock area.
|
* Assembles Swing components of button dock area.
|
||||||
@@ -194,9 +196,10 @@ public enum VDock implements IVDoc<CDock> {
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
private class DockButton extends JLabel {
|
private class DockButton extends JLabel {
|
||||||
private final Image img;
|
private final Image img;
|
||||||
private final Color hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
private final JComponentSkin<DockButton> skin;
|
||||||
|
private final SkinColor hoverBG = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||||
private final Color defaultBG = new Color(0, 0, 0, 0);
|
private final Color defaultBG = new Color(0, 0, 0, 0);
|
||||||
private Color clrBorders = new Color(0, 0, 0, 0);
|
private final Color defaultBorderColor = new Color(0, 0, 0, 0);
|
||||||
private int w, h;
|
private int w, h;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,6 +212,7 @@ public enum VDock implements IVDoc<CDock> {
|
|||||||
*/
|
*/
|
||||||
public DockButton(final ImageIcon i0, final String s0) {
|
public DockButton(final ImageIcon i0, final String s0) {
|
||||||
super();
|
super();
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
this.setToolTipText(s0);
|
this.setToolTipText(s0);
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setBackground(this.defaultBG);
|
this.setBackground(this.defaultBG);
|
||||||
@@ -222,13 +226,11 @@ public enum VDock implements IVDoc<CDock> {
|
|||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(final MouseEvent e) {
|
public void mouseEntered(final MouseEvent e) {
|
||||||
DockButton.this.clrBorders = FSkin.getColor(FSkin.Colors.CLR_BORDERS);
|
DockButton.this.skin.setBackground(DockButton.this.hoverBG);
|
||||||
DockButton.this.setBackground(DockButton.this.hoverBG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(final MouseEvent e) {
|
public void mouseExited(final MouseEvent e) {
|
||||||
DockButton.this.clrBorders = new Color(0, 0, 0, 0);
|
|
||||||
DockButton.this.setBackground(DockButton.this.defaultBG);
|
DockButton.this.setBackground(DockButton.this.defaultBG);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -245,7 +247,12 @@ public enum VDock implements IVDoc<CDock> {
|
|||||||
this.h = this.getHeight();
|
this.h = this.getHeight();
|
||||||
g.setColor(this.getBackground());
|
g.setColor(this.getBackground());
|
||||||
g.fillRect(0, 0, this.w, this.h);
|
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.drawRect(0, 0, this.w - 1, this.h - 1);
|
||||||
g.drawImage(this.img, 0, 0, this.w, this.h, null);
|
g.drawImage(this.img, 0, 0, this.w, this.h, null);
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public enum VMessage implements IVDoc<CMessage> {
|
|||||||
tarMessage.setEditable(false);
|
tarMessage.setEditable(false);
|
||||||
tarMessage.setLineWrap(true);
|
tarMessage.setLineWrap(true);
|
||||||
tarMessage.setWrapStyleWord(true);
|
tarMessage.setWrapStyleWord(true);
|
||||||
tarMessage.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(tarMessage).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
tarMessage.setFont(FSkin.getFont(14));
|
tarMessage.setFont(FSkin.getFont(14));
|
||||||
tarMessage.setMargin(new Insets(5, 5, 5, 5));
|
tarMessage.setMargin(new Insets(5, 5, 5, 5));
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -93,7 +91,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
|
|||||||
this.infoLBLs.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords, antes });
|
this.infoLBLs.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords, antes });
|
||||||
|
|
||||||
// Set border on bottom label, and larger font on player name
|
// Set border on bottom label, and larger font on player name
|
||||||
antes.setBorder(new MatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
FSkin.get(antes).setMatteBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
name.setText(p.getName());
|
name.setText(p.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +187,7 @@ public enum VPlayers implements IVDoc<CPlayers> {
|
|||||||
private class InfoLabel extends JLabel {
|
private class InfoLabel extends JLabel {
|
||||||
public InfoLabel() {
|
public InfoLabel() {
|
||||||
super();
|
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());
|
tab.setText("Stack : " + stack.size());
|
||||||
|
|
||||||
final Border border = new EmptyBorder(5, 5, 5, 5);
|
final Border border = new EmptyBorder(5, 5, 5, 5);
|
||||||
Color[] scheme;
|
|
||||||
|
|
||||||
stackTARs.clear();
|
stackTARs.clear();
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (final SpellAbilityStackInstance spell : stack) {
|
for (final SpellAbilityStackInstance spell : stack) {
|
||||||
scheme = getSpellColor(spell);
|
|
||||||
|
|
||||||
String isOptional = spell.getSpellAbility().isOptionalTrigger()
|
String isOptional = spell.getSpellAbility().isOptionalTrigger()
|
||||||
&& spell.getSourceCard().getController().getController().getLobbyPlayer().equals(viewer) ? "(OPTIONAL) " : "";
|
&& spell.getSourceCard().getController().getController().getLobbyPlayer().equals(viewer) ? "(OPTIONAL) " : "";
|
||||||
String txt = (count++) + ". " + isOptional + spell.getStackDescription();
|
String txt = (count++) + ". " + isOptional + spell.getStackDescription();
|
||||||
@@ -145,8 +142,7 @@ public enum VStack implements IVDoc<CStack> {
|
|||||||
tar.setToolTipText(txt);
|
tar.setToolTipText(txt);
|
||||||
tar.setOpaque(true);
|
tar.setOpaque(true);
|
||||||
tar.setBorder(border);
|
tar.setBorder(border);
|
||||||
tar.setForeground(scheme[1]);
|
this.setSpellColor(tar, spell);
|
||||||
tar.setBackground(scheme[0]);
|
|
||||||
|
|
||||||
tar.setFocusable(false);
|
tar.setFocusable(false);
|
||||||
tar.setEditable(false);
|
tar.setEditable(false);
|
||||||
@@ -203,23 +199,43 @@ public enum VStack implements IVDoc<CStack> {
|
|||||||
parentCell.getBody().repaint();
|
parentCell.getBody().repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns array with [background, foreground] colors. */
|
private void setSpellColor(JTextArea tar, SpellAbilityStackInstance s0) {
|
||||||
private Color[] getSpellColor(SpellAbilityStackInstance s0) {
|
if (s0.getStackDescription().startsWith("Morph ")) {
|
||||||
if (s0.getStackDescription().startsWith("Morph "))
|
tar.setBackground(new Color(0, 0, 0, 0));
|
||||||
return new Color[] { new Color(0, 0, 0, 0), FSkin.getColor(FSkin.Colors.CLR_TEXT) };
|
FSkin.get(tar).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
if (CardUtil.getColors(s0.getSourceCard()).isMulticolor())
|
}
|
||||||
return new Color[] { new Color(253, 175, 63), Color.black };
|
else if (CardUtil.getColors(s0.getSourceCard()).isMulticolor()) {
|
||||||
|
tar.setBackground(new Color(253, 175, 63));
|
||||||
if (s0.getSourceCard().isBlack()) return new Color[] { Color.black, Color.white };
|
tar.setForeground(Color.black);
|
||||||
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 };
|
else if (s0.getSourceCard().isBlack()) {
|
||||||
if (s0.getSourceCard().isRed()) return new Color[] { new Color(214, 8, 8), Color.white };
|
tar.setBackground(Color.black);
|
||||||
if (s0.getSourceCard().isWhite()) return new Color[] { Color.white, Color.black };
|
tar.setForeground(Color.white);
|
||||||
|
}
|
||||||
if (s0.getSourceCard().isArtifact() || s0.getSourceCard().isLand())
|
else if (s0.getSourceCard().isBlue()) {
|
||||||
return new Color[] { new Color(111, 75, 43), Color.white };
|
tar.setBackground(new Color(71, 108, 191));
|
||||||
|
tar.setForeground(Color.white);
|
||||||
return new Color[] { new Color(0, 0, 0, 0), FSkin.getColor(FSkin.Colors.CLR_TEXT) };
|
}
|
||||||
|
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
|
//========= Custom class handling
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class FButton extends JButton implements ILocalRepaint {
|
|||||||
public FButton(final String label) {
|
public FButton(final String label) {
|
||||||
super(label);
|
super(label);
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setBackground(Color.red);
|
this.setBackground(Color.red);
|
||||||
this.setFocusPainted(false);
|
this.setFocusPainted(false);
|
||||||
this.setBorder(BorderFactory.createEmptyBorder());
|
this.setBorder(BorderFactory.createEmptyBorder());
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class FCheckBox extends JCheckBox {
|
|||||||
|
|
||||||
public FCheckBox(final String s0) {
|
public FCheckBox(final String s0) {
|
||||||
super(s0);
|
super(s0);
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setFont(FSkin.getFont(14));
|
this.setFont(FSkin.getFont(14));
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class FComboBoxPanel<E> extends JPanel {
|
|||||||
if (this.comboBoxCaption != null && !this.comboBoxCaption.isEmpty()) {
|
if (this.comboBoxCaption != null && !this.comboBoxCaption.isEmpty()) {
|
||||||
JLabel comboLabel;
|
JLabel comboLabel;
|
||||||
comboLabel = new JLabel(this.comboBoxCaption);
|
comboLabel = new JLabel(this.comboBoxCaption);
|
||||||
comboLabel.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(comboLabel).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
comboLabel.setFont(FSkin.getBoldFont(12));
|
comboLabel.setFont(FSkin.getBoldFont(12));
|
||||||
this.add(comboLabel);
|
this.add(comboLabel);
|
||||||
}
|
}
|
||||||
@@ -69,8 +69,9 @@ public class FComboBoxPanel<E> extends JPanel {
|
|||||||
private void setComboBoxLayout() {
|
private void setComboBoxLayout() {
|
||||||
if (this.comboBox != null) {
|
if (this.comboBox != null) {
|
||||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX)) {
|
||||||
this.comboBox.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.JComponentSkin<JComboBox<E>> comboBoxSkin = FSkin.get(this.comboBox);
|
||||||
this.comboBox.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
comboBoxSkin.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
comboBoxSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.comboBox.setFont(FSkin.getFont(12));
|
this.comboBox.setFont(FSkin.getFont(12));
|
||||||
this.comboBox.setRenderer(new ComplexCellRenderer<E>());
|
this.comboBox.setRenderer(new ComplexCellRenderer<E>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package forge.gui.toolbox;
|
package forge.gui.toolbox;
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
@@ -31,6 +29,8 @@ import javax.swing.event.AncestorListener;
|
|||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.gui.framework.ILocalRepaint;
|
import forge.gui.framework.ILocalRepaint;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.SkinColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the Builder pattern to facilitate/encourage inline styling.
|
* Uses the Builder pattern to facilitate/encourage inline styling.
|
||||||
@@ -187,6 +187,8 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
|||||||
protected FLabel(final Builder b0) {
|
protected FLabel(final Builder b0) {
|
||||||
super(b0.bldText);
|
super(b0.bldText);
|
||||||
|
|
||||||
|
this.skin = FSkin.get(this);
|
||||||
|
|
||||||
// Init fields from builder
|
// Init fields from builder
|
||||||
this.iconScaleFactor = b0.bldIconScaleFactor;
|
this.iconScaleFactor = b0.bldIconScaleFactor;
|
||||||
|
|
||||||
@@ -230,8 +232,8 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
|||||||
|
|
||||||
if (b0.bldUseSkinColors) {
|
if (b0.bldUseSkinColors) {
|
||||||
// Non-custom display properties
|
// Non-custom display properties
|
||||||
this.setForeground(clrText);
|
this.skin.setForeground(clrText);
|
||||||
this.setBackground(clrMain);
|
this.skin.setBackground(clrMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize adapter
|
// Resize adapter
|
||||||
@@ -245,15 +247,16 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
|||||||
|
|
||||||
//========== Variable initialization
|
//========== Variable initialization
|
||||||
// Final inits
|
// Final inits
|
||||||
private final Color clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
private final JComponentSkin<FLabel> skin;
|
||||||
private final Color clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
private final SkinColor clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
|
||||||
private final Color clrMain = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
private final SkinColor clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||||
private final Color d50 = FSkin.stepColor(clrMain, -50);
|
private final SkinColor clrMain = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||||
private final Color d30 = FSkin.stepColor(clrMain, -30);
|
private final SkinColor d50 = clrMain.stepColor(-50);
|
||||||
private final Color d10 = FSkin.stepColor(clrMain, -10);
|
private final SkinColor d30 = clrMain.stepColor(-30);
|
||||||
private final Color l10 = FSkin.stepColor(clrMain, 10);
|
private final SkinColor d10 = clrMain.stepColor(-10);
|
||||||
private final Color l20 = FSkin.stepColor(clrMain, 20);
|
private final SkinColor l10 = clrMain.stepColor(10);
|
||||||
private final Color l30 = FSkin.stepColor(clrMain, 30);
|
private final SkinColor l20 = clrMain.stepColor(20);
|
||||||
|
private final SkinColor l30 = clrMain.stepColor(30);
|
||||||
|
|
||||||
// Custom properties, assigned either at realization (using builder)
|
// Custom properties, assigned either at realization (using builder)
|
||||||
// or dynamically (using methods below).
|
// or dynamically (using methods below).
|
||||||
@@ -538,38 +541,36 @@ public class FLabel extends JLabel implements ILocalRepaint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void paintFocus(final Graphics2D g, int w, int h) {
|
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.drawRect(0, 0, w - 2, h - 2);
|
||||||
g.setColor(l30);
|
skin.setGraphicsColor(g, l30);
|
||||||
g.drawRect(1, 1, w - 4, h - 4);
|
g.drawRect(1, 1, w - 4, h - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintUp(final Graphics2D g, int w, int h) {
|
private void paintUp(final Graphics2D g, int w, int h) {
|
||||||
GradientPaint gradient = new GradientPaint(0, h, d10, 0, 0, l20);
|
skin.setGraphicsGradientPaint(g, 0, h, d10, 0, 0, l20);
|
||||||
g.setPaint(gradient);
|
|
||||||
g.fillRect(0, 0, w, h);
|
g.fillRect(0, 0, w, h);
|
||||||
|
|
||||||
g.setColor(d50);
|
skin.setGraphicsColor(g, d50);
|
||||||
g.drawRect(0, 0, w - 2, h - 2);
|
g.drawRect(0, 0, w - 2, h - 2);
|
||||||
g.setColor(l10);
|
skin.setGraphicsColor(g, l10);
|
||||||
g.drawRect(1, 1, w - 4, h - 4);
|
g.drawRect(1, 1, w - 4, h - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintBorder(final Graphics2D g, int w, int h) {
|
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.drawRect(0, 0, w - 2, h - 2);
|
||||||
g.setColor(l30);
|
skin.setGraphicsColor(g, l30);
|
||||||
g.drawRect(1, 1, w - 4, h - 4);
|
g.drawRect(1, 1, w - 4, h - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintDown(final Graphics2D g, int w, int h) {
|
private void paintDown(final Graphics2D g, int w, int h) {
|
||||||
GradientPaint gradient = new GradientPaint(0, h, d30, 0, 0, l10);
|
skin.setGraphicsGradientPaint(g, 0, h, d30, 0, 0, l10);
|
||||||
g.setPaint(gradient);
|
|
||||||
g.fillRect(0, 0, w - 1, h - 1);
|
g.fillRect(0, 0, w - 1, h - 1);
|
||||||
|
|
||||||
g.setColor(d30);
|
skin.setGraphicsColor(g, d30);
|
||||||
g.drawRect(0, 0, w - 2, h - 2);
|
g.drawRect(0, 0, w - 2, h - 2);
|
||||||
g.setColor(l10);
|
skin.setGraphicsColor(g, l10);
|
||||||
g.drawRect(1, 1, w - 4, h - 4);
|
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.
|
* TODO: Write javadoc for this method.
|
||||||
*/
|
*/
|
||||||
private void applySkin() {
|
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>();
|
ListCellRenderer<E> renderer = new ComplexCellRenderer<E>();
|
||||||
setCellRenderer(renderer);
|
setCellRenderer(renderer);
|
||||||
@@ -61,9 +61,10 @@ public class FList<E> extends JList<E> {
|
|||||||
JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
|
JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
|
||||||
lst0, val0, i0, isSelected, cellHasFocus);
|
lst0, val0, i0, isSelected, cellHasFocus);
|
||||||
|
|
||||||
|
FSkin.JComponentSkin<JLabel> lblItemSkin = FSkin.get(lblItem);
|
||||||
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
|
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
|
||||||
lblItem.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
|
lblItemSkin.setBackground(FSkin.getColor(hasFocus() ? FSkin.Colors.CLR_ACTIVE : FSkin.Colors.CLR_INACTIVE));
|
||||||
lblItem.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
lblItemSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
lblItem.setFont(FSkin.getFont(13));
|
lblItem.setFont(FSkin.getFont(13));
|
||||||
lblItem.setOpaque(isSelected);
|
lblItem.setOpaque(isSelected);
|
||||||
return lblItem;
|
return lblItem;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package forge.gui.toolbox;
|
package forge.gui.toolbox;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@@ -51,13 +50,14 @@ import forge.gui.framework.ILocalRepaint;
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class FPanel extends JPanel implements ILocalRepaint {
|
public class FPanel extends JPanel implements ILocalRepaint {
|
||||||
//========== Variable initialization
|
//========== Variable initialization
|
||||||
|
protected final FSkin.JComponentSkin<FPanel> skin;
|
||||||
// Defaults for adjustable values
|
// Defaults for adjustable values
|
||||||
private boolean selectable = false;
|
private boolean selectable = false;
|
||||||
private boolean hoverable = false;
|
private boolean hoverable = false;
|
||||||
private boolean foregroundStretch = false;
|
private boolean foregroundStretch = false;
|
||||||
private Image foregroundImage = null;
|
private Image foregroundImage = null;
|
||||||
private Image backgroundTexture = 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 boolean borderToggle = true;
|
||||||
private int cornerDiameter = 20;
|
private int cornerDiameter = 20;
|
||||||
private int foregroundAlign = SwingConstants.CENTER;
|
private int foregroundAlign = SwingConstants.CENTER;
|
||||||
@@ -85,7 +85,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
|
|
||||||
// Background will follow skin theme.
|
// 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
|
// Mouse event handler
|
||||||
@@ -138,8 +139,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
/** @param bool0   boolean */
|
/** @param bool0   boolean */
|
||||||
public void setSelected(final boolean bool0) {
|
public void setSelected(final boolean bool0) {
|
||||||
selected = bool0;
|
selected = bool0;
|
||||||
if (bool0) { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
if (bool0) { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
||||||
else { this.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
else { skin.setBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||||
repaintSelf();
|
repaintSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +204,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
this.borderToggle = bool0;
|
this.borderToggle = bool0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param clr0   {@link java.awt.Color} */
|
/** @param clr0   {@link forge.gui.toolbox.FSkin.SkinColor} */
|
||||||
public void setBorderColor(final Color clr0) {
|
public void setBorderColor(final FSkin.SkinColor clr0) {
|
||||||
this.borderColor = clr0;
|
this.borderColor = clr0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,10 +261,10 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
//========== Special draw methods
|
//========== Special draw methods
|
||||||
private void drawBackgroundColor(final Graphics2D g2d0) {
|
private void drawBackgroundColor(final Graphics2D g2d0) {
|
||||||
// Color background as appropriate
|
// Color background as appropriate
|
||||||
if (selected) { g2d0.setColor(FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
if (selected) { skin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_ACTIVE)); }
|
||||||
else if (hovered) { g2d0.setColor(FSkin.getColor(FSkin.Colors.CLR_HOVER)); }
|
else if (hovered) { skin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_HOVER)); }
|
||||||
else if (selectable) { g2d0.setColor(FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
else if (selectable) { skin.setGraphicsColor(g2d0, FSkin.getColor(FSkin.Colors.CLR_INACTIVE)); }
|
||||||
else { g2d0.setColor(getBackground()); }
|
else { skin.setGraphicsColor(g2d0, skin.getBackground()); }
|
||||||
|
|
||||||
g2d0.fillRoundRect(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter);
|
g2d0.fillRoundRect(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter);
|
||||||
}
|
}
|
||||||
@@ -327,7 +328,7 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void drawBorder(final Graphics2D g2d0) {
|
private void drawBorder(final Graphics2D g2d0) {
|
||||||
g2d0.setColor(borderColor);
|
skin.setGraphicsColor(g2d0, borderColor);
|
||||||
g2d0.drawRoundRect(0, 0, pnlW - 1, pnlH - 1, cornerDiameter, cornerDiameter);
|
g2d0.drawRoundRect(0, 0, pnlW - 1, pnlH - 1, cornerDiameter, cornerDiameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class FRadioButton extends JRadioButton {
|
|||||||
public FRadioButton(String s0) {
|
public FRadioButton(String s0) {
|
||||||
super();
|
super();
|
||||||
this.setText(s0);
|
this.setText(s0);
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setFont(FSkin.getFont(14));
|
this.setFont(FSkin.getFont(14));
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.awt.Component;
|
|||||||
|
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.border.LineBorder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A very basic extension of JScrollPane to centralize common styling changes.
|
* A very basic extension of JScrollPane to centralize common styling changes.
|
||||||
@@ -33,7 +32,7 @@ public class FScrollPane extends JScrollPane {
|
|||||||
super(c0, vertical0, horizontal0);
|
super(c0, vertical0, horizontal0);
|
||||||
getVerticalScrollBar().setUnitIncrement(16);
|
getVerticalScrollBar().setUnitIncrement(16);
|
||||||
getViewport().setOpaque(false);
|
getViewport().setOpaque(false);
|
||||||
setBorder(new LineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS), 1));
|
FSkin.get(this).setLineBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS));
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.awt.Color;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.LayoutManager;
|
import java.awt.LayoutManager;
|
||||||
@@ -40,6 +39,8 @@ import javax.swing.ScrollPaneConstants;
|
|||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
import forge.gui.framework.ILocalRepaint;
|
import forge.gui.framework.ILocalRepaint;
|
||||||
|
import forge.gui.toolbox.FSkin.JComponentSkin;
|
||||||
|
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
|
* 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 abstract class ArrowButton extends JLabel implements ILocalRepaint {
|
||||||
private final Color clrFore = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
private final JComponentSkin<ArrowButton> skin;
|
||||||
private final Color clrBack = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
private final SkinColor clrFore = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
||||||
private final Color d50 = FSkin.stepColor(clrBack, -50);
|
private final SkinColor clrBack = FSkin.getColor(FSkin.Colors.CLR_INACTIVE);
|
||||||
private final Color d10 = FSkin.stepColor(clrBack, -10);
|
private final SkinColor d50 = clrBack.stepColor(-50);
|
||||||
private final Color l10 = FSkin.stepColor(clrBack, 10);
|
private final SkinColor d10 = clrBack.stepColor(-10);
|
||||||
private final Color l20 = FSkin.stepColor(clrBack, 20);
|
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 alphaDefault = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f);
|
||||||
private final AlphaComposite alphaHovered = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f);
|
private final AlphaComposite alphaHovered = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f);
|
||||||
protected final int arrowSize = 6;
|
protected final int arrowSize = 6;
|
||||||
@@ -210,6 +212,7 @@ public class FScrollPanel extends JScrollPane {
|
|||||||
|
|
||||||
protected ArrowButton(final JScrollBar scrollBar0, final int incrementDirection0) {
|
protected ArrowButton(final JScrollBar scrollBar0, final int incrementDirection0) {
|
||||||
super("");
|
super("");
|
||||||
|
skin = FSkin.get(this);
|
||||||
scrollBar = scrollBar0;
|
scrollBar = scrollBar0;
|
||||||
incrementDirection = incrementDirection0;
|
incrementDirection = incrementDirection0;
|
||||||
timer.setInitialDelay(500); //wait half a second after mouse down before starting timer
|
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();
|
Composite oldComp = g2d.getComposite();
|
||||||
g2d.setComposite(hovered ? alphaHovered : alphaDefault);
|
g2d.setComposite(hovered ? alphaHovered : alphaDefault);
|
||||||
|
|
||||||
GradientPaint gradient = new GradientPaint(0, h, d10, 0, 0, l20);
|
skin.setGraphicsGradientPaint(g2d, 0, h, d10, 0, 0, l20);
|
||||||
g2d.setPaint(gradient);
|
|
||||||
g.fillRect(0, 0, w, h);
|
g.fillRect(0, 0, w, h);
|
||||||
|
|
||||||
g.setColor(d50);
|
skin.setGraphicsColor(g, d50);
|
||||||
g.drawRect(0, 0, w - 1, h - 1);
|
g.drawRect(0, 0, w - 1, h - 1);
|
||||||
g.setColor(l10);
|
skin.setGraphicsColor(g, l10);
|
||||||
g.drawRect(1, 1, w - 3, h - 3);
|
g.drawRect(1, 1, w - 3, h - 3);
|
||||||
|
|
||||||
g.setColor(clrFore);
|
skin.setGraphicsColor(g, clrFore);
|
||||||
drawArrow(g);
|
drawArrow(g);
|
||||||
|
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
package forge.gui.toolbox;
|
package forge.gui.toolbox;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.awt.GradientPaint;
|
||||||
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
@@ -30,15 +33,25 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JTable;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.UnsupportedLookAndFeelException;
|
||||||
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
|
import javax.swing.text.JTextComponent;
|
||||||
|
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
|
import forge.properties.ForgePreferences.FPref;
|
||||||
|
import forge.util.TypeUtil;
|
||||||
import forge.view.FView;
|
import forge.view.FView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,6 +64,209 @@ public enum FSkin {
|
|||||||
/** Singleton instance of skin. */
|
/** Singleton instance of skin. */
|
||||||
SINGLETON_INSTANCE;
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
|
public static class ComponentSkin<T extends Component> {
|
||||||
|
protected T comp;
|
||||||
|
private SkinColor foreground, background;
|
||||||
|
private boolean needRepaintOnUpdate;
|
||||||
|
|
||||||
|
private ComponentSkin(T comp0) {
|
||||||
|
this.comp = comp0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor getForeground() {
|
||||||
|
return this.foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForeground(SkinColor skinColor) {
|
||||||
|
this.foreground = skinColor;
|
||||||
|
this.comp.setForeground(skinColor.color);
|
||||||
|
}
|
||||||
|
public void setForeground(Color color) {
|
||||||
|
this.foreground = null; //ensure this field is reset when static color set
|
||||||
|
this.comp.setForeground(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor getBackground() {
|
||||||
|
return this.background;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackground(SkinColor skinColor) {
|
||||||
|
this.background = skinColor;
|
||||||
|
this.comp.setBackground(skinColor.color);
|
||||||
|
}
|
||||||
|
public void setBackground(Color color) {
|
||||||
|
this.background = null; //ensure this field is reset when static color set
|
||||||
|
this.comp.setBackground(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGraphicsColor(Graphics g, SkinColor skinColor) {
|
||||||
|
this.needRepaintOnUpdate = true;
|
||||||
|
g.setColor(skinColor.color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGraphicsGradientPaint(Graphics2D g2d, float x1, float y1, SkinColor skinColor1, float x2, float y2, SkinColor skinColor2) {
|
||||||
|
this.needRepaintOnUpdate = true;
|
||||||
|
g2d.setPaint(new GradientPaint(x1, y1, skinColor1.color, x2, y2, skinColor2.color));
|
||||||
|
}
|
||||||
|
public void setGraphicsGradientPaint(Graphics2D g2d, float x1, float y1, Color color1, float x2, float y2, SkinColor skinColor2) {
|
||||||
|
this.needRepaintOnUpdate = true;
|
||||||
|
g2d.setPaint(new GradientPaint(x1, y1, color1, x2, y2, skinColor2.color));
|
||||||
|
}
|
||||||
|
public void setGraphicsGradientPaint(Graphics2D g2d, float x1, float y1, SkinColor skinColor1, float x2, float y2, Color color2) {
|
||||||
|
this.needRepaintOnUpdate = true;
|
||||||
|
g2d.setPaint(new GradientPaint(x1, y1, skinColor1.color, x2, y2, color2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class JComponentSkin<T extends JComponent> extends ComponentSkin<T> {
|
||||||
|
private class LineBorder {
|
||||||
|
private final SkinColor skinColor;
|
||||||
|
private final int thickness;
|
||||||
|
private final boolean rounded;
|
||||||
|
|
||||||
|
private LineBorder(SkinColor skinColor0, int thickness0, boolean rounded0) {
|
||||||
|
this.skinColor = skinColor0;
|
||||||
|
this.thickness = thickness0;
|
||||||
|
this.rounded = rounded0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void apply() {
|
||||||
|
JComponentSkin.this.comp.setBorder(BorderFactory.createLineBorder(this.skinColor.color, this.thickness, this.rounded));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private LineBorder lineBorder;
|
||||||
|
|
||||||
|
private class MatteBorder {
|
||||||
|
private final int top, left, bottom, right;
|
||||||
|
private final SkinColor skinColor;
|
||||||
|
|
||||||
|
private MatteBorder(int top0, int left0, int bottom0, int right0, SkinColor skinColor0) {
|
||||||
|
this.top = top0;
|
||||||
|
this.left = left0;
|
||||||
|
this.bottom = bottom0;
|
||||||
|
this.right = right0;
|
||||||
|
this.skinColor = skinColor0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void apply() {
|
||||||
|
JComponentSkin.this.comp.setBorder(BorderFactory.createMatteBorder(this.top, this.left, this.bottom, this.right, this.skinColor.color));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private MatteBorder matteBorder;
|
||||||
|
|
||||||
|
private JComponentSkin(T comp0) {
|
||||||
|
super(comp0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineBorder(SkinColor skinColor) {
|
||||||
|
setLineBorder(skinColor, 1, false);
|
||||||
|
}
|
||||||
|
public void setLineBorder(SkinColor skinColor, int thickness) {
|
||||||
|
setLineBorder(skinColor, thickness, false);
|
||||||
|
}
|
||||||
|
public void setLineBorder(SkinColor skinColor, int thickness, boolean rounded) {
|
||||||
|
this.lineBorder = new LineBorder(skinColor, thickness, rounded);
|
||||||
|
this.lineBorder.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatteBorder(int top, int left, int bottom, int right, SkinColor skinColor) {
|
||||||
|
this.matteBorder = new MatteBorder(top, left, bottom, right, skinColor);
|
||||||
|
this.matteBorder.apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class JTextComponentSkin<T extends JTextComponent> extends JComponentSkin<T> {
|
||||||
|
private SkinColor caretColor;
|
||||||
|
|
||||||
|
private JTextComponentSkin(T comp0) {
|
||||||
|
super(comp0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor getCaretColor() {
|
||||||
|
return this.caretColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaretColor(SkinColor skinColor) {
|
||||||
|
this.caretColor = skinColor;
|
||||||
|
this.comp.setCaretColor(skinColor.color);
|
||||||
|
}
|
||||||
|
public void setCaretColor(Color color) {
|
||||||
|
this.caretColor = null; //ensure this field is reset when static color set
|
||||||
|
this.comp.setCaretColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class JTableSkin<T extends JTable> extends JComponentSkin<T> {
|
||||||
|
private SkinColor selectionForeground, selectionBackground;
|
||||||
|
|
||||||
|
private JTableSkin(T comp0) {
|
||||||
|
super(comp0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor getSelectionForeground() {
|
||||||
|
return this.selectionForeground;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectionForeground(SkinColor skinColor) {
|
||||||
|
this.selectionForeground = skinColor;
|
||||||
|
this.comp.setSelectionForeground(skinColor.color);
|
||||||
|
}
|
||||||
|
public void setSelectionForeground(Color color) {
|
||||||
|
this.selectionForeground = null; //ensure this field is reset when static color set
|
||||||
|
this.comp.setSelectionForeground(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor getSelectionBackground() {
|
||||||
|
return this.selectionBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectionBackground(SkinColor skinColor) {
|
||||||
|
this.selectionBackground = skinColor;
|
||||||
|
this.comp.setSelectionBackground(skinColor.color);
|
||||||
|
}
|
||||||
|
public void setSelectionBackground(Color color) {
|
||||||
|
this.selectionBackground = null; //ensure this field is reset when static color set
|
||||||
|
this.comp.setSelectionBackground(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private static HashMap<Component, ComponentSkin> skinnedComps = new HashMap<Component, ComponentSkin>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends Component> ComponentSkin<T> get(T comp) {
|
||||||
|
ComponentSkin<T> skinnedComp = skinnedComps.get(comp);
|
||||||
|
if (skinnedComp == null) {
|
||||||
|
skinnedComp = new ComponentSkin<T>(comp);
|
||||||
|
skinnedComps.put(comp, skinnedComp);
|
||||||
|
}
|
||||||
|
return skinnedComp;
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends JComponent> JComponentSkin<T> get(T comp) {
|
||||||
|
JComponentSkin<T> skinnedComp = TypeUtil.safeCast(skinnedComps.get(comp), JComponentSkin.class);
|
||||||
|
if (skinnedComp == null) {
|
||||||
|
skinnedComp = new JComponentSkin<T>(comp);
|
||||||
|
skinnedComps.put(comp, skinnedComp);
|
||||||
|
}
|
||||||
|
return skinnedComp;
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends JTextComponent> JTextComponentSkin<T> get(T comp) {
|
||||||
|
JTextComponentSkin<T> skinnedComp = TypeUtil.safeCast(skinnedComps.get(comp), JTextComponentSkin.class);
|
||||||
|
if (skinnedComp == null) {
|
||||||
|
skinnedComp = new JTextComponentSkin<T>(comp);
|
||||||
|
skinnedComps.put(comp, skinnedComp);
|
||||||
|
}
|
||||||
|
return skinnedComp;
|
||||||
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends JTable> JTableSkin<T> get(T comp) {
|
||||||
|
JTableSkin<T> skinnedComp = TypeUtil.safeCast(skinnedComps.get(comp), JTableSkin.class);
|
||||||
|
if (skinnedComp == null) {
|
||||||
|
skinnedComp = new JTableSkin<T>(comp);
|
||||||
|
skinnedComps.put(comp, skinnedComp);
|
||||||
|
}
|
||||||
|
return skinnedComp;
|
||||||
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public enum Backgrounds implements SkinProp { /** */
|
public enum Backgrounds implements SkinProp { /** */
|
||||||
BG_SPLASH (null), /** */
|
BG_SPLASH (null), /** */
|
||||||
@@ -65,6 +281,118 @@ public enum FSkin {
|
|||||||
public int[] getCoords() { return coords; }
|
public int[] getCoords() { return coords; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a color from this skin's color map.
|
||||||
|
*
|
||||||
|
* @param c0   Colors property (from enum)
|
||||||
|
* @return Color
|
||||||
|
*/
|
||||||
|
public static SkinColor getColor(final Colors c0) {
|
||||||
|
return SkinColor.baseColors.get(c0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Steps RGB components of a color up or down.
|
||||||
|
* Returns opaque (non-alpha) stepped color.
|
||||||
|
* Plus for lighter, minus for darker.
|
||||||
|
*
|
||||||
|
* @param clr0 {@link java.awt.Color}
|
||||||
|
* @param step int
|
||||||
|
* @return {@link java.awt.Color}
|
||||||
|
*/
|
||||||
|
public static Color stepColor(Color clr0, int step) {
|
||||||
|
int r = clr0.getRed();
|
||||||
|
int g = clr0.getGreen();
|
||||||
|
int b = clr0.getBlue();
|
||||||
|
|
||||||
|
// Darker
|
||||||
|
if (step < 0) {
|
||||||
|
r = ((r + step > 0) ? r + step : 0);
|
||||||
|
g = ((g + step > 0) ? g + step : 0);
|
||||||
|
b = ((b + step > 0) ? b + step : 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
r = ((r + step < 255) ? r + step : 255);
|
||||||
|
g = ((g + step < 255) ? g + step : 255);
|
||||||
|
b = ((b + step < 255) ? b + step : 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Color(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns RGB components of a color, with a new
|
||||||
|
* value for alpha. 0 = transparent, 255 = opaque.
|
||||||
|
*
|
||||||
|
* @param clr0 {@link java.awt.Color}
|
||||||
|
* @param alpha int
|
||||||
|
* @return {@link java.awt.Color}
|
||||||
|
*/
|
||||||
|
public static Color alphaColor(Color clr0, int alpha) {
|
||||||
|
return new Color(clr0.getRed(), clr0.getGreen(), clr0.getBlue(), alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SkinColor {
|
||||||
|
private static final HashMap<Colors, SkinColor> baseColors = new HashMap<Colors, SkinColor>();
|
||||||
|
private static final int NO_BRIGHTNESS_DELTA = 0;
|
||||||
|
private static final int NO_STEP = -10000; //needs to be large negative since small negative values are valid
|
||||||
|
private static final int NO_ALPHA = -1;
|
||||||
|
|
||||||
|
private final Colors baseColor;
|
||||||
|
private final int brightnessDelta;
|
||||||
|
private final int step;
|
||||||
|
private final int alpha;
|
||||||
|
private Color color;
|
||||||
|
|
||||||
|
//private constructors for color that changes with skin (use FSkin.getColor())
|
||||||
|
private SkinColor(Colors baseColor0) {
|
||||||
|
this(baseColor0, NO_BRIGHTNESS_DELTA, NO_STEP, NO_ALPHA);
|
||||||
|
}
|
||||||
|
private SkinColor(Colors baseColor0, int brightnessDelta0, int step0, int alpha0) {
|
||||||
|
this.baseColor = baseColor0;
|
||||||
|
this.brightnessDelta = brightnessDelta0;
|
||||||
|
this.step = step0;
|
||||||
|
this.alpha = alpha0;
|
||||||
|
this.updateColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor brighter() {
|
||||||
|
return new SkinColor(this.baseColor, this.brightnessDelta + 1, this.step, this.alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor darker() {
|
||||||
|
return new SkinColor(this.baseColor, this.brightnessDelta - 1, this.step, this.alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor stepColor(int step0) {
|
||||||
|
return new SkinColor(this.baseColor, this.brightnessDelta, step0, this.alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkinColor alphaColor(int alpha0) {
|
||||||
|
return new SkinColor(this.baseColor, this.brightnessDelta, this.step, alpha0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateColor() {
|
||||||
|
this.color = this.baseColor.color;
|
||||||
|
if (this.brightnessDelta != NO_BRIGHTNESS_DELTA) {
|
||||||
|
if (this.brightnessDelta < 0) {
|
||||||
|
for (int i = 0; i > this.brightnessDelta; i--) {
|
||||||
|
this.color = this.color.darker();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int i = 0; i < this.brightnessDelta; i++) {
|
||||||
|
this.color = this.color.brighter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.step != NO_STEP) {
|
||||||
|
this.color = FSkin.stepColor(this.color, this.step);
|
||||||
|
}
|
||||||
|
if (this.alpha != NO_ALPHA) {
|
||||||
|
this.color = FSkin.stepColor(this.color, this.alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public enum Colors implements SkinProp { /** */
|
public enum Colors implements SkinProp { /** */
|
||||||
CLR_THEME (new int[] {70, 10}), /** */
|
CLR_THEME (new int[] {70, 10}), /** */
|
||||||
@@ -81,12 +409,34 @@ public enum FSkin {
|
|||||||
CLR_THEME2 (new int[] {70, 230}), /** */
|
CLR_THEME2 (new int[] {70, 230}), /** */
|
||||||
CLR_OVERLAY (new int[] {70, 250});
|
CLR_OVERLAY (new int[] {70, 250});
|
||||||
|
|
||||||
|
private Color color;
|
||||||
private int[] coords;
|
private int[] coords;
|
||||||
|
|
||||||
/** @param xy   int[] coordinates */
|
/** @param xy   int[] coordinates */
|
||||||
Colors(final int[] xy) { this.coords = xy; }
|
Colors(final int[] xy) { this.coords = xy; }
|
||||||
|
|
||||||
/** @return int[] */
|
/** @return int[] */
|
||||||
@Override
|
@Override
|
||||||
public int[] getCoords() { return coords; }
|
public int[] getCoords() { return coords; }
|
||||||
|
|
||||||
|
public static void updateAll() {
|
||||||
|
for (final Colors c : Colors.values()) {
|
||||||
|
c.updateColor();
|
||||||
|
}
|
||||||
|
if (SkinColor.baseColors.size() == 0) { //initialize base skin colors if needed
|
||||||
|
for (final Colors c : Colors.values()) {
|
||||||
|
SkinColor.baseColors.put(c, new SkinColor(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateColor() {
|
||||||
|
tempCoords = this.getCoords();
|
||||||
|
x0 = tempCoords[0];
|
||||||
|
y0 = tempCoords[1];
|
||||||
|
|
||||||
|
color = FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x0, y0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
/** int[] can hold [xcoord, ycoord, width, height, newwidth, newheight]. */
|
||||||
@@ -404,7 +754,6 @@ public enum FSkin {
|
|||||||
|
|
||||||
private static Map<SkinProp, ImageIcon> icons;
|
private static Map<SkinProp, ImageIcon> icons;
|
||||||
private static Map<SkinProp, Image> images;
|
private static Map<SkinProp, Image> images;
|
||||||
private static Map<SkinProp, Color> colors;
|
|
||||||
|
|
||||||
private static Map<Integer, Font> fixedFonts;
|
private static Map<Integer, Font> fixedFonts;
|
||||||
private static Map<Integer, Font> plainFonts;
|
private static Map<Integer, Font> plainFonts;
|
||||||
@@ -452,11 +801,9 @@ public enum FSkin {
|
|||||||
|
|
||||||
if (FSkin.icons != null) { FSkin.icons.clear(); }
|
if (FSkin.icons != null) { FSkin.icons.clear(); }
|
||||||
if (FSkin.images != null) { FSkin.images.clear(); }
|
if (FSkin.images != null) { FSkin.images.clear(); }
|
||||||
if (FSkin.colors != null) { FSkin.colors.clear(); }
|
|
||||||
|
|
||||||
FSkin.icons = new HashMap<SkinProp, ImageIcon>();
|
FSkin.icons = new HashMap<SkinProp, ImageIcon>();
|
||||||
FSkin.images = new HashMap<SkinProp, Image>();
|
FSkin.images = new HashMap<SkinProp, Image>();
|
||||||
FSkin.colors = new HashMap<SkinProp, Color>();
|
|
||||||
|
|
||||||
final File f = new File(preferredDir + FILE_SPLASH);
|
final File f = new File(preferredDir + FILE_SPLASH);
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
@@ -587,7 +934,7 @@ public enum FSkin {
|
|||||||
FSkin.setIcon(Backgrounds.BG_MATCH, preferredDir + FILE_MATCH_BG);
|
FSkin.setIcon(Backgrounds.BG_MATCH, preferredDir + FILE_MATCH_BG);
|
||||||
|
|
||||||
// Run through enums and load their coords.
|
// Run through enums and load their coords.
|
||||||
for (final Colors e : Colors.values()) { FSkin.setColor(e); }
|
Colors.updateAll();
|
||||||
for (final ZoneImages e : ZoneImages.values()) { FSkin.setImage(e); }
|
for (final ZoneImages e : ZoneImages.values()) { FSkin.setImage(e); }
|
||||||
for (final DockIcons e : DockIcons.values()) { FSkin.setIcon(e); }
|
for (final DockIcons e : DockIcons.values()) { FSkin.setIcon(e); }
|
||||||
for (final InterfaceIcons e : InterfaceIcons.values()) { FSkin.setIcon(e); }
|
for (final InterfaceIcons e : InterfaceIcons.values()) { FSkin.setIcon(e); }
|
||||||
@@ -629,6 +976,11 @@ public enum FSkin {
|
|||||||
FSkin.bimPreferredSprite = null;
|
FSkin.bimPreferredSprite = null;
|
||||||
FSkin.bimDefaultAvatars = null;
|
FSkin.bimDefaultAvatars = null;
|
||||||
FSkin.bimPreferredAvatars = null;
|
FSkin.bimPreferredAvatars = null;
|
||||||
|
|
||||||
|
// Set look and feel after skin loaded
|
||||||
|
FSkin.setProgessBarMessage("Setting look and feel...");
|
||||||
|
ForgeLookAndFeel laf = new ForgeLookAndFeel();
|
||||||
|
laf.setForgeLookAndFeel(Singletons.getView().getFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setDefaultFontSize() {
|
private static void setDefaultFontSize() {
|
||||||
@@ -753,16 +1105,6 @@ public enum FSkin {
|
|||||||
return scaled;
|
return scaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a color from this skin's color map.
|
|
||||||
*
|
|
||||||
* @param s0   Skin property (from enum)
|
|
||||||
* @return Color
|
|
||||||
*/
|
|
||||||
public static Color getColor(final SkinProp s0) {
|
|
||||||
return colors.get(s0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the skins.
|
* Gets the skins.
|
||||||
*
|
*
|
||||||
@@ -803,47 +1145,8 @@ public enum FSkin {
|
|||||||
return avatars;
|
return avatars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Steps RGB components of a color up or down.
|
|
||||||
* Returns opaque (non-alpha) stepped color.
|
|
||||||
* Plus for lighter, minus for darker.
|
|
||||||
*
|
|
||||||
* @param clr0 {@link java.awt.Color}
|
|
||||||
* @param step int
|
|
||||||
* @return {@link java.awt.Color}
|
|
||||||
*/
|
|
||||||
public static Color stepColor(Color clr0, int step) {
|
|
||||||
int r = clr0.getRed();
|
|
||||||
int g = clr0.getGreen();
|
|
||||||
int b = clr0.getBlue();
|
|
||||||
|
|
||||||
// Darker
|
|
||||||
if (step < 0) {
|
|
||||||
r = ((r + step > 0) ? r + step : 0);
|
|
||||||
g = ((g + step > 0) ? g + step : 0);
|
|
||||||
b = ((b + step > 0) ? b + step : 0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
r = ((r + step < 255) ? r + step : 255);
|
|
||||||
g = ((g + step < 255) ? g + step : 255);
|
|
||||||
b = ((b + step < 255) ? b + step : 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Color(r, g, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isLoaded() { return loaded; }
|
public static boolean isLoaded() { return loaded; }
|
||||||
|
|
||||||
/** Returns RGB components of a color, with a new
|
|
||||||
* value for alpha. 0 = transparent, 255 = opaque.
|
|
||||||
*
|
|
||||||
* @param clr0 {@link java.awt.Color}
|
|
||||||
* @param alpha int
|
|
||||||
* @return {@link java.awt.Color}
|
|
||||||
*/
|
|
||||||
public static Color alphaColor(Color clr0, int alpha) {
|
|
||||||
return new Color(clr0.getRed(), clr0.getGreen(), clr0.getBlue(), alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* getColorFromPixel.
|
* getColorFromPixel.
|
||||||
@@ -947,14 +1250,6 @@ public enum FSkin {
|
|||||||
FSkin.images.put(s0, isOldStyle ? bimOldFoils.getSubimage(x0, y0, w0, h0) : bimFoils.getSubimage(x0, y0, w0, h0));
|
FSkin.images.put(s0, isOldStyle ? bimOldFoils.getSubimage(x0, y0, w0, h0) : bimFoils.getSubimage(x0, y0, w0, h0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setColor(final SkinProp s0) {
|
|
||||||
tempCoords = s0.getCoords();
|
|
||||||
x0 = tempCoords[0];
|
|
||||||
y0 = tempCoords[1];
|
|
||||||
|
|
||||||
FSkin.colors.put(s0, FSkin.getColorFromPixel(bimPreferredSprite.getRGB(x0, y0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setFont(final int size) {
|
private static void setFont(final int size) {
|
||||||
plainFonts.put(size, font.deriveFont(Font.PLAIN, size));
|
plainFonts.put(size, font.deriveFont(Font.PLAIN, size));
|
||||||
}
|
}
|
||||||
@@ -1047,4 +1342,154 @@ public enum FSkin {
|
|||||||
FSkin.images.put(s0, bi0);
|
FSkin.images.put(s0, bi0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the look and feel of the GUI based on the selected Forge theme.
|
||||||
|
*
|
||||||
|
* @see <a href="http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/">UIManager Defaults</a>
|
||||||
|
*/
|
||||||
|
private static class ForgeLookAndFeel { //needs to live in FSkin for access to skin colors
|
||||||
|
|
||||||
|
private Color FORE_COLOR = FSkin.getColor(FSkin.Colors.CLR_TEXT).color;
|
||||||
|
private Color BACK_COLOR = FSkin.getColor(FSkin.Colors.CLR_THEME2).color;
|
||||||
|
private Color HIGHLIGHT_COLOR = BACK_COLOR.brighter();
|
||||||
|
private Border LINE_BORDER = BorderFactory.createLineBorder(FORE_COLOR.darker(), 1);
|
||||||
|
private Border EMPTY_BORDER = BorderFactory.createEmptyBorder(2,2,2,2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the look and feel of the GUI based on the selected Forge theme.
|
||||||
|
*/
|
||||||
|
public void setForgeLookAndFeel(JFrame appFrame) {
|
||||||
|
if (isUIManagerEnabled()) {
|
||||||
|
if (setMetalLookAndFeel(appFrame)) {
|
||||||
|
setMenusLookAndFeel();
|
||||||
|
setComboBoxLookAndFeel();
|
||||||
|
setTabbedPaneLookAndFeel();
|
||||||
|
setButtonLookAndFeel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the standard "Java L&F" (also called "Metal") that looks the same on all platforms.
|
||||||
|
* <p>
|
||||||
|
* If not explicitly set then the Mac uses its native L&F which does
|
||||||
|
* not support various settings (eg. combobox background color).
|
||||||
|
*/
|
||||||
|
private boolean setMetalLookAndFeel(JFrame appFrame) {
|
||||||
|
boolean isMetalLafSet = false;
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||||
|
SwingUtilities.updateComponentTreeUI(appFrame);
|
||||||
|
isMetalLafSet = true;
|
||||||
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
||||||
|
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return isMetalLafSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the look and feel for a JMenuBar, JMenu, JMenuItem & variations.
|
||||||
|
*/
|
||||||
|
private void setMenusLookAndFeel() {
|
||||||
|
// JMenuBar
|
||||||
|
Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME).color;
|
||||||
|
Color backgroundColor = FSkin.stepColor(clrTheme, 0);
|
||||||
|
Color menuBarEdgeColor = FSkin.stepColor(clrTheme, -80);
|
||||||
|
UIManager.put("MenuBar.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("MenuBar.gradient", getColorGradients(backgroundColor.darker(), backgroundColor));
|
||||||
|
UIManager.put("MenuBar.border", BorderFactory.createMatteBorder(0, 0, 1, 0, menuBarEdgeColor));
|
||||||
|
// JMenu
|
||||||
|
UIManager.put("Menu.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("Menu.background", BACK_COLOR);
|
||||||
|
UIManager.put("Menu.borderPainted", false);
|
||||||
|
UIManager.put("Menu.selectionBackground", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("Menu.selectionForeground", FORE_COLOR);
|
||||||
|
UIManager.put("Menu.border", EMPTY_BORDER);
|
||||||
|
UIManager.put("Menu.opaque", false);
|
||||||
|
// JPopupMenu
|
||||||
|
UIManager.put("PopupMenu.border", LINE_BORDER);
|
||||||
|
UIManager.put("PopupMenu.background", BACK_COLOR);
|
||||||
|
UIManager.put("PopupMenu.foreground", FORE_COLOR);
|
||||||
|
// JMenuItem
|
||||||
|
UIManager.put("MenuItem.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("MenuItem.background", BACK_COLOR);
|
||||||
|
UIManager.put("MenuItem.border", EMPTY_BORDER);
|
||||||
|
UIManager.put("MenuItem.selectionBackground", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("MenuItem.selectionForeground", FORE_COLOR);
|
||||||
|
UIManager.put("MenuItem.acceleratorForeground", FORE_COLOR.darker());
|
||||||
|
UIManager.put("MenuItem.opaque", true);
|
||||||
|
// JSeparator (needs to be opaque!).
|
||||||
|
UIManager.put("Separator.foreground", FORE_COLOR.darker());
|
||||||
|
UIManager.put("Separator.background", BACK_COLOR);
|
||||||
|
// JRadioButtonMenuItem
|
||||||
|
UIManager.put("RadioButtonMenuItem.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("RadioButtonMenuItem.background", BACK_COLOR);
|
||||||
|
UIManager.put("RadioButtonMenuItem.selectionBackground", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("RadioButtonMenuItem.selectionForeground", FORE_COLOR);
|
||||||
|
UIManager.put("RadioButtonMenuItem.border", EMPTY_BORDER);
|
||||||
|
UIManager.put("RadioButtonMenuItem.acceleratorForeground", FORE_COLOR.darker());
|
||||||
|
// JCheckboxMenuItem
|
||||||
|
UIManager.put("CheckBoxMenuItem.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("CheckBoxMenuItem.background", BACK_COLOR);
|
||||||
|
UIManager.put("CheckBoxMenuItem.selectionBackground", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("CheckBoxMenuItem.selectionForeground", FORE_COLOR);
|
||||||
|
UIManager.put("CheckBoxMenuItem.border", EMPTY_BORDER);
|
||||||
|
UIManager.put("CheckBoxMenuItem.acceleratorForeground", FORE_COLOR.darker());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTabbedPaneLookAndFeel() {
|
||||||
|
UIManager.put("TabbedPane.selected", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("TabbedPane.contentOpaque", FSkin.getColor(FSkin.Colors.CLR_THEME));
|
||||||
|
UIManager.put("TabbedPane.unselectedBackground", BACK_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the look and feel for a <b>non-editable</b> JComboBox.
|
||||||
|
*/
|
||||||
|
private void setComboBoxLookAndFeel() {
|
||||||
|
UIManager.put("ComboBox.background", BACK_COLOR);
|
||||||
|
UIManager.put("ComboBox.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("ComboBox.selectionBackground", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("ComboBox.selectionForeground", FORE_COLOR);
|
||||||
|
UIManager.put("ComboBox.disabledBackground", BACK_COLOR);
|
||||||
|
UIManager.put("ComboBox.disabledForeground", BACK_COLOR.darker());
|
||||||
|
UIManager.put("ComboBox.font", getDefaultFont("ComboBox.font"));
|
||||||
|
UIManager.put("Button.select", HIGHLIGHT_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setButtonLookAndFeel() {
|
||||||
|
UIManager.put("Button.foreground", FORE_COLOR);
|
||||||
|
UIManager.put("Button.background", BACK_COLOR);
|
||||||
|
UIManager.put("Button.select", HIGHLIGHT_COLOR);
|
||||||
|
UIManager.put("Button.focus", FORE_COLOR.darker());
|
||||||
|
UIManager.put("Button.rollover", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether theme styles should be applied to GUI.
|
||||||
|
* <p>
|
||||||
|
* TODO: Currently is using UI_THEMED_COMBOBOX setting but will
|
||||||
|
* eventually want to rename for clarity.
|
||||||
|
*/
|
||||||
|
private boolean isUIManagerEnabled() {
|
||||||
|
return Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Font getDefaultFont(String component) {
|
||||||
|
return FSkin.getFont(UIManager.getFont(component).getSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<Object> getColorGradients(Color bottom, Color top) {
|
||||||
|
ArrayList<Object> gradients = new ArrayList<>();
|
||||||
|
gradients.add(0.0);
|
||||||
|
gradients.add(0.0);
|
||||||
|
gradients.add(top);
|
||||||
|
gradients.add(bottom);
|
||||||
|
gradients.add(bottom);
|
||||||
|
return gradients;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,10 @@ public class FSpinner extends JSpinner {
|
|||||||
this.setEditor(new JSpinner.NumberEditor(this, "##"));
|
this.setEditor(new JSpinner.NumberEditor(this, "##"));
|
||||||
JFormattedTextField txt = ((JSpinner.NumberEditor)this.getEditor()).getTextField();
|
JFormattedTextField txt = ((JSpinner.NumberEditor)this.getEditor()).getTextField();
|
||||||
((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false);
|
((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false);
|
||||||
txt.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.JTextComponentSkin<JFormattedTextField> txtSkin = FSkin.get(txt);
|
||||||
txt.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
txtSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
txt.setCaretColor(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.setMargin(new Insets(5, 5, 5, 5));
|
||||||
txt.setOpaque(true);
|
txt.setOpaque(true);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ public class FTabbedPane extends JTabbedPane {
|
|||||||
private static final long serialVersionUID = 2207172560817790885L;
|
private static final long serialVersionUID = 2207172560817790885L;
|
||||||
|
|
||||||
public FTabbedPane() {
|
public FTabbedPane() {
|
||||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME));
|
FSkin.JComponentSkin<FTabbedPane> skin = FSkin.get(this);
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
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() {
|
public FTextArea() {
|
||||||
super();
|
super();
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.JTextComponentSkin<FTextArea> skin = FSkin.get(this);
|
||||||
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
skin.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setWrapStyleWord(true);
|
this.setWrapStyleWord(true);
|
||||||
this.setLineWrap(true);
|
this.setLineWrap(true);
|
||||||
|
|||||||
@@ -50,13 +50,15 @@ public class FTextField extends JTextField {
|
|||||||
|
|
||||||
public static final int HEIGHT = 25; //TODO: calculate this somehow instead of hard-coding it
|
public static final int HEIGHT = 25; //TODO: calculate this somehow instead of hard-coding it
|
||||||
|
|
||||||
|
private final FSkin.JTextComponentSkin<FTextField> skin;
|
||||||
private String ghostText;
|
private String ghostText;
|
||||||
private boolean showGhostTextWithFocus;
|
private boolean showGhostTextWithFocus;
|
||||||
|
|
||||||
private FTextField(Builder builder) {
|
private FTextField(Builder builder) {
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin = FSkin.get(this);
|
||||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
skin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setCaretColor(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.setMargin(new Insets(3, 3, 2, 3));
|
||||||
this.setOpaque(true);
|
this.setOpaque(true);
|
||||||
|
|
||||||
@@ -115,7 +117,7 @@ public class FTextField extends JTextField {
|
|||||||
final Insets margin = this.getMargin();
|
final Insets margin = this.getMargin();
|
||||||
final Graphics2D g2d = (Graphics2D)g.create();
|
final Graphics2D g2d = (Graphics2D)g.create();
|
||||||
g2d.setFont(this.getFont());
|
g2d.setFont(this.getFont());
|
||||||
g2d.setColor(FSkin.stepColor(this.getForeground(), 20));
|
skin.setGraphicsColor(g2d, skin.getForeground().stepColor(20));
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
g2d.drawString(this.ghostText, margin.left + 2, margin.top + 15); //account for borders (TODO: why +15?)
|
g2d.drawString(this.ghostText, margin.left + 2, margin.top + 15); //account for borders (TODO: why +15?)
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.gui.toolbox.itemmanager.filters;
|
package forge.gui.toolbox.itemmanager.filters;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ public abstract class ItemFilter<T extends InventoryItem> {
|
|||||||
if (this.panel == null) {
|
if (this.panel == null) {
|
||||||
this.panel = new JPanel(new MigLayout("insets 0, gap 2"));
|
this.panel = new JPanel(new MigLayout("insets 0, gap 2"));
|
||||||
this.panel.setOpaque(false);
|
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.lblPanelTitle = new FLabel.Builder().fontSize(10).build();
|
||||||
this.panel.add(this.lblPanelTitle, "top");
|
this.panel.add(this.lblPanelTitle, "top");
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import forge.item.InventoryItem;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public final class ItemTable<T extends InventoryItem> extends JTable {
|
public final class ItemTable<T extends InventoryItem> extends JTable {
|
||||||
|
private final FSkin.JTableSkin<ItemTable<T>> skin;
|
||||||
private final ItemManager<T> itemManager;
|
private final ItemManager<T> itemManager;
|
||||||
private final ItemTableModel<T> tableModel;
|
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);
|
this.tableModel = new ItemTableModel<T>(this, model0);
|
||||||
|
|
||||||
// use different selection highlight colors for focused vs. unfocused tables
|
// use different selection highlight colors for focused vs. unfocused tables
|
||||||
setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
skin = FSkin.get(this);
|
||||||
setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||||
|
skin.setSelectionForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
addFocusListener(new FocusListener() {
|
addFocusListener(new FocusListener() {
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
if (!e.isTemporary()) {
|
if (!e.isTemporary()) {
|
||||||
setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
skin.setSelectionBackground(FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusGained(FocusEvent e) {
|
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 nothing selected when we gain focus, select the first row (if exists)
|
||||||
if (-1 == getSelectedRow() && 0 < getRowCount()) {
|
if (-1 == getSelectedRow() && 0 < getRowCount()) {
|
||||||
setRowSelectionInterval(0, 0);
|
setRowSelectionInterval(0, 0);
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -69,7 +67,8 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
private RowPanel[] rows;
|
private RowPanel[] rows;
|
||||||
private final GameType gametype;
|
private final GameType gametype;
|
||||||
private Command cmdDelete, cmdRowSelect;
|
private Command cmdDelete, cmdRowSelect;
|
||||||
private final Color clrDefault, clrHover, clrActive, clrBorders;
|
private final Color clrDefault;
|
||||||
|
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates deck list for selected decks for quick deleting, editing, and
|
* Creates deck list for selected decks for quick deleting, editing, and
|
||||||
@@ -125,7 +124,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
// scroll panes will have difficulty dynamically resizing if 100% width
|
// scroll panes will have difficulty dynamically resizing if 100% width
|
||||||
// is set.
|
// is set.
|
||||||
final JPanel rowTitle = new TitlePanel();
|
final JPanel rowTitle = new TitlePanel();
|
||||||
rowTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(rowTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
rowTitle.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
|
|
||||||
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(),
|
rowTitle.add(new FLabel.Builder().text("Delete").fontAlign(SwingConstants.CENTER).build(),
|
||||||
@@ -203,7 +202,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseEntered(final MouseEvent e) {
|
public void mouseEntered(final MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(DeckLister.this.clrHover);
|
FSkin.get(r0).setBackground(DeckLister.this.clrHover);
|
||||||
r0.setOpaque(true);
|
r0.setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,7 +210,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseExited(final MouseEvent e) {
|
public void mouseExited(final MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(DeckLister.this.clrDefault);
|
FSkin.get(r0).setBackground(DeckLister.this.clrDefault);
|
||||||
r0.setOpaque(false);
|
r0.setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +240,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseEntered(final MouseEvent e) {
|
public void mouseEntered(final MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(DeckLister.this.clrHover);
|
FSkin.get(r0).setBackground(DeckLister.this.clrHover);
|
||||||
r0.setOpaque(true);
|
r0.setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,7 +248,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseExited(final MouseEvent e) {
|
public void mouseExited(final MouseEvent e) {
|
||||||
if (!r0.selected) {
|
if (!r0.selected) {
|
||||||
r0.setBackground(DeckLister.this.clrDefault);
|
FSkin.get(r0).setBackground(DeckLister.this.clrDefault);
|
||||||
r0.setOpaque(false);
|
r0.setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,7 +283,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
this.setBackground(new Color(0, 0, 0, 0));
|
this.setBackground(new Color(0, 0, 0, 0));
|
||||||
this.setLayout(new MigLayout("insets 0, gap 0"));
|
this.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
this.setBorder(new MatteBorder(0, 0, 1, 0, DeckLister.this.clrBorders));
|
FSkin.get(this).setMatteBorder(0, 0, 1, 0, DeckLister.this.clrBorders);
|
||||||
this.deck = d0;
|
this.deck = d0;
|
||||||
|
|
||||||
this.addMouseListener(new MouseAdapter() {
|
this.addMouseListener(new MouseAdapter() {
|
||||||
@@ -292,7 +291,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
public void mouseEntered(final MouseEvent e) {
|
public void mouseEntered(final MouseEvent e) {
|
||||||
RowPanel.this.hovered = true;
|
RowPanel.this.hovered = true;
|
||||||
if (!RowPanel.this.selected) {
|
if (!RowPanel.this.selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(DeckLister.this.clrHover);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(DeckLister.this.clrHover);
|
||||||
((RowPanel) e.getSource()).setOpaque(true);
|
((RowPanel) e.getSource()).setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +300,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
public void mouseExited(final MouseEvent e) {
|
public void mouseExited(final MouseEvent e) {
|
||||||
RowPanel.this.hovered = false;
|
RowPanel.this.hovered = false;
|
||||||
if (!RowPanel.this.selected) {
|
if (!RowPanel.this.selected) {
|
||||||
((RowPanel) e.getSource()).setBackground(DeckLister.this.clrDefault);
|
FSkin.get(((RowPanel) e.getSource())).setBackground(DeckLister.this.clrDefault);
|
||||||
((RowPanel) e.getSource()).setOpaque(false);
|
((RowPanel) e.getSource()).setOpaque(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,7 +320,9 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
public void setSelected(final boolean b0) {
|
public void setSelected(final boolean b0) {
|
||||||
this.selected = b0;
|
this.selected = b0;
|
||||||
this.setOpaque(b0);
|
this.setOpaque(b0);
|
||||||
this.setBackground(b0 ? DeckLister.this.clrActive : (this.hovered ? DeckLister.this.clrHover : DeckLister.this.clrDefault));
|
if (b0) { FSkin.get(this).setBackground(DeckLister.this.clrActive); }
|
||||||
|
else if (this.hovered) { FSkin.get(this).setBackground(DeckLister.this.clrHover); }
|
||||||
|
else { FSkin.get(this).setBackground(DeckLister.this.clrDefault); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelected() {
|
public boolean isSelected() {
|
||||||
@@ -352,7 +353,7 @@ public class DeckLister extends JPanel implements ILocalRepaint {
|
|||||||
public GenericLabel(final String txt0) {
|
public GenericLabel(final String txt0) {
|
||||||
super(txt0);
|
super(txt0);
|
||||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(this).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.setFont(FSkin.getBoldFont(12));
|
this.setFont(FSkin.getBoldFont(12));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.gui.toolbox.special;
|
package forge.gui.toolbox.special;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
@@ -115,7 +114,7 @@ public class PhaseLabel extends JLabel {
|
|||||||
public void paintComponent(final Graphics g) {
|
public void paintComponent(final Graphics g) {
|
||||||
final int w = this.getWidth();
|
final int w = this.getWidth();
|
||||||
final int h = this.getHeight();
|
final int h = this.getHeight();
|
||||||
Color c;
|
FSkin.SkinColor c;
|
||||||
|
|
||||||
// Set color according to skip or active or hover state of label
|
// Set color according to skip or active or hover state of label
|
||||||
if (this.hover) {
|
if (this.hover) {
|
||||||
@@ -131,7 +130,7 @@ public class PhaseLabel extends JLabel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Center vertically and horizontally. Show border if active.
|
// Center vertically and horizontally. Show border if active.
|
||||||
g.setColor(c);
|
FSkin.get(this).setGraphicsColor(g, c);
|
||||||
g.fillRoundRect(1, 1, w - 2, h - 2, 5, 5);
|
g.fillRoundRect(1, 1, w - 2, h - 2, 5, 5);
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
final JPanel row5 = new JPanel(new MigLayout("insets 0, gap 0"));
|
final JPanel row5 = new JPanel(new MigLayout("insets 0, gap 0"));
|
||||||
final JPanel row6 = new JPanel(new MigLayout("insets 0, gap 0"));
|
final JPanel row6 = new JPanel(new MigLayout("insets 0, gap 0"));
|
||||||
|
|
||||||
row1.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
FSkin.get(row1).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||||
row2.setOpaque(false);
|
row2.setOpaque(false);
|
||||||
row3.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
FSkin.get(row3).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||||
row4.setOpaque(false);
|
row4.setOpaque(false);
|
||||||
row5.setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
FSkin.get(row5).setBackground(FSkin.getColor(FSkin.Colors.CLR_ZEBRA));
|
||||||
row6.setOpaque(false);
|
row6.setOpaque(false);
|
||||||
|
|
||||||
// Hand, library, graveyard, exile, flashback, poison labels
|
// Hand, library, graveyard, exile, flashback, poison labels
|
||||||
@@ -151,8 +151,12 @@ public class PlayerDetailsPanel extends JPanel {
|
|||||||
|
|
||||||
// Poison/life
|
// Poison/life
|
||||||
this.getLblPoison().setText("" + player.getPoisonCounters());
|
this.getLblPoison().setText("" + player.getPoisonCounters());
|
||||||
Color poisonFg = player.getPoisonCounters() >= 8 ? Color.red : FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
if (player.getPoisonCounters() < 8) {
|
||||||
this.getLblPoison().setForeground(poisonFg);
|
FSkin.get(this.getLblPoison()).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FSkin.get(this.getLblPoison()).setForeground(Color.red);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,166 +0,0 @@
|
|||||||
package forge.properties;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.UIManager;
|
|
||||||
import javax.swing.UnsupportedLookAndFeelException;
|
|
||||||
import javax.swing.border.Border;
|
|
||||||
|
|
||||||
import forge.Singletons;
|
|
||||||
import forge.gui.toolbox.FSkin;
|
|
||||||
import forge.properties.ForgePreferences.FPref;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the look and feel of the GUI based on the selected Forge theme.
|
|
||||||
*
|
|
||||||
* @see <a href="http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/">UIManager Defaults</a>
|
|
||||||
*/
|
|
||||||
public final class ForgeLookAndFeel {
|
|
||||||
|
|
||||||
private Color FORE_COLOR = FSkin.getColor(FSkin.Colors.CLR_TEXT);
|
|
||||||
private Color BACK_COLOR = FSkin.getColor(FSkin.Colors.CLR_THEME2);
|
|
||||||
private Color HIGHLIGHT_COLOR = BACK_COLOR.brighter();
|
|
||||||
private Border LINE_BORDER = BorderFactory.createLineBorder(FORE_COLOR.darker(), 1);
|
|
||||||
private Border EMPTY_BORDER = BorderFactory.createEmptyBorder(2,2,2,2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the look and feel of the GUI based on the selected Forge theme.
|
|
||||||
*/
|
|
||||||
public void setForgeLookAndFeel(JFrame appFrame) {
|
|
||||||
if (isUIManagerEnabled()) {
|
|
||||||
if (setMetalLookAndFeel(appFrame)) {
|
|
||||||
setMenusLookAndFeel();
|
|
||||||
setComboBoxLookAndFeel();
|
|
||||||
setTabbedPaneLookAndFeel();
|
|
||||||
setButtonLookAndFeel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the standard "Java L&F" (also called "Metal") that looks the same on all platforms.
|
|
||||||
* <p>
|
|
||||||
* If not explicitly set then the Mac uses its native L&F which does
|
|
||||||
* not support various settings (eg. combobox background color).
|
|
||||||
*/
|
|
||||||
private boolean setMetalLookAndFeel(JFrame appFrame) {
|
|
||||||
boolean isMetalLafSet = false;
|
|
||||||
try {
|
|
||||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
|
||||||
SwingUtilities.updateComponentTreeUI(appFrame);
|
|
||||||
isMetalLafSet = true;
|
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
|
||||||
// Auto-generated catch block ignores the exception, but sends it to System.err and probably forge.log.
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return isMetalLafSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the look and feel for a JMenuBar, JMenu, JMenuItem & variations.
|
|
||||||
*/
|
|
||||||
private void setMenusLookAndFeel() {
|
|
||||||
// JMenuBar
|
|
||||||
Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
|
|
||||||
Color backgroundColor = FSkin.stepColor(clrTheme, 0);
|
|
||||||
Color menuBarEdgeColor = FSkin.stepColor(clrTheme, -80);
|
|
||||||
UIManager.put("MenuBar.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("MenuBar.gradient", getColorGradients(backgroundColor.darker(), backgroundColor));
|
|
||||||
UIManager.put("MenuBar.border", BorderFactory.createMatteBorder(0, 0, 1, 0, menuBarEdgeColor));
|
|
||||||
// JMenu
|
|
||||||
UIManager.put("Menu.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("Menu.background", BACK_COLOR);
|
|
||||||
UIManager.put("Menu.borderPainted", false);
|
|
||||||
UIManager.put("Menu.selectionBackground", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("Menu.selectionForeground", FORE_COLOR);
|
|
||||||
UIManager.put("Menu.border", EMPTY_BORDER);
|
|
||||||
UIManager.put("Menu.opaque", false);
|
|
||||||
// JPopupMenu
|
|
||||||
UIManager.put("PopupMenu.border", LINE_BORDER);
|
|
||||||
UIManager.put("PopupMenu.background", BACK_COLOR);
|
|
||||||
UIManager.put("PopupMenu.foreground", FORE_COLOR);
|
|
||||||
// JMenuItem
|
|
||||||
UIManager.put("MenuItem.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("MenuItem.background", BACK_COLOR);
|
|
||||||
UIManager.put("MenuItem.border", EMPTY_BORDER);
|
|
||||||
UIManager.put("MenuItem.selectionBackground", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("MenuItem.selectionForeground", FORE_COLOR);
|
|
||||||
UIManager.put("MenuItem.acceleratorForeground", FORE_COLOR.darker());
|
|
||||||
UIManager.put("MenuItem.opaque", true);
|
|
||||||
// JSeparator (needs to be opaque!).
|
|
||||||
UIManager.put("Separator.foreground", FORE_COLOR.darker());
|
|
||||||
UIManager.put("Separator.background", BACK_COLOR);
|
|
||||||
// JRadioButtonMenuItem
|
|
||||||
UIManager.put("RadioButtonMenuItem.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("RadioButtonMenuItem.background", BACK_COLOR);
|
|
||||||
UIManager.put("RadioButtonMenuItem.selectionBackground", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("RadioButtonMenuItem.selectionForeground", FORE_COLOR);
|
|
||||||
UIManager.put("RadioButtonMenuItem.border", EMPTY_BORDER);
|
|
||||||
UIManager.put("RadioButtonMenuItem.acceleratorForeground", FORE_COLOR.darker());
|
|
||||||
// JCheckboxMenuItem
|
|
||||||
UIManager.put("CheckBoxMenuItem.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("CheckBoxMenuItem.background", BACK_COLOR);
|
|
||||||
UIManager.put("CheckBoxMenuItem.selectionBackground", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("CheckBoxMenuItem.selectionForeground", FORE_COLOR);
|
|
||||||
UIManager.put("CheckBoxMenuItem.border", EMPTY_BORDER);
|
|
||||||
UIManager.put("CheckBoxMenuItem.acceleratorForeground", FORE_COLOR.darker());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setTabbedPaneLookAndFeel() {
|
|
||||||
UIManager.put("TabbedPane.selected", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("TabbedPane.contentOpaque", FSkin.getColor(FSkin.Colors.CLR_THEME));
|
|
||||||
UIManager.put("TabbedPane.unselectedBackground", BACK_COLOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the look and feel for a <b>non-editable</b> JComboBox.
|
|
||||||
*/
|
|
||||||
private void setComboBoxLookAndFeel() {
|
|
||||||
UIManager.put("ComboBox.background", BACK_COLOR);
|
|
||||||
UIManager.put("ComboBox.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("ComboBox.selectionBackground", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("ComboBox.selectionForeground", FORE_COLOR);
|
|
||||||
UIManager.put("ComboBox.disabledBackground", BACK_COLOR);
|
|
||||||
UIManager.put("ComboBox.disabledForeground", BACK_COLOR.darker());
|
|
||||||
UIManager.put("ComboBox.font", getDefaultFont("ComboBox.font"));
|
|
||||||
UIManager.put("Button.select", HIGHLIGHT_COLOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setButtonLookAndFeel() {
|
|
||||||
UIManager.put("Button.foreground", FORE_COLOR);
|
|
||||||
UIManager.put("Button.background", BACK_COLOR);
|
|
||||||
UIManager.put("Button.select", HIGHLIGHT_COLOR);
|
|
||||||
UIManager.put("Button.focus", FORE_COLOR.darker());
|
|
||||||
UIManager.put("Button.rollover", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether theme styles should be applied to GUI.
|
|
||||||
* <p>
|
|
||||||
* TODO: Currently is using UI_THEMED_COMBOBOX setting but will
|
|
||||||
* eventually want to rename for clarity.
|
|
||||||
*/
|
|
||||||
private boolean isUIManagerEnabled() {
|
|
||||||
return Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_THEMED_COMBOBOX);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Font getDefaultFont(String component) {
|
|
||||||
return FSkin.getFont(UIManager.getFont(component).getSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<Object> getColorGradients(Color bottom, Color top) {
|
|
||||||
ArrayList<Object> gradients = new ArrayList<>();
|
|
||||||
gradients.add(0.0);
|
|
||||||
gradients.add(0.0);
|
|
||||||
gradients.add(top);
|
|
||||||
gradients.add(bottom);
|
|
||||||
gradients.add(bottom);
|
|
||||||
return gradients;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@ public class ViewItem extends FPanel {
|
|||||||
this.tarDesc = new FTextArea();
|
this.tarDesc = new FTextArea();
|
||||||
this.btnPurchase = new FLabel.Builder().text("Buy").opaque(true).fontSize(20).hoverable(true).build();
|
this.btnPurchase = new FLabel.Builder().text("Buy").opaque(true).fontSize(20).hoverable(true).build();
|
||||||
|
|
||||||
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
FSkin.get(this).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
this.setLayout(new MigLayout("insets 0, gap 0"));
|
this.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class ViewStall extends JPanel {
|
|||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
|
|
||||||
this.tpnFluff.setOpaque(false);
|
this.tpnFluff.setOpaque(false);
|
||||||
this.tpnFluff.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
FSkin.get(this.tpnFluff).setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
this.tpnFluff.setFont(FSkin.getItalicFont(15));
|
this.tpnFluff.setFont(FSkin.getItalicFont(15));
|
||||||
this.tpnFluff.setFocusable(false);
|
this.tpnFluff.setFocusable(false);
|
||||||
this.tpnFluff.setEditable(false);
|
this.tpnFluff.setEditable(false);
|
||||||
|
|||||||
@@ -84,14 +84,14 @@ public enum FView {
|
|||||||
|
|
||||||
private FView() {
|
private FView() {
|
||||||
frmSplash = new SplashFrame();
|
frmSplash = new SplashFrame();
|
||||||
|
|
||||||
// Insets panel has background image / texture, which
|
|
||||||
// must be instantiated after the skin is loaded.
|
|
||||||
pnlInsets = new FPanel(new BorderLayout());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
// Insets panel has background image / texture, which
|
||||||
|
// must be instantiated after the skin is loaded.
|
||||||
|
pnlInsets = new FPanel(new BorderLayout());
|
||||||
|
|
||||||
// Frame styling
|
// Frame styling
|
||||||
frmDocument.setMinimumSize(new Dimension(800, 600));
|
frmDocument.setMinimumSize(new Dimension(800, 600));
|
||||||
frmDocument.setLocationRelativeTo(null);
|
frmDocument.setLocationRelativeTo(null);
|
||||||
@@ -121,7 +121,7 @@ public enum FView {
|
|||||||
pnlContent.setOpaque(false);
|
pnlContent.setOpaque(false);
|
||||||
pnlContent.setLayout(null);
|
pnlContent.setLayout(null);
|
||||||
|
|
||||||
FOverlay.SINGLETON_INSTANCE.getPanel().setBackground(FSkin.getColor(FSkin.Colors.CLR_OVERLAY));
|
FSkin.get(FOverlay.SINGLETON_INSTANCE.getPanel()).setBackground(FSkin.getColor(FSkin.Colors.CLR_OVERLAY));
|
||||||
|
|
||||||
// Populate all drag tab components.
|
// Populate all drag tab components.
|
||||||
this.cacheUIStates();
|
this.cacheUIStates();
|
||||||
|
|||||||
Reference in New Issue
Block a user