* Some fixes to font size change of chat panels.

This commit is contained in:
LevelX2 2016-02-08 16:16:19 +01:00
parent 6b20f7733a
commit 77a8e3e7a9
5 changed files with 35 additions and 20 deletions

View file

@ -23,7 +23,7 @@
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="jScrollPaneTxt" pref="190" max="32767" attributes="0"/> <Component id="jScrollPaneTxt" pref="180" max="32767" 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"/> <Component id="txtMessage" max="-2" attributes="0"/>
</Group> </Group>
@ -67,14 +67,14 @@
<Component class="javax.swing.JTextField" name="txtMessage"> <Component class="javax.swing.JTextField" name="txtMessage">
<Properties> <Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[5000, 60]"/> <Dimension value="[5000, 70]"/>
</Property> </Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[6, 60]"/> <Dimension value="[6, 70]"/>
</Property> </Property>
<Property name="name" type="java.lang.String" value="" noResource="true"/> <Property name="name" type="java.lang.String" value="" noResource="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[6, 60]"/> <Dimension value="[6, 70]"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>

View file

@ -310,10 +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.setMaximumSize(new java.awt.Dimension(5000, 70));
txtMessage.setMinimumSize(new java.awt.Dimension(6, 60)); txtMessage.setMinimumSize(new java.awt.Dimension(6, 70));
txtMessage.setName(""); // NOI18N txtMessage.setName(""); // NOI18N
txtMessage.setPreferredSize(new java.awt.Dimension(6, 60)); txtMessage.setPreferredSize(new java.awt.Dimension(6, 70));
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);
@ -330,7 +330,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE) .addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
.addGap(0, 0, 0) .addGap(0, 0, 0)
.addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
); );

View file

@ -27,8 +27,10 @@
*/ */
package mage.client.chat; package mage.client.chat;
import java.awt.Font;
import static mage.client.chat.ChatPanelBasic.TIMESTAMP_COLOR; import static mage.client.chat.ChatPanelBasic.TIMESTAMP_COLOR;
import mage.client.components.ColorPane; import mage.client.components.ColorPane;
import mage.client.util.FontSizeHelper;
import mage.view.ChatMessage; import mage.view.ChatMessage;
import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.ManaSymbols;
@ -103,6 +105,15 @@ public class ChatPanelSeparated extends ChatPanelBasic {
public void setSystemMessagesPane(ColorPane systemMessagesPane) { public void setSystemMessagesPane(ColorPane systemMessagesPane) {
this.systemMessagesPane = systemMessagesPane; this.systemMessagesPane = systemMessagesPane;
changeGUISize(FontSizeHelper.getChatFont());
}
@Override
public void changeGUISize(Font font) {
if (systemMessagesPane != null) {
systemMessagesPane.setFont(font);
}
super.changeGUISize(font);
} }
} }

View file

@ -398,8 +398,8 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="guiSize_font" max="32767" attributes="0"/> <Component id="guiSize_font" min="-2" pref="222" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace pref="296" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -432,9 +432,12 @@
<Component class="javax.swing.JLabel" name="fontSizeLabel"> <Component class="javax.swing.JLabel" name="fontSizeLabel">
<Properties> <Properties>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Font Size"/> <Property name="text" type="java.lang.String" value="Size"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the font used to display text."/> <Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the font used to display text."/>
</Properties> </Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Size"/>
</AccessibilityProperties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/> <BorderConstraints direction="Center"/>
@ -443,14 +446,14 @@
</Component> </Component>
<Component class="javax.swing.JSlider" name="sliderFontSize"> <Component class="javax.swing.JSlider" name="sliderFontSize">
<Properties> <Properties>
<Property name="majorTickSpacing" type="int" value="1"/> <Property name="majorTickSpacing" type="int" value="10"/>
<Property name="maximum" type="int" value="30"/> <Property name="maximum" type="int" value="50"/>
<Property name="minimum" type="int" value="10"/> <Property name="minimum" type="int" value="10"/>
<Property name="minorTickSpacing" type="int" value="1"/> <Property name="minorTickSpacing" type="int" value="1"/>
<Property name="paintLabels" type="boolean" value="true"/> <Property name="paintLabels" type="boolean" value="true"/>
<Property name="paintTicks" type="boolean" value="true"/> <Property name="paintTicks" type="boolean" value="true"/>
<Property name="snapToTicks" 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."/> <Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;Size of the font."/>
</Properties> </Properties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">

View file

@ -721,18 +721,19 @@ public class PreferencesDialog extends javax.swing.JDialog {
guiSize_font.setLayout(new java.awt.BorderLayout()); guiSize_font.setLayout(new java.awt.BorderLayout());
fontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); fontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
fontSizeLabel.setText("Font Size"); fontSizeLabel.setText("Size");
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display text."); fontSizeLabel.setToolTipText("<HTML>The size of the font used to display text.");
guiSize_font.add(fontSizeLabel, java.awt.BorderLayout.CENTER); guiSize_font.add(fontSizeLabel, java.awt.BorderLayout.CENTER);
fontSizeLabel.getAccessibleContext().setAccessibleName("Size");
sliderFontSize.setMajorTickSpacing(1); sliderFontSize.setMajorTickSpacing(10);
sliderFontSize.setMaximum(30); sliderFontSize.setMaximum(50);
sliderFontSize.setMinimum(10); sliderFontSize.setMinimum(10);
sliderFontSize.setMinorTickSpacing(1); sliderFontSize.setMinorTickSpacing(1);
sliderFontSize.setPaintLabels(true); sliderFontSize.setPaintLabels(true);
sliderFontSize.setPaintTicks(true); sliderFontSize.setPaintTicks(true);
sliderFontSize.setSnapToTicks(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."); sliderFontSize.setToolTipText("<HTML>Size of the font.");
guiSize_font.add(sliderFontSize, java.awt.BorderLayout.PAGE_START); guiSize_font.add(sliderFontSize, java.awt.BorderLayout.PAGE_START);
javax.swing.GroupLayout tabGuiSizeLayout = new javax.swing.GroupLayout(tabGuiSize); javax.swing.GroupLayout tabGuiSizeLayout = new javax.swing.GroupLayout(tabGuiSize);
@ -741,8 +742,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabGuiSizeLayout.createSequentialGroup() .addGroup(tabGuiSizeLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(guiSize_font, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(guiSize_font, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()) .addContainerGap(296, Short.MAX_VALUE))
); );
tabGuiSizeLayout.setVerticalGroup( tabGuiSizeLayout.setVerticalGroup(
tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)