Added a chat font size option to preferences.

This commit is contained in:
LevelX2 2016-02-08 08:49:57 +01:00
parent 741c20afd8
commit ac2570f982
6 changed files with 241 additions and 34 deletions

View file

@ -179,7 +179,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private static long startTime; private static long startTime;
private BalloonTip balloonTip; private final BalloonTip balloonTip;
/** /**
* @return the session * @return the session
@ -306,6 +306,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
// balloonTip = new BalloonTip(desktopPane, "", new ModernBalloonStyle(0, 0, Color.WHITE, Color.YELLOW, Color.BLUE), false); // balloonTip = new BalloonTip(desktopPane, "", new ModernBalloonStyle(0, 0, Color.WHITE, Color.YELLOW, Color.BLUE), false);
balloonTip = new BalloonTip(desktopPane, "", new EdgedBalloonStyle(Color.WHITE, Color.BLUE), false); balloonTip = new BalloonTip(desktopPane, "", new EdgedBalloonStyle(Color.WHITE, Color.BLUE), false);
balloonTip.setPositioner(new LeftAbovePositioner(0, 0)); balloonTip.setPositioner(new LeftAbovePositioner(0, 0));
balloonTip.setVisible(false);
mageToolbar.add(new javax.swing.JToolBar.Separator()); mageToolbar.add(new javax.swing.JToolBar.Separator());
mageToolbar.add(createWindowsButton()); mageToolbar.add(createWindowsButton());
@ -1272,6 +1273,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
CHATS.remove(chatId); CHATS.remove(chatId);
} }
public static Map<UUID, ChatPanelBasic> getChatPanels() {
return CHATS;
}
public static void addGame(UUID gameId, GamePanel gamePanel) { public static void addGame(UUID gameId, GamePanel gamePanel) {
GAMES.put(gameId, gamePanel); GAMES.put(gameId, gamePanel);
} }

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.2" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues> <AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -16,17 +16,16 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="txtMessage" max="32767" attributes="0"/> <Component id="jScrollPaneTxt" pref="0" max="32767" attributes="0"/>
<Component id="jScrollPaneTxt" pref="193" max="32767" attributes="0"/> <Component id="txtMessage" pref="400" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" attributes="0">
<Component id="jScrollPaneTxt" pref="175" max="32767" attributes="0"/> <Component id="jScrollPaneTxt" pref="190" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="txtMessage" min="-2" pref="30" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/> <EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="txtMessage" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -35,7 +34,12 @@
<Container class="javax.swing.JScrollPane" name="jScrollPaneTxt"> <Container class="javax.swing.JScrollPane" name="jScrollPaneTxt">
<Properties> <Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/> <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder/>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 32767]"/>
</Property> </Property>
</Properties> </Properties>
@ -61,6 +65,18 @@
</SubComponents> </SubComponents>
</Container> </Container>
<Component class="javax.swing.JTextField" name="txtMessage"> <Component class="javax.swing.JTextField" name="txtMessage">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[5000, 60]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[6, 60]"/>
</Property>
<Property name="name" type="java.lang.String" value="" noResource="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[6, 60]"/>
</Property>
</Properties>
<Events> <Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtMessageKeyTyped"/> <EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtMessageKeyTyped"/>
</Events> </Events>

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
/* /*
* ChatPanel.java * ChatPanel.java
* *
* Created on 15-Dec-2009, 11:04:31 PM * Created on 15-Dec-2009, 11:04:31 PM
@ -34,10 +34,13 @@
package mage.client.chat; package mage.client.chat;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.UUID; import java.util.UUID;
import javax.swing.JTextField; import javax.swing.JTextField;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.util.FontSizeHelper;
import mage.remote.Session; import mage.remote.Session;
import mage.view.ChatMessage.MessageColor; import mage.view.ChatMessage.MessageColor;
import mage.view.ChatMessage.MessageType; import mage.view.ChatMessage.MessageType;
@ -119,7 +122,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
public ChatPanelBasic() { public ChatPanelBasic() {
initComponents(); initComponents();
setBackground(new Color(0, 0, 0, CHAT_ALPHA)); setBackground(new Color(0, 0, 0, CHAT_ALPHA));
changeGUISize(FontSizeHelper.getChatFont());
if (jScrollPaneTxt != null) { if (jScrollPaneTxt != null) {
jScrollPaneTxt.setBackground(new Color(0, 0, 0, CHAT_ALPHA)); jScrollPaneTxt.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA)); jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
@ -130,6 +133,24 @@ public class ChatPanelBasic extends javax.swing.JPanel {
} }
public void changeGUISize(Font font) {
txtConversation.setFont(font);
txtMessage.setFont(font);
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setFont(font);
}
int height = 30;
if (font.getSize() > 20) {
height = 30 + Math.min(font.getSize() - 10, 30);
}
txtMessage.setMinimumSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));
this.revalidate();
this.repaint();
}
public ChatType getChatType() { public ChatType getChatType() {
return chatType; return chatType;
} }
@ -212,13 +233,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
} }
protected String getColoredText(String color, String text) { protected String getColoredText(String color, String text) {
StringBuilder sb = new StringBuilder(); return "<font color='" + color + "'>" + text + "</font>";
sb.append("<font color='");
sb.append(color);
sb.append("'>");
sb.append(text);
sb.append("</font>");
return sb.toString();
} }
public String getText() { public String getText() {
@ -285,7 +300,8 @@ public class ChatPanelBasic extends javax.swing.JPanel {
txtConversation = new mage.client.components.ColorPane(); txtConversation = new mage.client.components.ColorPane();
txtMessage = new javax.swing.JTextField(); txtMessage = new javax.swing.JTextField();
jScrollPaneTxt.setBorder(null); jScrollPaneTxt.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jScrollPaneTxt.setPreferredSize(new java.awt.Dimension(32767, 32767));
txtConversation.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); txtConversation.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
txtConversation.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N txtConversation.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
@ -294,6 +310,10 @@ public class ChatPanelBasic extends javax.swing.JPanel {
txtConversation.setOpaque(false); txtConversation.setOpaque(false);
jScrollPaneTxt.setViewportView(txtConversation); jScrollPaneTxt.setViewportView(txtConversation);
txtMessage.setMaximumSize(new java.awt.Dimension(5000, 60));
txtMessage.setMinimumSize(new java.awt.Dimension(6, 60));
txtMessage.setName(""); // NOI18N
txtMessage.setPreferredSize(new java.awt.Dimension(6, 60));
txtMessage.addKeyListener(new java.awt.event.KeyAdapter() { txtMessage.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) { public void keyTyped(java.awt.event.KeyEvent evt) {
txtMessageKeyTyped(evt); txtMessageKeyTyped(evt);
@ -304,18 +324,15 @@ public class ChatPanelBasic extends javax.swing.JPanel {
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtMessage) .addComponent(jScrollPaneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addGap(0, 0, 0))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE) .addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
.addGap(0, 0, 0) .addGap(0, 0, 0)
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents

View file

@ -384,6 +384,84 @@
</Container> </Container>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="tabGuiSize">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="GUI Size">
<Property name="tabTitle" type="java.lang.String" value="GUI Size"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="guiSize_font" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="guiSize_font" min="-2" pref="95" max="-2" attributes="0"/>
<EmptySpace pref="332" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="guiSize_font">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Font">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="fontSizeLabel">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Font Size"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the font used to display text."/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSlider" name="sliderFontSize">
<Properties>
<Property name="majorTickSpacing" type="int" value="1"/>
<Property name="maximum" type="int" value="30"/>
<Property name="minimum" type="int" value="10"/>
<Property name="minorTickSpacing" type="int" value="1"/>
<Property name="paintLabels" type="boolean" value="true"/>
<Property name="paintTicks" type="boolean" value="true"/>
<Property name="snapToTicks" type="boolean" value="true"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The time the appearance of the tooltip window for a card is delayed.&lt;br&gt;&#xa;If set to zero, the tooltip window won&apos;t be shown at all."/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="tabPhases"> <Container class="javax.swing.JPanel" name="tabPhases">
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
/* /*
* PreferencesDialog.java * PreferencesDialog.java
* *
* Created on 26.06.2011, 16:35:40 * Created on 26.06.2011, 16:35:40
@ -60,6 +60,7 @@ import javax.swing.border.Border;
import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileFilter;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.util.Config; import mage.client.util.Config;
import mage.client.util.FontSizeHelper;
import mage.client.util.ImageHelper; import mage.client.util.ImageHelper;
import mage.client.util.gui.BufferedImageBuilder; import mage.client.util.gui.BufferedImageBuilder;
import static mage.constants.Constants.DEFAULT_AVATAR_ID; import static mage.constants.Constants.DEFAULT_AVATAR_ID;
@ -79,7 +80,7 @@ import org.apache.log4j.Logger;
*/ */
public class PreferencesDialog extends javax.swing.JDialog { public class PreferencesDialog extends javax.swing.JDialog {
private static final Logger log = Logger.getLogger(PreferencesDialog.class); private static final Logger LOGGER = Logger.getLogger(PreferencesDialog.class);
public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards"; public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards";
public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay"; public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay";
@ -92,6 +93,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_GAME_CONFIRM_EMPTY_MANA_POOL = "gameConfirmEmptyManaPool"; public static final String KEY_GAME_CONFIRM_EMPTY_MANA_POOL = "gameConfirmEmptyManaPool";
public static final String KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER = "gameAskMoveToGraveORder"; public static final String KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER = "gameAskMoveToGraveORder";
public static final String KEY_GUI_FONT_SIZE = "guiFontSize";
public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave"; public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
public static final String KEY_DRAFT_LOG_AUTO_SAVE = "draftLogAutoSave"; public static final String KEY_DRAFT_LOG_AUTO_SAVE = "draftLogAutoSave";
@ -355,6 +358,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
main_gamelog = new javax.swing.JPanel(); main_gamelog = new javax.swing.JPanel();
cbGameLogAutoSave = new javax.swing.JCheckBox(); cbGameLogAutoSave = new javax.swing.JCheckBox();
cbDraftLogAutoSave = new javax.swing.JCheckBox(); cbDraftLogAutoSave = new javax.swing.JCheckBox();
tabGuiSize = new javax.swing.JPanel();
guiSize_font = new javax.swing.JPanel();
fontSizeLabel = new javax.swing.JLabel();
sliderFontSize = new javax.swing.JSlider();
tabPhases = new javax.swing.JPanel(); tabPhases = new javax.swing.JPanel();
jLabelHeadLine = new javax.swing.JLabel(); jLabelHeadLine = new javax.swing.JLabel();
jLabelYourTurn = new javax.swing.JLabel(); jLabelYourTurn = new javax.swing.JLabel();
@ -395,7 +402,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
btnBrowseImageLocation = new javax.swing.JButton(); btnBrowseImageLocation = new javax.swing.JButton();
cbCheckForNewImages = new javax.swing.JCheckBox(); cbCheckForNewImages = new javax.swing.JCheckBox();
cbSaveToZipFiles = new javax.swing.JCheckBox(); cbSaveToZipFiles = new javax.swing.JCheckBox();
cbPreferedImageLanguage = new javax.swing.JComboBox<String>(); cbPreferedImageLanguage = new javax.swing.JComboBox<>();
labelPreferedImageLanguage = new javax.swing.JLabel(); labelPreferedImageLanguage = new javax.swing.JLabel();
panelBackgroundImages = new javax.swing.JPanel(); panelBackgroundImages = new javax.swing.JPanel();
cbUseDefaultBackground = new javax.swing.JCheckBox(); cbUseDefaultBackground = new javax.swing.JCheckBox();
@ -447,7 +454,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
jPanel33 = new javax.swing.JPanel(); jPanel33 = new javax.swing.JPanel();
tabConnection = new javax.swing.JPanel(); tabConnection = new javax.swing.JPanel();
lblProxyType = new javax.swing.JLabel(); lblProxyType = new javax.swing.JLabel();
cbProxyType = new javax.swing.JComboBox<ProxyType>(); cbProxyType = new javax.swing.JComboBox<>();
pnlProxySettings = new javax.swing.JPanel(); pnlProxySettings = new javax.swing.JPanel();
pnlProxy = new javax.swing.JPanel(); pnlProxy = new javax.swing.JPanel();
lblProxyServer = new javax.swing.JLabel(); lblProxyServer = new javax.swing.JLabel();
@ -710,6 +717,43 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabsPanel.addTab("Main", tabMain); tabsPanel.addTab("Main", tabMain);
guiSize_font.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Font"));
guiSize_font.setLayout(new java.awt.BorderLayout());
fontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
fontSizeLabel.setText("Font Size");
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display text.");
guiSize_font.add(fontSizeLabel, java.awt.BorderLayout.CENTER);
sliderFontSize.setMajorTickSpacing(1);
sliderFontSize.setMaximum(30);
sliderFontSize.setMinimum(10);
sliderFontSize.setMinorTickSpacing(1);
sliderFontSize.setPaintLabels(true);
sliderFontSize.setPaintTicks(true);
sliderFontSize.setSnapToTicks(true);
sliderFontSize.setToolTipText("<HTML>The time the appearance of the tooltip window for a card is delayed.<br>\nIf set to zero, the tooltip window won't be shown at all.");
guiSize_font.add(sliderFontSize, java.awt.BorderLayout.PAGE_START);
javax.swing.GroupLayout tabGuiSizeLayout = new javax.swing.GroupLayout(tabGuiSize);
tabGuiSize.setLayout(tabGuiSizeLayout);
tabGuiSizeLayout.setHorizontalGroup(
tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabGuiSizeLayout.createSequentialGroup()
.addContainerGap()
.addComponent(guiSize_font, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
tabGuiSizeLayout.setVerticalGroup(
tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabGuiSizeLayout.createSequentialGroup()
.addContainerGap()
.addComponent(guiSize_font, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(332, Short.MAX_VALUE))
);
tabsPanel.addTab("GUI Size", tabGuiSize);
jLabelHeadLine.setText("Choose phases your game will stop on if not skipped by a skip action (e.g. F6):"); jLabelHeadLine.setText("Choose phases your game will stop on if not skipped by a skip action (e.g. F6):");
jLabelYourTurn.setText("Your turn"); jLabelYourTurn.setText("Your turn");
@ -956,7 +1000,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
}); });
cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
labelPreferedImageLanguage.setText("Prefered image language:"); labelPreferedImageLanguage.setText("Prefered image language:");
labelPreferedImageLanguage.setFocusable(false); labelPreferedImageLanguage.setFocusable(false);
@ -1950,6 +1994,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbDraftLogAutoSave, KEY_DRAFT_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbDraftLogAutoSave, KEY_DRAFT_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
// GUI Size
if (getCachedValue(KEY_GUI_FONT_SIZE, 14) != dialog.sliderFontSize.getValue()) {
save(prefs, dialog.sliderFontSize, KEY_GUI_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);
FontSizeHelper.updateGUI();
}
// Phases & Priority // Phases & Priority
save(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU); save(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU);
save(prefs, dialog.checkBoxDrawYou, DRAW_YOU); save(prefs, dialog.checkBoxDrawYou, DRAW_YOU);
@ -2320,10 +2370,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
connection.setProxyPassword(password); connection.setProxyPassword(password);
} }
} else { } else {
log.warn("host or\\and port are empty: host=" + host + ", port=" + port); LOGGER.warn("host or\\and port are empty: host=" + host + ", port=" + port);
} }
} }
} }
/** /**
* @param args the command line arguments * @param args the command line arguments
*/ */
@ -2348,6 +2399,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
// Main & Phases // Main & Phases
loadPhases(prefs); loadPhases(prefs);
// Gui Size
loadGuiSize(prefs);
// Images // Images
loadImagesSettings(prefs); loadImagesSettings(prefs);
@ -2415,6 +2469,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
private static void loadGuiSize(Preferences prefs) {
load(prefs, dialog.sliderFontSize, KEY_GUI_FONT_SIZE, "14");
}
private static void loadImagesSettings(Preferences prefs) { private static void loadImagesSettings(Preferences prefs) {
String prop = prefs.get(KEY_CARD_IMAGES_USE_DEFAULT, "true"); String prop = prefs.get(KEY_CARD_IMAGES_USE_DEFAULT, "true");
if (prop.equals("true")) { if (prop.equals("true")) {
@ -2731,7 +2789,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
addAvatar(jPanel32, 32, false, false); addAvatar(jPanel32, 32, false, false);
} catch (Exception e) { } catch (Exception e) {
log.error(e, e); LOGGER.error(e, e);
} }
} }
@ -2850,6 +2908,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JPanel connection_servers; private javax.swing.JPanel connection_servers;
private javax.swing.JCheckBox displayBigCardsInHand; private javax.swing.JCheckBox displayBigCardsInHand;
private javax.swing.JButton exitButton; private javax.swing.JButton exitButton;
private javax.swing.JLabel fontSizeLabel;
private javax.swing.JPanel guiSize_font;
private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel15;
@ -2910,10 +2970,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox showAbilityPickerForced; private javax.swing.JCheckBox showAbilityPickerForced;
private javax.swing.JCheckBox showCardName; private javax.swing.JCheckBox showCardName;
private javax.swing.JCheckBox showPlayerNamesPermanently; private javax.swing.JCheckBox showPlayerNamesPermanently;
private javax.swing.JSlider sliderFontSize;
private javax.swing.JPanel sounds_backgroundMusic; private javax.swing.JPanel sounds_backgroundMusic;
private javax.swing.JPanel sounds_clips; private javax.swing.JPanel sounds_clips;
private javax.swing.JPanel tabAvatars; private javax.swing.JPanel tabAvatars;
private javax.swing.JPanel tabConnection; private javax.swing.JPanel tabConnection;
private javax.swing.JPanel tabGuiSize;
private javax.swing.JPanel tabImages; private javax.swing.JPanel tabImages;
private javax.swing.JPanel tabMain; private javax.swing.JPanel tabMain;
private javax.swing.JPanel tabPhases; private javax.swing.JPanel tabPhases;

View file

@ -0,0 +1,29 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.client.util;
import java.awt.Font;
import mage.client.MageFrame;
import mage.client.chat.ChatPanelBasic;
import mage.client.dialog.PreferencesDialog;
/**
*
* @author LevelX2
*/
public class FontSizeHelper {
public static Font getChatFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
public static void updateGUI() {
for (ChatPanelBasic chatPanel : MageFrame.getChatPanels().values()) {
chatPanel.changeGUISize(getChatFont());
}
}
}