FSkin updated for better data storage and handling for icons, colors, and images. Now uses maps instead of mutators.

This commit is contained in:
Doublestrike
2011-12-07 07:30:41 +00:00
parent 658a136cce
commit 7710f9075e
18 changed files with 126 additions and 390 deletions

2
.gitattributes vendored
View File

@@ -9881,7 +9881,6 @@ res/images/skins/rebel/btnRover.png -text
res/images/skins/rebel/btnRup.png -text res/images/skins/rebel/btnRup.png -text
res/images/skins/rebel/font1.ttf -text res/images/skins/rebel/font1.ttf -text
res/images/skins/rebel/sprite.png -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_match.jpg -text
res/images/skins/smith/bg_splash.jpg -text res/images/skins/smith/bg_splash.jpg -text
res/images/skins/smith/btnLdown.png -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/btnRup.png -text
res/images/skins/smith/font1.ttf -text res/images/skins/smith/font1.ttf -text
res/images/skins/smith/sprite.png -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/0.png -text svneol=unset#image/png
res/images/symbols-13/1.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 res/images/symbols-13/10.png -text svneol=unset#image/png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 KiB

View File

@@ -86,7 +86,7 @@ public class SplashFrame extends JFrame {
this.setUndecorated(true); this.setUndecorated(true);
// Set preferred JFrame properties. // Set preferred JFrame properties.
final ImageIcon bgIcon = skin.getSplashBG(); final ImageIcon bgIcon = skin.getImage("bg.splash");
final int splashWidthPx = bgIcon.getIconWidth(); final int splashWidthPx = bgIcon.getIconWidth();
final int splashHeightPx = bgIcon.getIconHeight(); final int splashHeightPx = bgIcon.getIconHeight();
@@ -146,16 +146,12 @@ public class SplashFrame extends JFrame {
contentPane.getActionMap().put("escAction", new CloseAction()); contentPane.getActionMap().put("escAction", new CloseAction());
// Set UI to color splash bar fill with skin colors // Set UI to color splash bar filled/unfilled states with skin colors
UIManager.put("ProgressBar.background", skin.getClrProgress1()); // Unfilled UIManager.put("ProgressBar.background", skin.getColor("progress1"));
// state UIManager.put("ProgressBar.selectionBackground", skin.getColor("progress2"));
UIManager.put("ProgressBar.selectionBackground", skin.getClrProgress2()); // Unfilled UIManager.put("ProgressBar.foreground", skin.getColor("progress3"));
// state UIManager.put("ProgressBar.selectionForeground", skin.getColor("progress4"));
UIManager.put("ProgressBar.foreground", skin.getClrProgress3()); // Filled UIManager.put("ProgressBar.border", new LineBorder(skin.getColor("theme"), 0));
// state
UIManager.put("ProgressBar.selectionForeground", skin.getClrProgress4()); // Filled
// state
UIManager.put("ProgressBar.border", new LineBorder(skin.getClrTheme(), 0));
// Instantiate model and view and tie together. // Instantiate model and view and tie together.
this.monitorModel = new SplashProgressModel(); this.monitorModel = new SplashProgressModel();

View File

@@ -47,7 +47,7 @@ public class ViewDetail extends FRoundedPanel {
pnlDetail = new CardDetailPanel(null); pnlDetail = new CardDetailPanel(null);
pnlDetail.setOpaque(false); pnlDetail.setOpaque(false);
this.setBackground(AllZone.getSkin().getClrTheme()); this.setBackground(AllZone.getSkin().getColor("theme"));
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
add(pnlDetail, "w 100%!, h 100%!"); add(pnlDetail, "w 100%!, h 100%!");

View File

@@ -76,7 +76,7 @@ public class ViewDock extends FRoundedPanel {
public ViewDock() { public ViewDock() {
super(); super();
this.setToolTipText("Shortcut Button Dock"); 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")); //this.setLayout(new MigLayout("insets 0, gap 0, ay center, ax center"));
// Mig layout does not support wrapping! // Mig layout does not support wrapping!
@@ -168,7 +168,7 @@ public class ViewDock extends FRoundedPanel {
*/ */
public class DockButton extends JLabel { public class DockButton extends JLabel {
private final Image img; 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 final Color defaultBG = new Color(0, 0, 0, 0);
private Color clrBorders = new Color(0, 0, 0, 0); private Color clrBorders = new Color(0, 0, 0, 0);
private int w, h; private int w, h;
@@ -196,7 +196,7 @@ public class ViewDock extends FRoundedPanel {
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 = ViewDock.this.skin.getClrBorders(); DockButton.this.clrBorders = ViewDock.this.skin.getColor("borders");
DockButton.this.setBackground(DockButton.this.hoverBG); DockButton.this.setBackground(DockButton.this.hoverBG);
} }
@@ -234,8 +234,8 @@ public class ViewDock extends FRoundedPanel {
overlay.showOverlay(); overlay.showOverlay();
final FPanel parent = new FPanel(); final FPanel parent = new FPanel();
parent.setBGImg(this.skin.getTexture1()); parent.setBGImg(this.skin.getImage("bg.texture"));
parent.setBorder(new LineBorder(this.skin.getClrBorders(), 1)); parent.setBorder(new LineBorder(this.skin.getColor("borders"), 1));
parent.setLayout(new MigLayout("insets 0, wrap 2, ax center, ay center")); 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"); 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) { public KeyboardShortcutLabel(final String s0) {
super(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)); this.setFont(ViewDock.this.skin.getFont1().deriveFont(Font.PLAIN, 16));
} }
} }
@@ -408,7 +408,7 @@ public class ViewDock extends FRoundedPanel {
this.addFocusListener(new FocusAdapter() { this.addFocusListener(new FocusAdapter() {
@Override @Override
public void focusGained(final FocusEvent e) { public void focusGained(final FocusEvent e) {
KeyboardShortcutField.this.setBackground(ViewDock.this.skin.getClrActive()); KeyboardShortcutField.this.setBackground(ViewDock.this.skin.getColor("active"));
} }
@Override @Override

View File

@@ -86,11 +86,11 @@ public class ViewField extends FRoundedPanel {
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
this.setCornerRadius(5); this.setCornerRadius(5);
this.setToolTipText(player.getName() + " Gameboard"); this.setToolTipText(player.getName() + " Gameboard");
this.setBackground(AllZone.getSkin().getClrTheme()); this.setBackground(AllZone.getSkin().getColor("theme"));
this.skin = AllZone.getSkin(); this.skin = AllZone.getSkin();
this.inactiveBorder = new LineBorder(new Color(0, 0, 0, 0), 1); 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; this.counter = -1;
String filename = "res/pics/icons/" + (player.isHuman() ? "Mage01.jpg" : "Mage02.jpg"); String filename = "res/pics/icons/" + (player.isHuman() ? "Mage01.jpg" : "Mage02.jpg");
@@ -99,7 +99,7 @@ public class ViewField extends FRoundedPanel {
// Avatar and life // Avatar and life
avatarArea = new JPanel(); avatarArea = new JPanel();
avatarArea.setOpaque(false); avatarArea.setOpaque(false);
avatarArea.setBackground(skin.getClrHover()); avatarArea.setBackground(skin.getColor("hover"));
avatarArea.setLayout(new MigLayout("insets 0, gap 0")); avatarArea.setLayout(new MigLayout("insets 0, gap 0"));
lblAvatar = new JLabel(); lblAvatar = new JLabel();
@@ -108,7 +108,7 @@ public class ViewField extends FRoundedPanel {
lblLife = new JLabel(); lblLife = new JLabel();
lblLife.setHorizontalAlignment(SwingConstants.CENTER); lblLife.setHorizontalAlignment(SwingConstants.CENTER);
lblLife.setForeground(skin.getClrText()); lblLife.setForeground(skin.getColor("text"));
avatarArea.add(lblLife, "w 100%!, h 30%!"); avatarArea.add(lblLife, "w 100%!, h 30%!");
this.add(avatarArea, "w 10%!, h 30%!"); this.add(avatarArea, "w 10%!, h 30%!");
@@ -124,7 +124,7 @@ public class ViewField extends FRoundedPanel {
final JScrollPane scroller = new JScrollPane(); final JScrollPane scroller = new JScrollPane();
this.tabletop = new PlayArea(scroller, player.equals(AllZone.getComputerPlayer()) ? true : false); 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); this.tabletop.setOpaque(false);
scroller.setViewportView(this.tabletop); scroller.setViewportView(this.tabletop);
@@ -327,14 +327,14 @@ public class ViewField extends FRoundedPanel {
this.getLblLife().setForeground(Color.red); this.getLblLife().setForeground(Color.red);
} }
else { else {
this.getLblLife().setForeground(skin.getClrText()); this.getLblLife().setForeground(skin.getColor("text"));
} }
if (p0.getPoisonCounters() >= 8) { if (p0.getPoisonCounters() >= 8) {
this.getLblPoison().setForeground(Color.red); this.getLblPoison().setForeground(Color.red);
} }
else { else {
this.getLblPoison().setForeground(skin.getClrText()); this.getLblPoison().setForeground(skin.getColor("text"));
} }
//mana pool //mana pool
@@ -647,7 +647,7 @@ public class ViewField extends FRoundedPanel {
this.setIcon(skin.getIcon(iconAddress, h - 2 * padding, h - 2 * padding)); this.setIcon(skin.getIcon(iconAddress, h - 2 * padding, h - 2 * padding));
this.setText(txt0); this.setText(txt0);
this.setOpaque(false); this.setOpaque(false);
this.setForeground(ViewField.this.skin.getClrText()); this.setForeground(ViewField.this.skin.getColor("text"));
this.setPreferredSize(this.labelSize); this.setPreferredSize(this.labelSize);
this.setMaximumSize(this.labelSize); this.setMaximumSize(this.labelSize);
this.setMinimumSize(this.labelSize); this.setMinimumSize(this.labelSize);
@@ -660,9 +660,9 @@ public class ViewField extends FRoundedPanel {
ViewField.this.counter++; ViewField.this.counter++;
if (((ViewField.this.counter % 4) == 2) || ((ViewField.this.counter % 4) == 3)) { 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 { } else {
this.defaultBG = ViewField.this.skin.getClrTheme(); this.defaultBG = ViewField.this.skin.getColor("theme");
} }
this.setBackground(this.defaultBG); this.setBackground(this.defaultBG);
@@ -680,7 +680,7 @@ public class ViewField extends FRoundedPanel {
@Override @Override
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
DetailLabel.this.setBackground(DetailLabel.this.hoverBG); DetailLabel.this.setBackground(DetailLabel.this.hoverBG);
DetailLabel.this.clrBorders = ViewField.this.skin.getClrBorders(); DetailLabel.this.clrBorders = ViewField.this.skin.getColor("borders");
} }
@Override @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; this.clrBorders = ViewField.this.transparent;
} }
@@ -730,7 +730,7 @@ public class ViewField extends FRoundedPanel {
private boolean enabled = true; private boolean enabled = true;
private boolean active = false; private boolean active = false;
private boolean hover = 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 * Shows phase labels, handles repainting and on/off states. A

View File

@@ -40,7 +40,7 @@ public class ViewHand extends FRoundedPanel {
public ViewHand() { public ViewHand() {
final JScrollPane scroller = new JScrollPane(); final JScrollPane scroller = new JScrollPane();
ViewHand.this.hand = new HandArea(scroller, null); 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.setViewportView(ViewHand.this.hand);
scroller.setOpaque(false); scroller.setOpaque(false);

View File

@@ -57,8 +57,8 @@ public class ViewInput extends FRoundedPanel {
super(); super();
this.skin = AllZone.getSkin(); this.skin = AllZone.getSkin();
this.setToolTipText("Input Area"); this.setToolTipText("Input Area");
this.setBackground(this.skin.getClrTheme()); this.setBackground(this.skin.getColor("theme"));
this.setForeground(this.skin.getClrText()); this.setForeground(this.skin.getColor("text"));
this.setLayout(new MigLayout("wrap 2, fill, insets 0, gap 0")); this.setLayout(new MigLayout("wrap 2, fill, insets 0, gap 0"));
// Cancel button // Cancel button
@@ -71,7 +71,7 @@ public class ViewInput extends FRoundedPanel {
this.tarMessage.setEditable(false); this.tarMessage.setEditable(false);
this.tarMessage.setLineWrap(true); this.tarMessage.setLineWrap(true);
this.tarMessage.setWrapStyleWord(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.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.tarMessage, "span 2 1, h 80%!, w 96%!, gapleft 2%, gaptop 1%");
this.add(this.btnOK, "w 47%!, gapright 2%, gapleft 1%"); this.add(this.btnOK, "w 47%!, gapright 2%, gapleft 1%");

View File

@@ -41,7 +41,7 @@ public class ViewPicture extends FRoundedPanel {
pnlPicture = new CardPicturePanel(null); pnlPicture = new CardPicturePanel(null);
pnlPicture.setOpaque(false); pnlPicture.setOpaque(false);
this.setBackground(AllZone.getSkin().getClrTheme()); this.setBackground(AllZone.getSkin().getColor("theme"));
this.setLayout(new MigLayout("insets 0, gap 0, center")); this.setLayout(new MigLayout("insets 0, gap 0, center"));
add(pnlPicture, "w 96%!, h 96%!, gapleft 2%, gapright 2%, gaptop 2%"); add(pnlPicture, "w 96%!, h 96%!, gapleft 2%, gapright 2%, gaptop 2%");

View File

@@ -142,7 +142,7 @@ public class ViewTabber extends FRoundedPanel {
this.populatePnlConsole(); this.populatePnlConsole();
this.vtpTabber = new FVerticalTabPanel(this.panelList); 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.setLayout(new MigLayout("insets 0, gap 0"));
this.add(vtpTabber, "w 97%!, h 100%!, gapleft 2%"); 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(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.pnlCombat.removeAll();
this.vtpTabber.showTab(1); 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); this.vtpTabber.getAllVTabs().get(1).setText("Combat : " + AllZone.getCombat().getAttackers().length);
final JTextArea tar = new JTextArea(s); final JTextArea tar = new JTextArea(s);
tar.setOpaque(false); tar.setOpaque(false);
tar.setBorder(border); tar.setBorder(border);
tar.setForeground(skin.getClrText()); tar.setForeground(skin.getColor("text"));
tar.setFocusable(false); tar.setFocusable(false);
tar.setLineWrap(true); tar.setLineWrap(true);
this.pnlCombat.add(tar, "w 95%!, gapleft 3%, gaptop 1%, h 95%"); 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)); JTextArea tar = new JTextArea(gl.getLogText(3));
tar.setOpaque(false); tar.setOpaque(false);
//tar.setBorder(border); //tar.setBorder(border);
tar.setForeground(this.skin.getClrText()); tar.setForeground(this.skin.getColor("text"));
tar.setFocusable(false); tar.setFocusable(false);
tar.setEditable(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 }); this.detailLabels.put(p, new JLabel[] { name, life, hand, draw, prevention, keywords });
// Set border on bottom label, and larger font on player name // 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()); name.setText(p.getName());
// Add to "players" tab panel // Add to "players" tab panel
@@ -621,8 +621,8 @@ public class ViewTabber extends FRoundedPanel {
log.setWrapStyleWord(true); log.setWrapStyleWord(true);
log.setEditable(false); log.setEditable(false);
log.setFocusable(false); log.setFocusable(false);
log.setForeground(this.skin.getClrText()); log.setForeground(this.skin.getColor("text"));
log.setBorder(new MatteBorder(1, 0, 0, 0, this.skin.getClrBorders())); 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."); 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 static final long serialVersionUID = 7917311680519060700L;
private Color defaultBG = Color.green; 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 final Color pressedBG = Color.green.darker().darker();
private boolean enabled; private boolean enabled;
private final String enabledText, disabledText; private final String enabledText, disabledText;
@@ -776,7 +776,7 @@ public class ViewTabber extends FRoundedPanel {
private class InfoLabel extends JLabel { private class InfoLabel extends JLabel {
public InfoLabel() { public InfoLabel() {
super(); super();
this.setForeground(ViewTabber.this.skin.getClrText()); this.setForeground(ViewTabber.this.skin.getColor("text"));
} }
} }

View File

@@ -105,8 +105,8 @@ public class ViewTopLevel extends FPanel implements CardContainer, Display {
// Set properties // Set properties
this.setOpaque(false); this.setOpaque(false);
this.setBGTexture(AllZone.getSkin().getTexture1()); this.setBGTexture(AllZone.getSkin().getImage("bg.texture"));
this.setBGImg(AllZone.getSkin().getMatchBG()); this.setBGImg(AllZone.getSkin().getImage("bg.match"));
this.setLayout(null); this.setLayout(null);
b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2); b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2);

View File

@@ -47,7 +47,7 @@ public class CardViewer extends JPanel {
private final List<CardPrinted> list; private final List<CardPrinted> list;
// initialized before; listeners may be added to it // initialized before; listeners may be added to it
private final JList jList; private JList jList = null;
private final CardDetailPanel detail; private final CardDetailPanel detail;
private final CardPicturePanel picture; private final CardPicturePanel picture;

View File

@@ -64,7 +64,7 @@ public class FButton extends JButton {
super(msg); super(msg);
this.skin = AllZone.getSkin(); this.skin = AllZone.getSkin();
this.setOpaque(false); this.setOpaque(false);
this.setForeground(this.skin.getClrText()); this.setForeground(this.skin.getColor("text"));
this.setBackground(Color.red); this.setBackground(Color.red);
this.setContentAreaFilled(false); this.setContentAreaFilled(false);
this.setMargin(new Insets(0, 25, 0, 25)); this.setMargin(new Insets(0, 25, 0, 25));

View File

@@ -42,7 +42,7 @@ public class FRoundedPanel extends JPanel {
private boolean[] borders = { true, true, true, true }; private boolean[] borders = { true, true, true, true };
private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE
private Color shadowColor = new Color(150, 150, 150, 150); 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 shadowOffset = 5;
private int cornerRadius = 10; private int cornerRadius = 10;
private boolean showShadow = false; private boolean showShadow = false;

View File

@@ -40,17 +40,13 @@ import forge.gui.GuiUtils;
public class FSkin { public class FSkin {
private Map<String, BufferedImage> icons; private Map<String, BufferedImage> icons;
private Map<String, Color> colors;
private Map<String, ImageIcon> images;
// ===== Public fields // ===== Public fields
/** Primary font used in titles and buttons and most text output. */ /** Primary font used in titles and buttons and most text output. */
private Font font1 = null; 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. */ /** Left side of button, up state. */
private ImageIcon btnLup = null; private ImageIcon btnLup = null;
@@ -78,49 +74,16 @@ public class FSkin {
/** Button, right side, down state. */ /** Button, right side, down state. */
private ImageIcon btnRdown = null; 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. */ /** Name of skin. */
private final String name = "default"; private final String name = "default";
// ===== Private fields // ===== Private fields
private final String spriteFile = "sprite.png"; private final String spriteFile = "sprite.png";
private final String font1file = "font1.ttf"; 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 btnLupfile = "btnLup.png";
private final String btnMupfile = "btnMup.png"; private final String btnMupfile = "btnMup.png";
private final String btnRupfile = "btnRup.png"; private final String btnRupfile = "btnRup.png";
@@ -130,8 +93,6 @@ public class FSkin {
private final String btnLdownfile = "btnLdown.png"; private final String btnLdownfile = "btnLdown.png";
private final String btnMdownfile = "btnMdown.png"; private final String btnMdownfile = "btnMdown.png";
private final String btnRdownfile = "btnRdown.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 ImageIcon tempImg;
private Font tempFont; private Font tempFont;
@@ -168,14 +129,19 @@ public class FSkin {
*/ */
private void loadFontAndImages(final String skinName) { private void loadFontAndImages(final String skinName) {
final String dirName = "res/images/skins/" + skinName + "/"; final String dirName = "res/images/skins/" + skinName + "/";
icons = new HashMap<String, BufferedImage>(); icons = new HashMap<String, BufferedImage>();
colors = new HashMap<String, Color>();
images = new HashMap<String, ImageIcon>();
// Fonts // Fonts
this.setFont1(this.retrieveFont(dirName + this.font1file)); this.setFont1(this.retrieveFont(dirName + this.font1file));
// Images // Images
this.setTexture1(this.retrieveImage(dirName + this.texture1file)); this.setImage("bg.texture", this.retrieveImage(dirName + this.textureFile));
this.setMatchBG(this.retrieveImage(dirName + this.matchfile)); 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.setBtnLup(this.retrieveImage(dirName + this.btnLupfile));
this.setBtnMup(this.retrieveImage(dirName + this.btnMupfile)); this.setBtnMup(this.retrieveImage(dirName + this.btnMupfile));
this.setBtnRup(this.retrieveImage(dirName + this.btnRupfile)); this.setBtnRup(this.retrieveImage(dirName + this.btnRupfile));
@@ -185,24 +151,23 @@ public class FSkin {
this.setBtnLdown(this.retrieveImage(dirName + this.btnLdownfile)); this.setBtnLdown(this.retrieveImage(dirName + this.btnLdownfile));
this.setBtnMdown(this.retrieveImage(dirName + this.btnMdownfile)); this.setBtnMdown(this.retrieveImage(dirName + this.btnMdownfile));
this.setBtnRdown(this.retrieveImage(dirName + this.btnRdownfile)); this.setBtnRdown(this.retrieveImage(dirName + this.btnRdownfile));
this.setSplashBG(this.retrieveImage(dirName + this.splashfile));
// Sprite // Sprite
final File file = new File(dirName + this.spriteFile); final File file = new File(dirName + this.spriteFile);
BufferedImage image; BufferedImage image;
try { try {
image = ImageIO.read(file); image = ImageIO.read(file);
this.setClrTheme(this.getColorFromPixel(image.getRGB(70, 10))); this.setColor("theme", this.getColorFromPixel(image.getRGB(70, 10)));
this.setClrBorders(this.getColorFromPixel(image.getRGB(70, 30))); this.setColor("borders", this.getColorFromPixel(image.getRGB(70, 30)));
this.setClrZebra(this.getColorFromPixel(image.getRGB(70, 50))); this.setColor("zebra", this.getColorFromPixel(image.getRGB(70, 50)));
this.setClrHover(this.getColorFromPixel(image.getRGB(70, 70))); this.setColor("hover", this.getColorFromPixel(image.getRGB(70, 70)));
this.setClrActive(this.getColorFromPixel(image.getRGB(70, 90))); this.setColor("active", this.getColorFromPixel(image.getRGB(70, 90)));
this.setClrInactive(this.getColorFromPixel(image.getRGB(70, 110))); this.setColor("inactive", this.getColorFromPixel(image.getRGB(70, 110)));
this.setClrText(this.getColorFromPixel(image.getRGB(70, 130))); this.setColor("text", this.getColorFromPixel(image.getRGB(70, 130)));
this.setClrProgress1(this.getColorFromPixel(image.getRGB(65, 145))); this.setColor("progress1", this.getColorFromPixel(image.getRGB(65, 145)));
this.setClrProgress2(this.getColorFromPixel(image.getRGB(75, 145))); this.setColor("progress2", this.getColorFromPixel(image.getRGB(75, 145)));
this.setClrProgress3(this.getColorFromPixel(image.getRGB(65, 155))); this.setColor("progress3", this.getColorFromPixel(image.getRGB(65, 155)));
this.setClrProgress4(this.getColorFromPixel(image.getRGB(75, 155))); this.setColor("progress4", this.getColorFromPixel(image.getRGB(75, 155)));
// All icons should eventually be set and retrieved using this method. // All icons should eventually be set and retrieved using this method.
// Doublestrike 6-12-11 // Doublestrike 6-12-11
@@ -245,6 +210,7 @@ public class FSkin {
*/ */
private ImageIcon retrieveImage(final String address) { private ImageIcon retrieveImage(final String address) {
this.tempImg = new ImageIcon(address); this.tempImg = new ImageIcon(address);
if (this.tempImg.getIconWidth() == -1) { if (this.tempImg.getIconWidth() == -1) {
System.err.println(this.notfound + address); System.err.println(this.notfound + address);
} }
@@ -303,272 +269,6 @@ public class FSkin {
this.font1 = font10; this.font1 = font10;
} }
/**
* Splash screen image.
*
* @return {@link javax.swing.ImageIcon} splash
*/
public ImageIcon getSplashBG() {
return this.splash;
}
/**
* Splash screen image.
*
* @param splash0
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; 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
* &emsp; Color obj
*/
public void setClrProgress4(final Color clr0) {
this.clrProgress4 = clr0;
}
/** /**
* Left side of button, up state. * Left side of button, up state.
* *
@@ -781,10 +481,52 @@ public class FSkin {
} }
/** /**
* Sets an icon in this skin's icon map.
*
* @param s0 &emsp; String address * @param s0 &emsp; String address
* @param bi0 &emsp; BufferedImage * @param bi0 &emsp; BufferedImage
*/ */
public void setIcon(String s0, BufferedImage bi0) { public void setIcon(String s0, BufferedImage bi0) {
icons.put(s0, bi0); icons.put(s0, bi0);
} }
/**
* Retrieves a color from this skin's color map.
*
* @param s0 &emsp; 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 &emsp; String address
* @param c0 &emsp; Color
*/
public void setColor(String s0, Color c0) {
colors.put(s0, c0);
}
/**
* Retrieves an image from this skin's image map.
*
* @param s0 &emsp; 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 &emsp; String address
* @param i0 &emsp; ImageIcon
*/
public void setImage(String s0, ImageIcon i0) {
images.put(s0, i0);
}
} }

View File

@@ -83,9 +83,9 @@ public class FVerticalTabPanel extends FPanel {
this.setOpaque(false); this.setOpaque(false);
final int size = childPanels.size(); final int size = childPanels.size();
this.skin = AllZone.getSkin(); this.skin = AllZone.getSkin();
this.hoverColor = this.skin.getClrHover(); this.hoverColor = this.skin.getColor("hover");
this.activeColor = this.skin.getClrActive(); this.activeColor = this.skin.getColor("active");
this.inactiveColor = this.skin.getClrInactive(); this.inactiveColor = this.skin.getColor("inactive");
final int pctTabH = ((100 - 2 - 2) / size); final int pctTabH = ((100 - 2 - 2) / size);
final int pctTabW = 11; final int pctTabW = 11;
@@ -102,7 +102,7 @@ public class FVerticalTabPanel extends FPanel {
// immediately to define grid. // immediately to define grid.
if (tabsOnRightSide) { if (tabsOnRightSide) {
this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!"); 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. // 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. // must be added after spacer, which then defines the grid.
if (!tabsOnRightSide) { if (!tabsOnRightSide) {
this.add(this.pnlContent, "span 1 " + (size + 2) + ", w " + (100 - pctTabW) + "%!, h 100%!"); 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 // Add all tabs
@@ -251,12 +251,12 @@ public class FVerticalTabPanel extends FPanel {
if (tabsOnRightSide) { if (tabsOnRightSide) {
at.rotate(Math.toRadians(90), 0, 0); at.rotate(Math.toRadians(90), 0, 0);
g2d.setTransform(at); g2d.setTransform(at);
g2d.setColor(AllZone.getSkin().getClrText()); g2d.setColor(AllZone.getSkin().getColor("text"));
g2d.drawString(this.msg, 5, -4); g2d.drawString(this.msg, 5, -4);
} else { } else {
at.rotate(Math.toRadians(-90), 0, 0); at.rotate(Math.toRadians(-90), 0, 0);
g2d.setTransform(at); g2d.setTransform(at);
g2d.setColor(AllZone.getSkin().getClrText()); g2d.setColor(AllZone.getSkin().getColor("text"));
// Rotated, so follows: (this.msg, vertical coord, horizontal coord) // Rotated, so follows: (this.msg, vertical coord, horizontal coord)
g2d.drawString(this.msg, 8 - h, w - 6); g2d.drawString(this.msg, 8 - h, w - 6);
} }

View File

@@ -107,7 +107,7 @@ public class WinLoseFrame extends JFrame {
// Place all content in FPanel // Place all content in FPanel
final FPanel contentPanel = new FPanel(new MigLayout("wrap, fill, insets 20 0 10 10")); 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()); contentPanel.setBorder(new WinLoseBorder());
this.getContentPane().add(contentPanel); this.getContentPane().add(contentPanel);
@@ -227,7 +227,7 @@ public class WinLoseFrame extends JFrame {
} }
this.setUndecorated(true); this.setUndecorated(true);
this.setBackground(AllZone.getSkin().getClrTheme()); this.setBackground(AllZone.getSkin().getColor("theme"));
this.setBounds(bounds); this.setBounds(bounds);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true); this.setVisible(true);
@@ -403,9 +403,9 @@ public class WinLoseFrame extends JFrame {
@Override @Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width,
final int height) { 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.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); g.drawRect(x + 3, y + 3, width - 7, height - 7);
} }
} }