mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Performance enhancement: fonts used in UI are now pre-derived once in skin.
This commit is contained in:
@@ -19,7 +19,6 @@ package forge.quest.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -476,7 +475,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
|
||||
this.lblTemp2 = new JLabel(sb.toString());
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
this.lblTemp2.setFont(skin.getFont(14));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setIcon(this.icoTemp);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
@@ -578,7 +577,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
+ "\"");
|
||||
|
||||
this.lblTemp2 = new JLabel(sb.toString());
|
||||
this.lblTemp2.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
this.lblTemp2.setFont(skin.getFont(14));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
@@ -600,7 +599,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
||||
|
||||
this.lblTemp2 = new JLabel("You lose! You have lost 15 credits.");
|
||||
this.lblTemp2.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
this.lblTemp2.setFont(skin.getFont(14));
|
||||
this.lblTemp2.setForeground(Color.white);
|
||||
this.lblTemp2.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.lblTemp2.setIconTextGap(50);
|
||||
@@ -689,7 +688,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
||||
private class TitleLabel extends JLabel {
|
||||
TitleLabel(final String msg) {
|
||||
super(msg);
|
||||
this.setFont(skin.getFont1().deriveFont(Font.ITALIC, 16));
|
||||
this.setFont(skin.getFont(16));
|
||||
this.setPreferredSize(new Dimension(200, 40));
|
||||
this.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
this.setForeground(Color.white);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
@@ -58,7 +57,7 @@ public class SubButton extends JButton {
|
||||
int px = (int) (SubButton.this.getHeight() / 2);
|
||||
px = (px < 10 ? 10 : px);
|
||||
px = (px > 15 ? 15 : px);
|
||||
SubButton.this.setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, px));
|
||||
SubButton.this.setFont(AllZone.getSkin().getFont(px));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
import javax.swing.DefaultListSelectionModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
@@ -92,25 +91,25 @@ public class ViewConstructed extends JPanel {
|
||||
lstDecksHuman.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
JLabel lblHuman = new JLabel("Choose your deck:");
|
||||
lblHuman.setFont(skin.getFont1().deriveFont(Font.BOLD, 16));
|
||||
lblHuman.setFont(skin.getBoldFont(16));
|
||||
lblHuman.setForeground(skin.getColor("text"));
|
||||
lblHuman.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JLabel lblColorInfo = new JLabel(colorsToolTip);
|
||||
lblColorInfo.setToolTipText(colorsToolTip);
|
||||
lblColorInfo.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
lblColorInfo.setFont(skin.getItalicFont(12));
|
||||
lblColorInfo.setForeground(skin.getColor("text"));
|
||||
lblColorInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JLabel lblThemeInfo = new JLabel(themeToolTip);
|
||||
lblThemeInfo.setToolTipText(themeToolTip);
|
||||
lblThemeInfo.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
lblThemeInfo.setFont(skin.getItalicFont(12));
|
||||
lblThemeInfo.setForeground(skin.getColor("text"));
|
||||
lblThemeInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JLabel lblDecklistInfo = new JLabel(decklistToolTip);
|
||||
lblDecklistInfo.setToolTipText(decklistToolTip);
|
||||
lblDecklistInfo.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
lblDecklistInfo.setFont(skin.getItalicFont(12));
|
||||
lblDecklistInfo.setForeground(skin.getColor("text"));
|
||||
lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
@@ -165,25 +164,25 @@ public class ViewConstructed extends JPanel {
|
||||
lstDecksAI.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
JLabel lblAI = new JLabel("Choose a deck for the computer:");
|
||||
lblAI.setFont(skin.getFont1().deriveFont(Font.BOLD, 16));
|
||||
lblAI.setFont(skin.getBoldFont(16));
|
||||
lblAI.setForeground(skin.getColor("text"));
|
||||
lblAI.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JLabel lblColorInfo = new JLabel(colorsToolTip);
|
||||
lblColorInfo.setToolTipText(colorsToolTip);
|
||||
lblColorInfo.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
lblColorInfo.setFont(skin.getItalicFont(12));
|
||||
lblColorInfo.setForeground(skin.getColor("text"));
|
||||
lblColorInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JLabel lblThemeInfo = new JLabel(themeToolTip);
|
||||
lblThemeInfo.setToolTipText(themeToolTip);
|
||||
lblThemeInfo.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
lblThemeInfo.setFont(skin.getItalicFont(12));
|
||||
lblThemeInfo.setForeground(skin.getColor("text"));
|
||||
lblThemeInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JLabel lblDecklistInfo = new JLabel(decklistToolTip);
|
||||
lblDecklistInfo.setToolTipText(decklistToolTip);
|
||||
lblDecklistInfo.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
lblDecklistInfo.setFont(skin.getItalicFont(12));
|
||||
lblDecklistInfo.setForeground(skin.getColor("text"));
|
||||
lblDecklistInfo.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
@@ -94,13 +93,13 @@ public class ViewDraft extends JPanel {
|
||||
skin = AllZone.getSkin();
|
||||
|
||||
JLabel lblHuman = new JLabel("Select your deck: ");
|
||||
lblHuman.setFont(skin.getFont1().deriveFont(Font.BOLD, 16));
|
||||
lblHuman.setFont(skin.getBoldFont(16));
|
||||
lblHuman.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblHuman.setForeground(skin.getColor("text"));
|
||||
this.add(lblHuman, "w 60%!, gap 5% 5% 2% 2%");
|
||||
|
||||
JLabel lblAI = new JLabel("Who will you play?");
|
||||
lblAI.setFont(skin.getFont1().deriveFont(Font.BOLD, 16));
|
||||
lblAI.setFont(skin.getBoldFont(16));
|
||||
lblAI.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblAI.setForeground(skin.getColor("text"));
|
||||
this.add(lblAI, "w 25%!, gap 0 0 2% 2%, wrap");
|
||||
@@ -150,7 +149,7 @@ public class ViewDraft extends JPanel {
|
||||
tpnDirections = new JTextPane();
|
||||
tpnDirections.setOpaque(false);
|
||||
tpnDirections.setForeground(skin.getColor("text"));
|
||||
tpnDirections.setFont(skin.getFont1().deriveFont(Font.PLAIN, 15));
|
||||
tpnDirections.setFont(skin.getFont(15));
|
||||
tpnDirections.setAlignmentX(SwingConstants.CENTER);
|
||||
tpnDirections.setFocusable(false);
|
||||
tpnDirections.setEditable(false);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -85,7 +84,7 @@ public class ViewQuest extends JScrollPane {
|
||||
lblTitle.setBorder(new MatteBorder(0, 0, 1, 0, skin.getColor("borders")));
|
||||
lblTitle.setForeground(skin.getColor("text"));
|
||||
lblTitle.setBackground(skin.getColor("theme").darker());
|
||||
lblTitle.setFont(skin.getFont1().deriveFont(Font.BOLD, 20));
|
||||
lblTitle.setFont(skin.getBoldFont(20));
|
||||
viewport.add(lblTitle, "w 90%!, h 50px!, gap 5% 0 2% 0, span 2");
|
||||
|
||||
File f = new File("res/quest/questData.dat");
|
||||
@@ -99,7 +98,7 @@ public class ViewQuest extends JScrollPane {
|
||||
JLabel lblStats = new JLabel("Wins: " + questData.getWin()
|
||||
+ " / Losses: " + questData.getLost());
|
||||
lblStats.setForeground(skin.getColor("text"));
|
||||
lblStats.setFont(skin.getFont1().deriveFont(Font.BOLD, 17));
|
||||
lblStats.setFont(skin.getBoldFont(18));
|
||||
lblStats.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
viewport.add(lblStats, "h 35px!, ax center, span 2");
|
||||
|
||||
@@ -163,19 +162,19 @@ public class ViewQuest extends JScrollPane {
|
||||
+ nextChallengeInWins() + " wins.)");
|
||||
lblTeaser.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblTeaser.setForeground(skin.getColor("text"));
|
||||
lblTeaser.setFont(skin.getFont1().deriveFont(Font.BOLD, 16));
|
||||
lblTeaser.setFont(skin.getBoldFont(16));
|
||||
challengesContainer.add(lblTeaser, "w 100%!, ax center, ay top");
|
||||
}
|
||||
|
||||
JLabel lblDuels = new JLabel("Available Duels");
|
||||
lblDuels.setForeground(skin.getColor("text"));
|
||||
lblDuels.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblDuels.setFont(skin.getFont1().deriveFont(Font.ITALIC, 14));
|
||||
lblDuels.setFont(skin.getItalicFont(14));
|
||||
|
||||
JLabel lblChallenges = new JLabel("Available Challenges");
|
||||
lblChallenges.setForeground(skin.getColor("text"));
|
||||
lblChallenges.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblChallenges.setFont(skin.getFont1().deriveFont(Font.ITALIC, 14));
|
||||
lblChallenges.setFont(skin.getItalicFont(14));
|
||||
|
||||
viewport.add(lblDuels, "w 48%, gap 1% 1% 2% 1%");
|
||||
viewport.add(lblChallenges, "w 48%, gap 0 0 2% 1%, wrap");
|
||||
@@ -199,14 +198,14 @@ public class ViewQuest extends JScrollPane {
|
||||
lblCredits.setForeground(skin.getColor("text"));
|
||||
lblCredits.setIconTextGap(5);
|
||||
lblCredits.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblCredits.setFont(skin.getFont1().deriveFont(Font.BOLD, 14));
|
||||
lblCredits.setFont(skin.getBoldFont(14));
|
||||
|
||||
lblLife = new JLabel("Life: " + Long.toString(questData.getLife()));
|
||||
lblLife.setIcon(GuiUtils.getResizedIcon(new ImageIcon("res/images/icons/Life.png"), 26, 26));
|
||||
lblLife.setForeground(skin.getColor("text"));
|
||||
lblLife.setIconTextGap(5);
|
||||
lblLife.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblLife.setFont(skin.getFont1().deriveFont(Font.BOLD, 14));
|
||||
lblLife.setFont(skin.getBoldFont(14));
|
||||
|
||||
SubButton btnEditor = new SubButton("");
|
||||
btnEditor.setAction(new AbstractAction() {
|
||||
@@ -260,12 +259,12 @@ public class ViewQuest extends JScrollPane {
|
||||
pnlButtonContainer.setLayout(new MigLayout("insets 0, gap 0, wrap 2, ax center, hidemode 3"));
|
||||
|
||||
cbxPet = new JComboBox();
|
||||
cbxPet.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
cbxPet.setFont(skin.getFont(14));
|
||||
|
||||
cbPlant = new OptionsCheckBox("Summon Plant");
|
||||
cbPlant.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
cbPlant.setFont(skin.getFont(14));
|
||||
cbZep = new OptionsCheckBox("Launch Zeppelin");
|
||||
cbZep.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
cbZep.setFont(skin.getFont(14));
|
||||
|
||||
lblPet = new JLabel(GuiUtils.getResizedIcon(
|
||||
new ImageIcon("res/images/icons/PetIcon.png"), 30, 30));
|
||||
@@ -342,14 +341,14 @@ public class ViewQuest extends JScrollPane {
|
||||
lblNew.setBackground(skin.getColor("theme").darker());
|
||||
lblNew.setOpaque(true);
|
||||
lblNew.setBorder(new MatteBorder(1, 0, 1, 0, skin.getColor("borders")));
|
||||
lblNew.setFont(skin.getFont1().deriveFont(Font.BOLD, 16));
|
||||
lblNew.setFont(skin.getBoldFont(16));
|
||||
viewport.add(lblNew, "w 90%!, h 50px!, gap 5% 5% 2%, span 2");
|
||||
|
||||
JLabel lblNotes = new JLabel("<html>"
|
||||
+ "Start a new Quest will delete your current player decks, credits and win loss record."
|
||||
+ "<br>Fantasy adds a Bazaar and the occasional fantasy themed opponent for you to battle."
|
||||
+ "</html>");
|
||||
lblNotes.setFont(skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
lblNotes.setFont(skin.getFont(14));
|
||||
lblNotes.setForeground(skin.getColor("text"));
|
||||
viewport.add(lblNotes, "w 90%, gapleft 5%, span 2");
|
||||
}
|
||||
@@ -477,14 +476,14 @@ public class ViewQuest extends JScrollPane {
|
||||
|
||||
// Name
|
||||
JLabel lblName = new JLabel(event.getTitle() + ": " + event.getDifficulty());
|
||||
lblName.setFont(skin.getFont1().deriveFont(Font.BOLD, 17));
|
||||
lblName.setFont(skin.getBoldFont(18));
|
||||
lblName.setForeground(skin.getColor("text"));
|
||||
this.add(lblName, "h 20px!, gap 1% 1% 5px 5px, wrap");
|
||||
|
||||
// Description
|
||||
final JTextArea tarDesc = new JTextArea();
|
||||
tarDesc.setText(event.getDescription());
|
||||
tarDesc.setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
tarDesc.setFont(skin.getItalicFont(12));
|
||||
tarDesc.setForeground(skin.getColor("text"));
|
||||
tarDesc.setOpaque(false);
|
||||
tarDesc.setWrapStyleWord(true);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.Font;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
@@ -41,7 +40,7 @@ public class ViewSealed extends JPanel {
|
||||
|
||||
// Title
|
||||
JLabel lblTitle = new JLabel("Select a deck for yourself, or build a new one: ");
|
||||
lblTitle.setFont(skin.getFont1().deriveFont(Font.BOLD, 15));
|
||||
lblTitle.setFont(skin.getBoldFont(14));
|
||||
lblTitle.setForeground(skin.getColor("text"));
|
||||
lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@@ -73,7 +72,7 @@ public class ViewSettings extends JScrollPane {
|
||||
|
||||
// Deck Building Options
|
||||
JLabel lblTitleDecks = new JLabel("Deck Building Options");
|
||||
lblTitleDecks.setFont(skin.getFont1().deriveFont(Font.PLAIN, 16));
|
||||
lblTitleDecks.setFont(skin.getFont(16));
|
||||
lblTitleDecks.setBorder(new MatteBorder(0, 0, 1, 0, skin.getColor("borders")));
|
||||
lblTitleDecks.setForeground(skin.getColor("text"));
|
||||
viewport.add(lblTitleDecks, constraints2 + ", gaptop 2%");
|
||||
@@ -98,7 +97,7 @@ public class ViewSettings extends JScrollPane {
|
||||
|
||||
// Gameplay Options
|
||||
JLabel lblTitleUI = new JLabel("Gameplay Options");
|
||||
lblTitleUI.setFont(skin.getFont1().deriveFont(Font.PLAIN, 16));
|
||||
lblTitleUI.setFont(skin.getFont(16));
|
||||
lblTitleUI.setBorder(new MatteBorder(1, 0, 1, 0, skin.getColor("borders")));
|
||||
lblTitleUI.setForeground(skin.getColor("text"));
|
||||
viewport.add(lblTitleUI, constraints2);
|
||||
@@ -146,7 +145,7 @@ public class ViewSettings extends JScrollPane {
|
||||
|
||||
// Graphic Options
|
||||
JLabel lblTitleGraphics = new JLabel("Graphic Options");
|
||||
lblTitleGraphics.setFont(skin.getFont1().deriveFont(Font.PLAIN, 16));
|
||||
lblTitleGraphics.setFont(skin.getFont(16));
|
||||
lblTitleGraphics.setBorder(new MatteBorder(1, 0, 1, 0, skin.getColor("borders")));
|
||||
lblTitleGraphics.setForeground(skin.getColor("text"));
|
||||
viewport.add(lblTitleGraphics, constraints2);
|
||||
@@ -288,7 +287,7 @@ public class ViewSettings extends JScrollPane {
|
||||
public OptionsCheckBox(String txt0) {
|
||||
super();
|
||||
setText(txt0);
|
||||
setFont(skin.getFont1().deriveFont(Font.BOLD, 12));
|
||||
setFont(skin.getBoldFont(12));
|
||||
setForeground(skin.getColor("text"));
|
||||
setBackground(skin.getColor("hover"));
|
||||
setOpaque(false);
|
||||
@@ -312,7 +311,7 @@ public class ViewSettings extends JScrollPane {
|
||||
public OptionsRadio(String txt0) {
|
||||
super();
|
||||
setText(txt0);
|
||||
setFont(skin.getFont1().deriveFont(Font.BOLD, 12));
|
||||
setFont(skin.getBoldFont(12));
|
||||
setForeground(skin.getColor("text"));
|
||||
setBackground(skin.getColor("hover"));
|
||||
setOpaque(false);
|
||||
@@ -392,7 +391,7 @@ public class ViewSettings extends JScrollPane {
|
||||
private class NoteLabel extends JLabel {
|
||||
public NoteLabel(String txt0) {
|
||||
super(txt0);
|
||||
setFont(skin.getFont1().deriveFont(Font.ITALIC, 12));
|
||||
setFont(skin.getItalicFont(12));
|
||||
setForeground(skin.getColor("text"));
|
||||
}
|
||||
}
|
||||
@@ -401,7 +400,7 @@ public class ViewSettings extends JScrollPane {
|
||||
private class TitleLabel extends JLabel {
|
||||
public TitleLabel(String txt0) {
|
||||
super(txt0);
|
||||
setFont(skin.getFont1().deriveFont(Font.BOLD, 12));
|
||||
setFont(skin.getBoldFont(12));
|
||||
setForeground(skin.getColor("text"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forge.view.home;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.SwingConstants;
|
||||
@@ -78,7 +76,7 @@ public class ViewUtilities extends JPanel {
|
||||
tpnLicensing = new JTextPane();
|
||||
tpnLicensing.setOpaque(false);
|
||||
tpnLicensing.setForeground(skin.getColor("text"));
|
||||
tpnLicensing.setFont(skin.getFont1().deriveFont(Font.PLAIN, 15));
|
||||
tpnLicensing.setFont(skin.getFont(15));
|
||||
tpnLicensing.setAlignmentX(SwingConstants.CENTER);
|
||||
tpnLicensing.setFocusable(false);
|
||||
tpnLicensing.setEditable(false);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ViewDetail extends FRoundedPanel {
|
||||
public void componentResized(ComponentEvent e) {
|
||||
int px = (int) (ViewDetail.this.getWidth() / 15);
|
||||
px = (px < 11 ? 11 : px);
|
||||
Font font = skin.getFont1().deriveFont(Font.PLAIN, px);
|
||||
Font font = skin.getFont(px);
|
||||
|
||||
pnlDetail.getNameCostLabel().setFont(font);
|
||||
pnlDetail.getTypeLabel().setFont(font);
|
||||
@@ -68,7 +68,7 @@ public class ViewDetail extends FRoundedPanel {
|
||||
pnlDetail.getSetInfoLabel().setFont(font);
|
||||
pnlDetail.getCDArea().setFont(font);
|
||||
|
||||
setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, px));
|
||||
setFont(AllZone.getSkin().getFont(px));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package forge.view.match;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -359,7 +358,7 @@ public class ViewDock extends FRoundedPanel {
|
||||
super(s0);
|
||||
|
||||
this.setForeground(ViewDock.this.skin.getColor("text"));
|
||||
this.setFont(ViewDock.this.skin.getFont1().deriveFont(Font.PLAIN, 16));
|
||||
this.setFont(ViewDock.this.skin.getFont(16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +394,7 @@ public class ViewDock extends FRoundedPanel {
|
||||
public KeyboardShortcutField() {
|
||||
super();
|
||||
this.setEditable(false);
|
||||
this.setFont(ViewDock.this.skin.getFont1().deriveFont(Font.PLAIN, 14));
|
||||
this.setFont(ViewDock.this.skin.getFont(14));
|
||||
|
||||
this.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ package forge.view.match;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
@@ -175,7 +174,7 @@ public class ViewField extends FRoundedPanel {
|
||||
public void componentResized(ComponentEvent e) {
|
||||
int side = (int) (avatarArea.getHeight() * 0.7);
|
||||
int size = (int) (avatarArea.getHeight() * 0.24);
|
||||
lblLife.setFont(ViewField.this.skin.getFont1().deriveFont(Font.BOLD, (size)));
|
||||
lblLife.setFont(ViewField.this.skin.getBoldFont(size));
|
||||
lblAvatar.setIcon(new ImageIcon(img.getScaledInstance(side, side, java.awt.Image.SCALE_SMOOTH)));
|
||||
}
|
||||
});
|
||||
@@ -686,7 +685,7 @@ public class ViewField extends FRoundedPanel {
|
||||
this.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
setFont(ViewField.this.skin.getFont1().deriveFont(Font.PLAIN, (getHeight() / 2)));
|
||||
setFont(ViewField.this.skin.getFont((int) (getHeight() / 2)));
|
||||
setIcon(skin.getIcon(iconAddress, h - 2 * padding, h - 2 * padding));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package forge.view.match;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
@@ -72,7 +71,7 @@ public class ViewInput extends FRoundedPanel {
|
||||
this.tarMessage.setLineWrap(true);
|
||||
this.tarMessage.setWrapStyleWord(true);
|
||||
this.tarMessage.setForeground(this.skin.getColor("text"));
|
||||
this.tarMessage.setFont(this.skin.getFont1().deriveFont(Font.PLAIN, 16));
|
||||
this.tarMessage.setFont(this.skin.getFont(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%");
|
||||
this.add(this.btnCancel, "w 47%!, gapright 1%");
|
||||
@@ -83,7 +82,7 @@ public class ViewInput extends FRoundedPanel {
|
||||
public void componentResized(ComponentEvent e) {
|
||||
int px = (int) (ViewInput.this.getWidth() / 17);
|
||||
px = (px < 11 ? 11 : px);
|
||||
tarMessage.setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, px));
|
||||
tarMessage.setFont(AllZone.getSkin().getFont(px));
|
||||
}
|
||||
});
|
||||
// After all components are in place, instantiate controller.
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package forge.view.match;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
@@ -172,32 +171,32 @@ public class ViewTabber extends FRoundedPanel {
|
||||
JLabel[] labels = (JLabel[]) it.next().getValue();
|
||||
for (x = 0; x < labels.length; x++) {
|
||||
if (x > 0) {
|
||||
labels[x].setFont(skin.getFont1().deriveFont(Font.PLAIN, regular));
|
||||
labels[x].setFont(skin.getFont(regular));
|
||||
}
|
||||
else {
|
||||
labels[x].setFont(skin.getFont1().deriveFont(Font.PLAIN, big));
|
||||
labels[x].setFont(skin.getFont(big));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stack text areas
|
||||
for (JTextArea tar : stackTARs) {
|
||||
tar.setFont(skin.getFont1().deriveFont(Font.PLAIN, big));
|
||||
tar.setFont(skin.getFont(big));
|
||||
}
|
||||
|
||||
// Combat text areas
|
||||
for (JTextArea tar : combatTARs) {
|
||||
tar.setFont(skin.getFont1().deriveFont(Font.PLAIN, big));
|
||||
tar.setFont(skin.getFont(big));
|
||||
}
|
||||
|
||||
// Console text areas
|
||||
for (JTextArea tar : consoleTARs) {
|
||||
tar.setFont(skin.getFont1().deriveFont(Font.PLAIN, big));
|
||||
tar.setFont(skin.getFont(big));
|
||||
}
|
||||
|
||||
// Devmode Labels
|
||||
for (JLabel lbl : devLBLs) {
|
||||
lbl.setFont(skin.getFont1().deriveFont(Font.PLAIN, regular));
|
||||
lbl.setFont(skin.getFont(regular));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,18 +67,18 @@ public class ViewWinLose {
|
||||
|
||||
lblTitle.setForeground(Color.white);
|
||||
lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblTitle.setFont(AllZone.getSkin().getFont1().deriveFont(Font.BOLD, 30));
|
||||
lblTitle.setFont(AllZone.getSkin().getFont().deriveFont(Font.BOLD, 30));
|
||||
|
||||
lblStats.setForeground(Color.white);
|
||||
lblStats.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblStats.setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, 26));
|
||||
lblStats.setFont(AllZone.getSkin().getFont().deriveFont(Font.PLAIN, 26));
|
||||
|
||||
btnContinue.setText("Continue");
|
||||
btnContinue.setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, 22));
|
||||
btnContinue.setFont(AllZone.getSkin().getFont(22));
|
||||
btnRestart.setText("Restart");
|
||||
btnRestart.setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, 22));
|
||||
btnRestart.setFont(AllZone.getSkin().getFont(22));
|
||||
btnQuit.setText("Quit");
|
||||
btnQuit.setFont(AllZone.getSkin().getFont1().deriveFont(Font.PLAIN, 22));
|
||||
btnQuit.setFont(AllZone.getSkin().getFont(22));
|
||||
|
||||
// End game and set state of "continue" button
|
||||
Phase.setGameBegins(0);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.view.toolbox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
@@ -226,7 +225,7 @@ public class DeckLister extends JPanel {
|
||||
public TitleLabel(String txt0) {
|
||||
super(txt0);
|
||||
setForeground(skin.getColor("text"));
|
||||
setFont(skin.getFont1().deriveFont(Font.PLAIN, 11));
|
||||
setFont(skin.getFont(11));
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
}
|
||||
}
|
||||
@@ -242,7 +241,7 @@ public class DeckLister extends JPanel {
|
||||
setBackground(Color.GREEN);
|
||||
}
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
setFont(skin.getFont1().deriveFont(Font.BOLD, 12));
|
||||
setFont(skin.getBoldFont(12));
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +251,7 @@ public class DeckLister extends JPanel {
|
||||
super(txt0);
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
setForeground(skin.getColor("text"));
|
||||
setFont(skin.getFont1().deriveFont(Font.BOLD, 12));
|
||||
setFont(skin.getBoldFont(12));
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package forge.view.toolbox;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
@@ -77,7 +76,7 @@ public class FButton extends JButton {
|
||||
this.setBorder(BorderFactory.createEmptyBorder());
|
||||
this.setContentAreaFilled(false);
|
||||
this.setMargin(new Insets(0, 25, 0, 25));
|
||||
this.setFont(this.skin.getFont1().deriveFont(Font.BOLD, 15));
|
||||
this.setFont(this.skin.getBoldFont(14));
|
||||
this.imgL = skin.getImage("button.upLEFT");
|
||||
this.imgM = skin.getImage("button.upCENTER");
|
||||
this.imgR = skin.getImage("button.upRIGHT");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.view.toolbox;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JLabel;
|
||||
@@ -54,7 +53,7 @@ public class FList extends JList {
|
||||
lblItem.setBorder(new EmptyBorder(4, 3, 4, 3));
|
||||
lblItem.setBackground(skin.getColor("active"));
|
||||
lblItem.setForeground(skin.getColor("text"));
|
||||
lblItem.setFont(skin.getFont1().deriveFont(Font.PLAIN, 13));
|
||||
lblItem.setFont(skin.getFont(13));
|
||||
lblItem.setOpaque(isSelected);
|
||||
return lblItem;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,11 @@ public class FSkin {
|
||||
private Map<String, ImageIcon> icons;
|
||||
private Map<String, Color> colors;
|
||||
private Map<String, Image> images;
|
||||
private Map<Integer, Font> plainFonts;
|
||||
private Map<Integer, Font> boldFonts;
|
||||
private Map<Integer, Font> italicFonts;
|
||||
|
||||
private Font font1 = null;
|
||||
private Font font = null;
|
||||
private String name = "default";
|
||||
private final String spriteFile = "";
|
||||
private final String font1file = "font1.ttf";
|
||||
@@ -113,7 +116,29 @@ public class FSkin {
|
||||
this.images = new HashMap<String, Image>();
|
||||
|
||||
// Fonts
|
||||
this.setFont1(this.retrieveFont(dirName + this.font1file));
|
||||
this.setFont(this.retrieveFont(dirName + this.font1file));
|
||||
plainFonts = new HashMap<Integer, Font>();
|
||||
plainFonts.put(10, font.deriveFont(Font.PLAIN, 10));
|
||||
plainFonts.put(11, font.deriveFont(Font.PLAIN, 11));
|
||||
plainFonts.put(12, font.deriveFont(Font.PLAIN, 12));
|
||||
plainFonts.put(13, font.deriveFont(Font.PLAIN, 13));
|
||||
plainFonts.put(14, font.deriveFont(Font.PLAIN, 14));
|
||||
plainFonts.put(15, font.deriveFont(Font.PLAIN, 15));
|
||||
plainFonts.put(16, font.deriveFont(Font.PLAIN, 16));
|
||||
plainFonts.put(18, font.deriveFont(Font.PLAIN, 18));
|
||||
plainFonts.put(20, font.deriveFont(Font.PLAIN, 20));
|
||||
plainFonts.put(22, font.deriveFont(Font.PLAIN, 22));
|
||||
|
||||
boldFonts = new HashMap<Integer, Font>();
|
||||
boldFonts.put(12, font.deriveFont(Font.BOLD, 12));
|
||||
boldFonts.put(14, font.deriveFont(Font.BOLD, 14));
|
||||
boldFonts.put(16, font.deriveFont(Font.BOLD, 16));
|
||||
boldFonts.put(18, font.deriveFont(Font.BOLD, 18));
|
||||
boldFonts.put(20, font.deriveFont(Font.BOLD, 20));
|
||||
|
||||
italicFonts = new HashMap<Integer, Font>();
|
||||
italicFonts.put(12, font.deriveFont(Font.ITALIC, 12));
|
||||
italicFonts.put(14, font.deriveFont(Font.ITALIC, 14));
|
||||
|
||||
// Images
|
||||
this.setImage("bg.texture", this.retrieveImage(dirName + "bg_texture.jpg"));
|
||||
@@ -246,23 +271,52 @@ public class FSkin {
|
||||
return new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary font used in titles and buttons and most text output.
|
||||
*
|
||||
* @return {@link java.awt.font} font1
|
||||
*/
|
||||
public Font getFont1() {
|
||||
return this.font1;
|
||||
/** @return {@link java.awt.font} font */
|
||||
public Font getFont() {
|
||||
return this.font;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Primary font used in titles and buttons and most text output.
|
||||
*
|
||||
* @param font10
|
||||
*   an image icon
|
||||
* @param font0 - an image icon
|
||||
*/
|
||||
public void setFont1(final Font font10) {
|
||||
this.font1 = font10;
|
||||
public void setFont(final Font font0) {
|
||||
this.font = font0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param size - integer, pixel size
|
||||
* @return {@link java.awt.font} font1
|
||||
*/
|
||||
public Font getFont(int size) {
|
||||
if (plainFonts.get(size) == null) {
|
||||
System.out.println("FSkin: A plain font of size " + size + " hasn't been derived yet.");
|
||||
}
|
||||
return plainFonts.get(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param size - integer, pixel size
|
||||
* @return {@link java.awt.font} font1
|
||||
*/
|
||||
public Font getBoldFont(int size) {
|
||||
if (boldFonts.get(size) == null) {
|
||||
System.out.println("FSkin: A bold font of size " + size + " hasn't been derived yet.");
|
||||
}
|
||||
return boldFonts.get(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param size - integer, pixel size
|
||||
* @return {@link java.awt.font} font1
|
||||
*/
|
||||
public Font getItalicFont(int size) {
|
||||
if (boldFonts.get(size) == null) {
|
||||
System.out.println("FSkin: An italic font of size " + size + " hasn't been derived yet.");
|
||||
}
|
||||
return italicFonts.get(size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,6 @@ package forge.view.toolbox;
|
||||
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
@@ -228,7 +227,7 @@ public class FVerticalTabPanel extends FPanel {
|
||||
// Careful with this font scale factor; the vertical tabs will be
|
||||
// unreadable
|
||||
// if small window, too big if large window.
|
||||
setFont(FVerticalTabPanel.this.skin.getFont1().deriveFont(Font.PLAIN, (int) (h * 0.16)));
|
||||
setFont(FVerticalTabPanel.this.skin.getFont((int) (h * 0.16)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user