diff --git a/.gitattributes b/.gitattributes index 43ca9322288..b0d99e4cd8b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9881,7 +9881,6 @@ res/images/skins/rebel/btnRover.png -text res/images/skins/rebel/btnRup.png -text res/images/skins/rebel/font1.ttf -text res/images/skins/rebel/sprite.png -text -res/images/skins/rebel/texture1.jpg -text res/images/skins/smith/bg_match.jpg -text res/images/skins/smith/bg_splash.jpg -text res/images/skins/smith/btnLdown.png -text @@ -9895,7 +9894,6 @@ res/images/skins/smith/btnRover.png -text res/images/skins/smith/btnRup.png -text res/images/skins/smith/font1.ttf -text res/images/skins/smith/sprite.png -text -res/images/skins/smith/texture1.jpg -text res/images/symbols-13/0.png -text svneol=unset#image/png res/images/symbols-13/1.png -text svneol=unset#image/png res/images/symbols-13/10.png -text svneol=unset#image/png diff --git a/res/images/skins/rebel/texture1.jpg b/res/images/skins/rebel/texture1.jpg deleted file mode 100644 index b6b02da1349..00000000000 Binary files a/res/images/skins/rebel/texture1.jpg and /dev/null differ diff --git a/res/images/skins/smith/texture1.jpg b/res/images/skins/smith/texture1.jpg deleted file mode 100644 index 9bf4763c26c..00000000000 Binary files a/res/images/skins/smith/texture1.jpg and /dev/null differ diff --git a/src/main/java/forge/view/home/SplashFrame.java b/src/main/java/forge/view/home/SplashFrame.java index 7b001ea9b77..44946dfaa4d 100644 --- a/src/main/java/forge/view/home/SplashFrame.java +++ b/src/main/java/forge/view/home/SplashFrame.java @@ -86,7 +86,7 @@ public class SplashFrame extends JFrame { this.setUndecorated(true); // Set preferred JFrame properties. - final ImageIcon bgIcon = skin.getSplashBG(); + final ImageIcon bgIcon = skin.getImage("bg.splash"); final int splashWidthPx = bgIcon.getIconWidth(); final int splashHeightPx = bgIcon.getIconHeight(); @@ -146,16 +146,12 @@ public class SplashFrame extends JFrame { contentPane.getActionMap().put("escAction", new CloseAction()); - // Set UI to color splash bar fill with skin colors - UIManager.put("ProgressBar.background", skin.getClrProgress1()); // Unfilled - // state - UIManager.put("ProgressBar.selectionBackground", skin.getClrProgress2()); // Unfilled - // state - UIManager.put("ProgressBar.foreground", skin.getClrProgress3()); // Filled - // state - UIManager.put("ProgressBar.selectionForeground", skin.getClrProgress4()); // Filled - // state - UIManager.put("ProgressBar.border", new LineBorder(skin.getClrTheme(), 0)); + // Set UI to color splash bar filled/unfilled states with skin colors + UIManager.put("ProgressBar.background", skin.getColor("progress1")); + UIManager.put("ProgressBar.selectionBackground", skin.getColor("progress2")); + UIManager.put("ProgressBar.foreground", skin.getColor("progress3")); + UIManager.put("ProgressBar.selectionForeground", skin.getColor("progress4")); + UIManager.put("ProgressBar.border", new LineBorder(skin.getColor("theme"), 0)); // Instantiate model and view and tie together. this.monitorModel = new SplashProgressModel(); diff --git a/src/main/java/forge/view/match/ViewDetail.java b/src/main/java/forge/view/match/ViewDetail.java index 726b4142dc3..51b82df669f 100644 --- a/src/main/java/forge/view/match/ViewDetail.java +++ b/src/main/java/forge/view/match/ViewDetail.java @@ -47,7 +47,7 @@ public class ViewDetail extends FRoundedPanel { pnlDetail = new CardDetailPanel(null); pnlDetail.setOpaque(false); - this.setBackground(AllZone.getSkin().getClrTheme()); + this.setBackground(AllZone.getSkin().getColor("theme")); this.setLayout(new MigLayout("insets 0, gap 0")); add(pnlDetail, "w 100%!, h 100%!"); diff --git a/src/main/java/forge/view/match/ViewDock.java b/src/main/java/forge/view/match/ViewDock.java index bc52fb721ea..36d47699829 100644 --- a/src/main/java/forge/view/match/ViewDock.java +++ b/src/main/java/forge/view/match/ViewDock.java @@ -76,7 +76,7 @@ public class ViewDock extends FRoundedPanel { public ViewDock() { super(); this.setToolTipText("Shortcut Button Dock"); - this.setBackground(AllZone.getSkin().getClrTheme()); + this.setBackground(AllZone.getSkin().getColor("theme")); //this.setLayout(new MigLayout("insets 0, gap 0, ay center, ax center")); // Mig layout does not support wrapping! @@ -168,7 +168,7 @@ public class ViewDock extends FRoundedPanel { */ public class DockButton extends JLabel { private final Image img; - private final Color hoverBG = ViewDock.this.skin.getClrHover(); + private final Color hoverBG = ViewDock.this.skin.getColor("hover"); private final Color defaultBG = new Color(0, 0, 0, 0); private Color clrBorders = new Color(0, 0, 0, 0); private int w, h; @@ -196,7 +196,7 @@ public class ViewDock extends FRoundedPanel { this.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(final MouseEvent e) { - DockButton.this.clrBorders = ViewDock.this.skin.getClrBorders(); + DockButton.this.clrBorders = ViewDock.this.skin.getColor("borders"); DockButton.this.setBackground(DockButton.this.hoverBG); } @@ -234,8 +234,8 @@ public class ViewDock extends FRoundedPanel { overlay.showOverlay(); final FPanel parent = new FPanel(); - parent.setBGImg(this.skin.getTexture1()); - parent.setBorder(new LineBorder(this.skin.getClrBorders(), 1)); + parent.setBGImg(this.skin.getImage("bg.texture")); + parent.setBorder(new LineBorder(this.skin.getColor("borders"), 1)); parent.setLayout(new MigLayout("insets 0, wrap 2, ax center, ay center")); overlay.add(parent, "w 80%!, h 80%!, gaptop 10%, gapleft 10%, span 2 1"); @@ -359,7 +359,7 @@ public class ViewDock extends FRoundedPanel { public KeyboardShortcutLabel(final String s0) { super(s0); - this.setForeground(ViewDock.this.skin.getClrText()); + this.setForeground(ViewDock.this.skin.getColor("text")); this.setFont(ViewDock.this.skin.getFont1().deriveFont(Font.PLAIN, 16)); } } @@ -408,7 +408,7 @@ public class ViewDock extends FRoundedPanel { this.addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { - KeyboardShortcutField.this.setBackground(ViewDock.this.skin.getClrActive()); + KeyboardShortcutField.this.setBackground(ViewDock.this.skin.getColor("active")); } @Override diff --git a/src/main/java/forge/view/match/ViewField.java b/src/main/java/forge/view/match/ViewField.java index e65a959bfa3..9383eb51cb4 100644 --- a/src/main/java/forge/view/match/ViewField.java +++ b/src/main/java/forge/view/match/ViewField.java @@ -86,11 +86,11 @@ public class ViewField extends FRoundedPanel { this.setLayout(new MigLayout("insets 0, gap 0")); this.setCornerRadius(5); this.setToolTipText(player.getName() + " Gameboard"); - this.setBackground(AllZone.getSkin().getClrTheme()); + this.setBackground(AllZone.getSkin().getColor("theme")); this.skin = AllZone.getSkin(); this.inactiveBorder = new LineBorder(new Color(0, 0, 0, 0), 1); - this.hoverBorder = new LineBorder(this.skin.getClrBorders(), 1); + this.hoverBorder = new LineBorder(this.skin.getColor("borders"), 1); this.counter = -1; String filename = "res/pics/icons/" + (player.isHuman() ? "Mage01.jpg" : "Mage02.jpg"); @@ -99,7 +99,7 @@ public class ViewField extends FRoundedPanel { // Avatar and life avatarArea = new JPanel(); avatarArea.setOpaque(false); - avatarArea.setBackground(skin.getClrHover()); + avatarArea.setBackground(skin.getColor("hover")); avatarArea.setLayout(new MigLayout("insets 0, gap 0")); lblAvatar = new JLabel(); @@ -108,7 +108,7 @@ public class ViewField extends FRoundedPanel { lblLife = new JLabel(); lblLife.setHorizontalAlignment(SwingConstants.CENTER); - lblLife.setForeground(skin.getClrText()); + lblLife.setForeground(skin.getColor("text")); avatarArea.add(lblLife, "w 100%!, h 30%!"); this.add(avatarArea, "w 10%!, h 30%!"); @@ -124,7 +124,7 @@ public class ViewField extends FRoundedPanel { final JScrollPane scroller = new JScrollPane(); this.tabletop = new PlayArea(scroller, player.equals(AllZone.getComputerPlayer()) ? true : false); - this.tabletop.setBorder(new MatteBorder(0, 1, 0, 0, this.skin.getClrBorders())); + this.tabletop.setBorder(new MatteBorder(0, 1, 0, 0, this.skin.getColor("borders"))); this.tabletop.setOpaque(false); scroller.setViewportView(this.tabletop); @@ -327,14 +327,14 @@ public class ViewField extends FRoundedPanel { this.getLblLife().setForeground(Color.red); } else { - this.getLblLife().setForeground(skin.getClrText()); + this.getLblLife().setForeground(skin.getColor("text")); } if (p0.getPoisonCounters() >= 8) { this.getLblPoison().setForeground(Color.red); } else { - this.getLblPoison().setForeground(skin.getClrText()); + this.getLblPoison().setForeground(skin.getColor("text")); } //mana pool @@ -647,7 +647,7 @@ public class ViewField extends FRoundedPanel { this.setIcon(skin.getIcon(iconAddress, h - 2 * padding, h - 2 * padding)); this.setText(txt0); this.setOpaque(false); - this.setForeground(ViewField.this.skin.getClrText()); + this.setForeground(ViewField.this.skin.getColor("text")); this.setPreferredSize(this.labelSize); this.setMaximumSize(this.labelSize); this.setMinimumSize(this.labelSize); @@ -660,9 +660,9 @@ public class ViewField extends FRoundedPanel { ViewField.this.counter++; if (((ViewField.this.counter % 4) == 2) || ((ViewField.this.counter % 4) == 3)) { - this.defaultBG = ViewField.this.skin.getClrZebra(); + this.defaultBG = ViewField.this.skin.getColor("zebra"); } else { - this.defaultBG = ViewField.this.skin.getClrTheme(); + this.defaultBG = ViewField.this.skin.getColor("theme"); } this.setBackground(this.defaultBG); @@ -680,7 +680,7 @@ public class ViewField extends FRoundedPanel { @Override public void mouseEntered(final MouseEvent e) { DetailLabel.this.setBackground(DetailLabel.this.hoverBG); - DetailLabel.this.clrBorders = ViewField.this.skin.getClrBorders(); + DetailLabel.this.clrBorders = ViewField.this.skin.getColor("borders"); } @Override @@ -690,7 +690,7 @@ public class ViewField extends FRoundedPanel { } }; - this.hoverBG = ViewField.this.skin.getClrHover(); + this.hoverBG = ViewField.this.skin.getColor("hover"); this.clrBorders = ViewField.this.transparent; } @@ -730,7 +730,7 @@ public class ViewField extends FRoundedPanel { private boolean enabled = true; private boolean active = false; private boolean hover = false; - private final Color hoverBG = AllZone.getSkin().getClrHover(); + private final Color hoverBG = AllZone.getSkin().getColor("hover"); /** * Shows phase labels, handles repainting and on/off states. A diff --git a/src/main/java/forge/view/match/ViewHand.java b/src/main/java/forge/view/match/ViewHand.java index 68c797967d7..6d9b5eb85e1 100644 --- a/src/main/java/forge/view/match/ViewHand.java +++ b/src/main/java/forge/view/match/ViewHand.java @@ -40,7 +40,7 @@ public class ViewHand extends FRoundedPanel { public ViewHand() { final JScrollPane scroller = new JScrollPane(); ViewHand.this.hand = new HandArea(scroller, null); - ViewHand.this.setBackground(AllZone.getSkin().getClrTheme()); + ViewHand.this.setBackground(AllZone.getSkin().getColor("theme")); scroller.setViewportView(ViewHand.this.hand); scroller.setOpaque(false); diff --git a/src/main/java/forge/view/match/ViewInput.java b/src/main/java/forge/view/match/ViewInput.java index 0d91bf743af..6cdb952ff41 100644 --- a/src/main/java/forge/view/match/ViewInput.java +++ b/src/main/java/forge/view/match/ViewInput.java @@ -57,8 +57,8 @@ public class ViewInput extends FRoundedPanel { super(); this.skin = AllZone.getSkin(); this.setToolTipText("Input Area"); - this.setBackground(this.skin.getClrTheme()); - this.setForeground(this.skin.getClrText()); + this.setBackground(this.skin.getColor("theme")); + this.setForeground(this.skin.getColor("text")); this.setLayout(new MigLayout("wrap 2, fill, insets 0, gap 0")); // Cancel button @@ -71,7 +71,7 @@ public class ViewInput extends FRoundedPanel { this.tarMessage.setEditable(false); this.tarMessage.setLineWrap(true); this.tarMessage.setWrapStyleWord(true); - this.tarMessage.setForeground(this.skin.getClrText()); + this.tarMessage.setForeground(this.skin.getColor("text")); this.tarMessage.setFont(this.skin.getFont1().deriveFont(Font.PLAIN, 16)); this.add(this.tarMessage, "span 2 1, h 80%!, w 96%!, gapleft 2%, gaptop 1%"); this.add(this.btnOK, "w 47%!, gapright 2%, gapleft 1%"); diff --git a/src/main/java/forge/view/match/ViewPicture.java b/src/main/java/forge/view/match/ViewPicture.java index cbc4a3a7322..21467b507a1 100644 --- a/src/main/java/forge/view/match/ViewPicture.java +++ b/src/main/java/forge/view/match/ViewPicture.java @@ -41,7 +41,7 @@ public class ViewPicture extends FRoundedPanel { pnlPicture = new CardPicturePanel(null); pnlPicture.setOpaque(false); - this.setBackground(AllZone.getSkin().getClrTheme()); + this.setBackground(AllZone.getSkin().getColor("theme")); this.setLayout(new MigLayout("insets 0, gap 0, center")); add(pnlPicture, "w 96%!, h 96%!, gapleft 2%, gapright 2%, gaptop 2%"); diff --git a/src/main/java/forge/view/match/ViewTabber.java b/src/main/java/forge/view/match/ViewTabber.java index 9b851986de3..d9fb0ceb1e7 100644 --- a/src/main/java/forge/view/match/ViewTabber.java +++ b/src/main/java/forge/view/match/ViewTabber.java @@ -142,7 +142,7 @@ public class ViewTabber extends FRoundedPanel { this.populatePnlConsole(); this.vtpTabber = new FVerticalTabPanel(this.panelList); - this.setBackground(AllZone.getSkin().getClrTheme()); + this.setBackground(AllZone.getSkin().getColor("theme")); this.setLayout(new MigLayout("insets 0, gap 0")); this.add(vtpTabber, "w 97%!, h 100%!, gapleft 2%"); @@ -295,7 +295,7 @@ public class ViewTabber extends FRoundedPanel { return new Color[] {new Color(111, 75, 43), Color.white}; } - return new Color[] {new Color(0, 0, 0, 0), skin.getClrText()}; + return new Color[] {new Color(0, 0, 0, 0), skin.getColor("text")}; } /** @@ -313,14 +313,14 @@ public class ViewTabber extends FRoundedPanel { this.pnlCombat.removeAll(); this.vtpTabber.showTab(1); - final Border border = new MatteBorder(0, 0, 0, 0, skin.getClrBorders()); + final Border border = new MatteBorder(0, 0, 0, 0, skin.getColor("borders")); this.vtpTabber.getAllVTabs().get(1).setText("Combat : " + AllZone.getCombat().getAttackers().length); final JTextArea tar = new JTextArea(s); tar.setOpaque(false); tar.setBorder(border); - tar.setForeground(skin.getClrText()); + tar.setForeground(skin.getColor("text")); tar.setFocusable(false); tar.setLineWrap(true); this.pnlCombat.add(tar, "w 95%!, gapleft 3%, gaptop 1%, h 95%"); @@ -343,7 +343,7 @@ public class ViewTabber extends FRoundedPanel { JTextArea tar = new JTextArea(gl.getLogText(3)); tar.setOpaque(false); //tar.setBorder(border); - tar.setForeground(this.skin.getClrText()); + tar.setForeground(this.skin.getColor("text")); tar.setFocusable(false); tar.setEditable(false); @@ -556,7 +556,7 @@ public class ViewTabber extends FRoundedPanel { this.detailLabels.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords }); // Set border on bottom label, and larger font on player name - keywords.setBorder(new MatteBorder(0, 0, 1, 0, this.skin.getClrBorders())); + keywords.setBorder(new MatteBorder(0, 0, 1, 0, this.skin.getColor("borders"))); name.setText(p.getName()); // Add to "players" tab panel @@ -621,8 +621,8 @@ public class ViewTabber extends FRoundedPanel { log.setWrapStyleWord(true); log.setEditable(false); log.setFocusable(false); - log.setForeground(this.skin.getClrText()); - log.setBorder(new MatteBorder(1, 0, 0, 0, this.skin.getClrBorders())); + log.setForeground(this.skin.getColor("text")); + log.setBorder(new MatteBorder(1, 0, 0, 0, this.skin.getColor("borders"))); log.setText("No log information yet. Input codes entered above. " + "Output data recorded below."); @@ -642,7 +642,7 @@ public class ViewTabber extends FRoundedPanel { private static final long serialVersionUID = 7917311680519060700L; private Color defaultBG = Color.green; - private final Color hoverBG = ViewTabber.this.skin.getClrHover(); + private final Color hoverBG = ViewTabber.this.skin.getColor("hover"); private final Color pressedBG = Color.green.darker().darker(); private boolean enabled; private final String enabledText, disabledText; @@ -776,7 +776,7 @@ public class ViewTabber extends FRoundedPanel { private class InfoLabel extends JLabel { public InfoLabel() { super(); - this.setForeground(ViewTabber.this.skin.getClrText()); + this.setForeground(ViewTabber.this.skin.getColor("text")); } } diff --git a/src/main/java/forge/view/match/ViewTopLevel.java b/src/main/java/forge/view/match/ViewTopLevel.java index d2b4bd748e0..351776a95d1 100644 --- a/src/main/java/forge/view/match/ViewTopLevel.java +++ b/src/main/java/forge/view/match/ViewTopLevel.java @@ -105,8 +105,8 @@ public class ViewTopLevel extends FPanel implements CardContainer, Display { // Set properties this.setOpaque(false); - this.setBGTexture(AllZone.getSkin().getTexture1()); - this.setBGImg(AllZone.getSkin().getMatchBG()); + this.setBGTexture(AllZone.getSkin().getImage("bg.texture")); + this.setBGImg(AllZone.getSkin().getImage("bg.match")); this.setLayout(null); b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2); diff --git a/src/main/java/forge/view/toolbox/CardViewer.java b/src/main/java/forge/view/toolbox/CardViewer.java index 53a69606f20..6ef8b34d717 100644 --- a/src/main/java/forge/view/toolbox/CardViewer.java +++ b/src/main/java/forge/view/toolbox/CardViewer.java @@ -47,7 +47,7 @@ public class CardViewer extends JPanel { private final List list; // initialized before; listeners may be added to it - private final JList jList; + private JList jList = null; private final CardDetailPanel detail; private final CardPicturePanel picture; diff --git a/src/main/java/forge/view/toolbox/FButton.java b/src/main/java/forge/view/toolbox/FButton.java index d288e29b66d..39b9f333535 100644 --- a/src/main/java/forge/view/toolbox/FButton.java +++ b/src/main/java/forge/view/toolbox/FButton.java @@ -64,7 +64,7 @@ public class FButton extends JButton { super(msg); this.skin = AllZone.getSkin(); this.setOpaque(false); - this.setForeground(this.skin.getClrText()); + this.setForeground(this.skin.getColor("text")); this.setBackground(Color.red); this.setContentAreaFilled(false); this.setMargin(new Insets(0, 25, 0, 25)); diff --git a/src/main/java/forge/view/toolbox/FRoundedPanel.java b/src/main/java/forge/view/toolbox/FRoundedPanel.java index ca50a124ac3..fd6c43455d7 100644 --- a/src/main/java/forge/view/toolbox/FRoundedPanel.java +++ b/src/main/java/forge/view/toolbox/FRoundedPanel.java @@ -42,7 +42,7 @@ public class FRoundedPanel extends JPanel { private boolean[] borders = { true, true, true, true }; private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE private Color shadowColor = new Color(150, 150, 150, 150); - private Color borderColor = AllZone.getSkin().getClrBorders(); + private Color borderColor = AllZone.getSkin().getColor("borders"); private int shadowOffset = 5; private int cornerRadius = 10; private boolean showShadow = false; diff --git a/src/main/java/forge/view/toolbox/FSkin.java b/src/main/java/forge/view/toolbox/FSkin.java index ee114204dc2..a4ee5c0bf36 100644 --- a/src/main/java/forge/view/toolbox/FSkin.java +++ b/src/main/java/forge/view/toolbox/FSkin.java @@ -40,17 +40,13 @@ import forge.gui.GuiUtils; public class FSkin { private Map icons; + private Map colors; + private Map images; // ===== Public fields /** Primary font used in titles and buttons and most text output. */ private Font font1 = null; - /** Primary texture used in skin. */ - private ImageIcon texture1 = null; - - /** Primary background image used during match play. */ - private ImageIcon matchBG = null; - /** Left side of button, up state. */ private ImageIcon btnLup = null; @@ -78,49 +74,16 @@ public class FSkin { /** Button, right side, down state. */ private ImageIcon btnRdown = null; - /** Splash screen image. */ - private ImageIcon splash = null; - - /** Base color used in skin. */ - private Color clrTheme = Color.red; - - /** Border color. */ - private Color clrBorders = Color.red; - - /** Color of zebra striping in grid displays. */ - private Color clrZebra = Color.red; - - /** Color of elements in mouseover state. */ - private Color clrHover = Color.red; - - /** Color of active (currently selected) elements. */ - private Color clrActive = Color.red; - - /** Color of inactive (not currently selected) elements. */ - private Color clrInactive = Color.red; - - /** Color of text in skin. */ - private Color clrText = Color.red; - - /** Color of background in progress bar if unfilled. */ - private Color clrProgress1 = Color.red; - - /** Color of text in progress bar if filled. */ - private Color clrProgress2 = Color.red; - - /** Color of background in progress bar if unfilled. */ - private Color clrProgress3 = Color.red; - - /** Color of text in progress bar if filled. */ - private Color clrProgress4 = Color.red; - /** Name of skin. */ private final String name = "default"; // ===== Private fields private final String spriteFile = "sprite.png"; private final String font1file = "font1.ttf"; - private final String texture1file = "bg_texture.jpg"; + private final String textureFile = "bg_texture.jpg"; + private final String matchfile = "bg_match.jpg"; + private final String splashfile = "bg_splash.jpg"; + private final String btnLupfile = "btnLup.png"; private final String btnMupfile = "btnMup.png"; private final String btnRupfile = "btnRup.png"; @@ -130,8 +93,6 @@ public class FSkin { private final String btnLdownfile = "btnLdown.png"; private final String btnMdownfile = "btnMdown.png"; private final String btnRdownfile = "btnRdown.png"; - private final String splashfile = "bg_splash.jpg"; - private final String matchfile = "bg_match.jpg"; private ImageIcon tempImg; private Font tempFont; @@ -168,14 +129,19 @@ public class FSkin { */ private void loadFontAndImages(final String skinName) { final String dirName = "res/images/skins/" + skinName + "/"; + icons = new HashMap(); + colors = new HashMap(); + images = new HashMap(); // Fonts this.setFont1(this.retrieveFont(dirName + this.font1file)); // Images - this.setTexture1(this.retrieveImage(dirName + this.texture1file)); - this.setMatchBG(this.retrieveImage(dirName + this.matchfile)); + this.setImage("bg.texture", this.retrieveImage(dirName + this.textureFile)); + this.setImage("bg.match", this.retrieveImage(dirName + this.matchfile)); + this.setImage("bg.splash", this.retrieveImage(dirName + this.splashfile)); + this.setBtnLup(this.retrieveImage(dirName + this.btnLupfile)); this.setBtnMup(this.retrieveImage(dirName + this.btnMupfile)); this.setBtnRup(this.retrieveImage(dirName + this.btnRupfile)); @@ -185,24 +151,23 @@ public class FSkin { this.setBtnLdown(this.retrieveImage(dirName + this.btnLdownfile)); this.setBtnMdown(this.retrieveImage(dirName + this.btnMdownfile)); this.setBtnRdown(this.retrieveImage(dirName + this.btnRdownfile)); - this.setSplashBG(this.retrieveImage(dirName + this.splashfile)); // Sprite final File file = new File(dirName + this.spriteFile); BufferedImage image; try { image = ImageIO.read(file); - this.setClrTheme(this.getColorFromPixel(image.getRGB(70, 10))); - this.setClrBorders(this.getColorFromPixel(image.getRGB(70, 30))); - this.setClrZebra(this.getColorFromPixel(image.getRGB(70, 50))); - this.setClrHover(this.getColorFromPixel(image.getRGB(70, 70))); - this.setClrActive(this.getColorFromPixel(image.getRGB(70, 90))); - this.setClrInactive(this.getColorFromPixel(image.getRGB(70, 110))); - this.setClrText(this.getColorFromPixel(image.getRGB(70, 130))); - this.setClrProgress1(this.getColorFromPixel(image.getRGB(65, 145))); - this.setClrProgress2(this.getColorFromPixel(image.getRGB(75, 145))); - this.setClrProgress3(this.getColorFromPixel(image.getRGB(65, 155))); - this.setClrProgress4(this.getColorFromPixel(image.getRGB(75, 155))); + this.setColor("theme", this.getColorFromPixel(image.getRGB(70, 10))); + this.setColor("borders", this.getColorFromPixel(image.getRGB(70, 30))); + this.setColor("zebra", this.getColorFromPixel(image.getRGB(70, 50))); + this.setColor("hover", this.getColorFromPixel(image.getRGB(70, 70))); + this.setColor("active", this.getColorFromPixel(image.getRGB(70, 90))); + this.setColor("inactive", this.getColorFromPixel(image.getRGB(70, 110))); + this.setColor("text", this.getColorFromPixel(image.getRGB(70, 130))); + this.setColor("progress1", this.getColorFromPixel(image.getRGB(65, 145))); + this.setColor("progress2", this.getColorFromPixel(image.getRGB(75, 145))); + this.setColor("progress3", this.getColorFromPixel(image.getRGB(65, 155))); + this.setColor("progress4", this.getColorFromPixel(image.getRGB(75, 155))); // All icons should eventually be set and retrieved using this method. // Doublestrike 6-12-11 @@ -245,6 +210,7 @@ public class FSkin { */ private ImageIcon retrieveImage(final String address) { this.tempImg = new ImageIcon(address); + if (this.tempImg.getIconWidth() == -1) { System.err.println(this.notfound + address); } @@ -303,272 +269,6 @@ public class FSkin { this.font1 = font10; } - /** - * Splash screen image. - * - * @return {@link javax.swing.ImageIcon} splash - */ - public ImageIcon getSplashBG() { - return this.splash; - } - - /** - * Splash screen image. - * - * @param splash0 - *   an image icon - */ - public void setSplashBG(final ImageIcon splash0) { - this.splash = splash0; - } - - /** - * Base color used in skin. - * - * @return {@link java.awt.Color} clrTheme - */ - public Color getClrTheme() { - return this.clrTheme; - } - - /** - * Base color used in skin. - * - * @param clrTheme0 - *   an image icon - */ - public void setClrTheme(final Color clrTheme0) { - this.clrTheme = clrTheme0; - } - - /** - * Border color. - * - * @return {@link java.awt.Color} clrBorders - */ - public Color getClrBorders() { - return this.clrBorders; - } - - /** - * Border color. - * - * @param clrBorders0 - *   an image icon - */ - public void setClrBorders(final Color clrBorders0) { - this.clrBorders = clrBorders0; - } - - /** - * Primary texture used in skin. - * - * @return {@link javax.swing.ImageIcon} texture1 - */ - public ImageIcon getTexture1() { - return this.texture1; - } - - /** - * Primary texture used in skin. - * - * @param texture10 - *   an image icon - */ - public void setTexture1(final ImageIcon texture10) { - this.texture1 = texture10; - } - - /** - * Primary background image used during match play. - * - * @return ImageIcon - */ - public ImageIcon getMatchBG() { - return this.matchBG; - } - - /** - * Primary background image used during match play. - * - * @param img0 - *   an image icon - */ - public void setMatchBG(final ImageIcon img0) { - this.matchBG = img0; - } - - /** - * Color of zebra striping in grid displays. - * - * @return {@link java.awt.Color} clrZebra - */ - public Color getClrZebra() { - return this.clrZebra; - } - - /** - * Color of zebra striping in grid displays. - * - * @param clr0 - *   Color obj - */ - public void setClrZebra(final Color clr0) { - this.clrZebra = clr0; - } - - /** - * Color of elements in mouseover state. - * - * @return {@link java.awt.Color} clrHover - */ - public Color getClrHover() { - return this.clrHover; - } - - /** - * Color of elements in mouseover state. - * - * @param clr0 - *   Color obj - */ - public void setClrHover(final Color clr0) { - this.clrHover = clr0; - } - - /** - * Color of active (currently selected) elements. - * - * @return {@link java.awt.Color} clrActive - */ - public Color getClrActive() { - return this.clrActive; - } - - /** - * Color of active (currently selected) elements. - * - * @param clr0 - *   Color obj - */ - public void setClrActive(final Color clr0) { - this.clrActive = clr0; - } - - /** - * Color of inactive (not currently selected) elements. - * - * @return {@link java.awt.Color} clrHover - */ - public Color getClrInactive() { - return this.clrInactive; - } - - /** - * Color of inactive (not currently selected) elements. - * - * @param clr0 - *   Color obj - */ - public void setClrInactive(final Color clr0) { - this.clrInactive = clr0; - } - - /** - * Color of text in skin. - * - * @return {@link java.awt.Color} clrText - */ - public Color getClrText() { - return this.clrText; - } - - /** - * Color of text in skin. - * - * @param clr0 - *   Color obj - */ - public void setClrText(final Color clr0) { - this.clrText = clr0; - } - - /** - * Background of progress bar, "unfilled" state. - * - * @return {@link java.awt.Color} clrProgress1 - */ - public Color getClrProgress1() { - return this.clrProgress1; - } - - /** - * Background of progress bar, "unfilled" state. - * - * @param clr0 - *   Color obj - */ - public void setClrProgress1(final Color clr0) { - this.clrProgress1 = clr0; - } - - /** - * Text of progress bar, "unfilled" state. - * - * @return {@link java.awt.Color} clrProgress1 - */ - public Color getClrProgress2() { - return this.clrProgress2; - } - - /** - * Text of progress bar, "unfilled" state. - * - * @param clr0 - *   Color obj - */ - public void setClrProgress2(final Color clr0) { - this.clrProgress2 = clr0; - } - - /** - * Background of progress bar, "filled" state. - * - * @return {@link java.awt.Color} clrProgress1 - */ - public Color getClrProgress3() { - return this.clrProgress3; - } - - /** - * Background of progress bar, "filled" state. - * - * @param clr0 - *   Color obj - */ - public void setClrProgress3(final Color clr0) { - this.clrProgress3 = clr0; - } - - /** - * Text of progress bar, "filled" state. - * - * @return {@link java.awt.Color} clrProgress1 - */ - public Color getClrProgress4() { - return this.clrProgress4; - } - - /** - * Text of progress bar, "filled" state. - * - * @param clr0 - *   Color obj - */ - public void setClrProgress4(final Color clr0) { - this.clrProgress4 = clr0; - } - /** * Left side of button, up state. * @@ -781,10 +481,52 @@ public class FSkin { } /** + * Sets an icon in this skin's icon map. + * * @param s0   String address * @param bi0   BufferedImage */ public void setIcon(String s0, BufferedImage bi0) { icons.put(s0, bi0); } + + /** + * Retrieves a color from this skin's color map. + * + * @param s0   String color address + * @return Color + */ + public Color getColor(String s0) { + return colors.get(s0); + } + + /** + * Sets a color in this skin's color map. + * + * @param s0   String address + * @param c0   Color + */ + public void setColor(String s0, Color c0) { + colors.put(s0, c0); + } + + /** + * Retrieves an image from this skin's image map. + * + * @param s0   String color address + * @return Color + */ + public ImageIcon getImage(String s0) { + return images.get(s0); + } + + /** + * Sets an image in this skin's image map. + * + * @param s0   String address + * @param i0   ImageIcon + */ + public void setImage(String s0, ImageIcon i0) { + images.put(s0, i0); + } } diff --git a/src/main/java/forge/view/toolbox/FVerticalTabPanel.java b/src/main/java/forge/view/toolbox/FVerticalTabPanel.java index e74ac83d33e..3d8178258c5 100644 --- a/src/main/java/forge/view/toolbox/FVerticalTabPanel.java +++ b/src/main/java/forge/view/toolbox/FVerticalTabPanel.java @@ -83,9 +83,9 @@ public class FVerticalTabPanel extends FPanel { this.setOpaque(false); final int size = childPanels.size(); this.skin = AllZone.getSkin(); - this.hoverColor = this.skin.getClrHover(); - this.activeColor = this.skin.getClrActive(); - this.inactiveColor = this.skin.getClrInactive(); + this.hoverColor = this.skin.getColor("hover"); + this.activeColor = this.skin.getColor("active"); + this.inactiveColor = this.skin.getColor("inactive"); final int pctTabH = ((100 - 2 - 2) / size); final int pctTabW = 11; @@ -102,7 +102,7 @@ public class FVerticalTabPanel extends FPanel { // immediately to define grid. if (tabsOnRightSide) { this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!"); - this.pnlContent.setBorder(new MatteBorder(0, 0, 0, 1, this.skin.getClrBorders())); + this.pnlContent.setBorder(new MatteBorder(0, 0, 0, 1, this.skin.getColor("borders"))); } // Add top spacer in any case. @@ -114,7 +114,7 @@ public class FVerticalTabPanel extends FPanel { // must be added after spacer, which then defines the grid. if (!tabsOnRightSide) { this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!"); - this.pnlContent.setBorder(new MatteBorder(0, 1, 0, 0, this.skin.getClrBorders())); + this.pnlContent.setBorder(new MatteBorder(0, 1, 0, 0, this.skin.getColor("borders"))); } // Add all tabs @@ -251,12 +251,12 @@ public class FVerticalTabPanel extends FPanel { if (tabsOnRightSide) { at.rotate(Math.toRadians(90), 0, 0); g2d.setTransform(at); - g2d.setColor(AllZone.getSkin().getClrText()); + g2d.setColor(AllZone.getSkin().getColor("text")); g2d.drawString(this.msg, 5, -4); } else { at.rotate(Math.toRadians(-90), 0, 0); g2d.setTransform(at); - g2d.setColor(AllZone.getSkin().getClrText()); + g2d.setColor(AllZone.getSkin().getColor("text")); // Rotated, so follows: (this.msg, vertical coord, horizontal coord) g2d.drawString(this.msg, 8 - h, w - 6); } diff --git a/src/main/java/forge/view/toolbox/WinLoseFrame.java b/src/main/java/forge/view/toolbox/WinLoseFrame.java index 370e574afb6..823512720b5 100644 --- a/src/main/java/forge/view/toolbox/WinLoseFrame.java +++ b/src/main/java/forge/view/toolbox/WinLoseFrame.java @@ -107,7 +107,7 @@ public class WinLoseFrame extends JFrame { // Place all content in FPanel final FPanel contentPanel = new FPanel(new MigLayout("wrap, fill, insets 20 0 10 10")); - contentPanel.setBGTexture(AllZone.getSkin().getTexture1()); + contentPanel.setBGTexture(AllZone.getSkin().getImage("bg.texture")); contentPanel.setBorder(new WinLoseBorder()); this.getContentPane().add(contentPanel); @@ -227,7 +227,7 @@ public class WinLoseFrame extends JFrame { } this.setUndecorated(true); - this.setBackground(AllZone.getSkin().getClrTheme()); + this.setBackground(AllZone.getSkin().getColor("theme")); this.setBounds(bounds); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); @@ -403,9 +403,9 @@ public class WinLoseFrame extends JFrame { @Override public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { - g.setColor(AllZone.getSkin().getClrText()); + g.setColor(AllZone.getSkin().getColor("text")); g.drawRect(x + 1, y + 1, width - 3, height - 3); - g.setColor(AllZone.getSkin().getClrTheme()); + g.setColor(AllZone.getSkin().getColor("theme")); g.drawRect(x + 3, y + 3, width - 7, height - 7); } }