Some more changes to GUI to better support high screen resolutions.

This commit is contained in:
LevelX2 2016-02-19 01:56:15 +01:00
parent 5943250a0b
commit 35505b29bb
4 changed files with 114 additions and 76 deletions

View file

@ -1653,7 +1653,7 @@
<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 size of the card in hand"/> <Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the card images in hand and on the stack"/>
<Property name="value" type="int" value="14"/> <Property name="value" type="int" value="14"/>
<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="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
@ -1673,8 +1673,8 @@
<Component class="javax.swing.JLabel" name="labelCardSizeHand"> <Component class="javax.swing.JLabel" name="labelCardSizeHand">
<Properties> <Properties>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Cards hand"/> <Property name="text" type="java.lang.String" value="Hand cards and stack objects"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the card in hand"/> <Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the card images in hand and on the stack"/>
</Properties> </Properties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
@ -1756,16 +1756,17 @@
</Constraint> </Constraint>
</Constraints> </Constraints>
</Component> </Component>
<Component class="javax.swing.JSlider" name="sliderSymbolSize"> <Component class="javax.swing.JSlider" name="sliderStackWidth">
<Properties> <Properties>
<Property name="majorTickSpacing" type="int" value="5"/> <Property name="majorTickSpacing" type="int" value="20"/>
<Property name="maximum" type="int" value="50"/> <Property name="maximum" type="int" value="90"/>
<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="5"/>
<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 size of symbols"/> <Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The % size of the stack object area in relation to the hand card area size."/>
<Property name="value" type="int" value="30"/>
<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="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/> <EtchetBorder/>
@ -1775,18 +1776,24 @@
<Dimension value="[150, 40]"/> <Dimension value="[150, 40]"/>
</Property> </Property>
</Properties> </Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="&lt;HTML&gt;The stack width in relation to the hand area width"/>
</AccessibilityProperties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="11" weightX="0.0" weightY="0.0"/> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint> </Constraint>
</Constraints> </Constraints>
</Component> </Component>
<Component class="javax.swing.JLabel" name="labelSymbolSize"> <Component class="javax.swing.JLabel" name="labelStackWidth">
<Properties> <Properties>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Symbol size"/> <Property name="text" type="java.lang.String" value="Stack %width relatated to hand"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of symbols"/> <Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The % size of the stack object area in relation to the hand card area size."/>
</Properties> </Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="&lt;HTML&gt;The stack width in relation to the hand area width"/>
</AccessibilityProperties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="3" ipadY="3" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="3" ipadY="3" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
@ -2594,11 +2601,11 @@
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/> <CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
</StatementProvider> </StatementProvider>
<Parameters> <Parameters>
<CodeExpression id="127_sliderSymbolSize"> <CodeExpression id="127_sliderStackWidth">
<CodeVariable name="sliderSymbolSize" type="8194" declaredType="javax.swing.JSlider"/> <CodeVariable name="sliderStackWidth" type="8194" declaredType="javax.swing.JSlider"/>
<ExpressionOrigin> <ExpressionOrigin>
<ExpressionProvider type="ComponentRef"> <ExpressionProvider type="ComponentRef">
<ComponentRef name="sliderSymbolSize"/> <ComponentRef name="sliderStackWidth"/>
</ExpressionProvider> </ExpressionProvider>
</ExpressionOrigin> </ExpressionOrigin>
</CodeExpression> </CodeExpression>
@ -2689,11 +2696,11 @@
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/> <CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
</StatementProvider> </StatementProvider>
<Parameters> <Parameters>
<CodeExpression id="134_labelSymbolSize"> <CodeExpression id="134_labelStackWidth">
<CodeVariable name="labelSymbolSize" type="8194" declaredType="javax.swing.JLabel"/> <CodeVariable name="labelStackWidth" type="8194" declaredType="javax.swing.JLabel"/>
<ExpressionOrigin> <ExpressionOrigin>
<ExpressionProvider type="ComponentRef"> <ExpressionProvider type="ComponentRef">
<ComponentRef name="labelSymbolSize"/> <ComponentRef name="labelStackWidth"/>
</ExpressionProvider> </ExpressionProvider>
</ExpressionOrigin> </ExpressionOrigin>
</CodeExpression> </CodeExpression>

View file

@ -99,7 +99,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_GUI_CARD_EDITOR_SIZE = "guiCardEditorSize"; public static final String KEY_GUI_CARD_EDITOR_SIZE = "guiCardEditorSize";
public static final String KEY_GUI_CARD_OFFSET_SIZE = "guiCardOffsetSize"; public static final String KEY_GUI_CARD_OFFSET_SIZE = "guiCardOffsetSize";
public static final String KEY_GUI_SYMBOL_SIZE = "guiSymbolSize"; public static final String KEY_GUI_STACK_WIDTH = "guiStackWidth";
public static final String KEY_GUI_TOOLTIP_SIZE = "guiTooltipSize"; public static final String KEY_GUI_TOOLTIP_SIZE = "guiTooltipSize";
public static final String KEY_GUI_DIALOG_FONT_SIZE = "guiDialogFontSize"; public static final String KEY_GUI_DIALOG_FONT_SIZE = "guiDialogFontSize";
public static final String KEY_GUI_FEEDBACK_AREA_SIZE = "guiFeedbackAreaSize"; public static final String KEY_GUI_FEEDBACK_AREA_SIZE = "guiFeedbackAreaSize";
@ -388,8 +388,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
labelCardSizeOtherZones = new javax.swing.JLabel(); labelCardSizeOtherZones = new javax.swing.JLabel();
sliderCardSizeBattlefield = new javax.swing.JSlider(); sliderCardSizeBattlefield = new javax.swing.JSlider();
labelCardSizeBattlefield = new javax.swing.JLabel(); labelCardSizeBattlefield = new javax.swing.JLabel();
sliderSymbolSize = new javax.swing.JSlider(); sliderStackWidth = new javax.swing.JSlider();
labelSymbolSize = new javax.swing.JLabel(); labelStackWidth = new javax.swing.JLabel();
sliderGameFeedbackArea = new javax.swing.JSlider(); sliderGameFeedbackArea = new javax.swing.JSlider();
labelGameFeedback = new javax.swing.JLabel(); labelGameFeedback = new javax.swing.JLabel();
sliderTooltipSize = new javax.swing.JSlider(); sliderTooltipSize = new javax.swing.JSlider();
@ -918,7 +918,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
sliderCardSizeHand.setPaintLabels(true); sliderCardSizeHand.setPaintLabels(true);
sliderCardSizeHand.setPaintTicks(true); sliderCardSizeHand.setPaintTicks(true);
sliderCardSizeHand.setSnapToTicks(true); sliderCardSizeHand.setSnapToTicks(true);
sliderCardSizeHand.setToolTipText("<HTML>The size of the card in hand"); sliderCardSizeHand.setToolTipText("<HTML>The size of the card images in hand and on the stack");
sliderCardSizeHand.setValue(14); sliderCardSizeHand.setValue(14);
sliderCardSizeHand.setBorder(javax.swing.BorderFactory.createEtchedBorder()); sliderCardSizeHand.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderCardSizeHand.setMinimumSize(new java.awt.Dimension(150, 40)); sliderCardSizeHand.setMinimumSize(new java.awt.Dimension(150, 40));
@ -931,8 +931,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
guiSizeGame.add(sliderCardSizeHand, gridBagConstraints); guiSizeGame.add(sliderCardSizeHand, gridBagConstraints);
labelCardSizeHand.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); labelCardSizeHand.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelCardSizeHand.setText("Cards hand"); labelCardSizeHand.setText("Hand cards and stack objects");
labelCardSizeHand.setToolTipText("<HTML>The size of the card in hand"); labelCardSizeHand.setToolTipText("<HTML>The size of the card images in hand and on the stack");
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1; gridBagConstraints.gridy = 1;
@ -999,34 +999,37 @@ public class PreferencesDialog extends javax.swing.JDialog {
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
guiSizeGame.add(labelCardSizeBattlefield, gridBagConstraints); guiSizeGame.add(labelCardSizeBattlefield, gridBagConstraints);
sliderSymbolSize.setMajorTickSpacing(5); sliderStackWidth.setMajorTickSpacing(20);
sliderSymbolSize.setMaximum(50); sliderStackWidth.setMaximum(90);
sliderSymbolSize.setMinimum(10); sliderStackWidth.setMinimum(10);
sliderSymbolSize.setMinorTickSpacing(1); sliderStackWidth.setMinorTickSpacing(5);
sliderSymbolSize.setPaintLabels(true); sliderStackWidth.setPaintLabels(true);
sliderSymbolSize.setPaintTicks(true); sliderStackWidth.setPaintTicks(true);
sliderSymbolSize.setSnapToTicks(true); sliderStackWidth.setSnapToTicks(true);
sliderSymbolSize.setToolTipText("<HTML>The size of symbols"); sliderStackWidth.setToolTipText("<HTML>The % size of the stack object area in relation to the hand card area size.");
sliderSymbolSize.setBorder(javax.swing.BorderFactory.createEtchedBorder()); sliderStackWidth.setValue(30);
sliderSymbolSize.setMinimumSize(new java.awt.Dimension(150, 40)); sliderStackWidth.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderStackWidth.setMinimumSize(new java.awt.Dimension(150, 40));
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2; gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
guiSizeGame.add(sliderSymbolSize, gridBagConstraints); guiSizeGame.add(sliderStackWidth, gridBagConstraints);
sliderStackWidth.getAccessibleContext().setAccessibleDescription("<HTML>The stack width in relation to the hand area width");
labelSymbolSize.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); labelStackWidth.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelSymbolSize.setText("Symbol size"); labelStackWidth.setText("Stack %width relatated to hand");
labelSymbolSize.setToolTipText("<HTML>The size of symbols"); labelStackWidth.setToolTipText("<HTML>The % size of the stack object area in relation to the hand card area size.");
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0; gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3; gridBagConstraints.gridy = 3;
gridBagConstraints.ipadx = 3; gridBagConstraints.ipadx = 3;
gridBagConstraints.ipady = 3; gridBagConstraints.ipady = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
guiSizeGame.add(labelSymbolSize, gridBagConstraints); guiSizeGame.add(labelStackWidth, gridBagConstraints);
labelStackWidth.getAccessibleContext().setAccessibleDescription("<HTML>The stack width in relation to the hand area width");
sliderGameFeedbackArea.setMajorTickSpacing(5); sliderGameFeedbackArea.setMajorTickSpacing(5);
sliderGameFeedbackArea.setMaximum(50); sliderGameFeedbackArea.setMaximum(50);
@ -2366,8 +2369,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.sliderEditorCardOffset, KEY_GUI_CARD_OFFSET_SIZE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.sliderEditorCardOffset, KEY_GUI_CARD_OFFSET_SIZE, "true", "false", UPDATE_CACHE_POLICY);
sizeGUIChanged = true; sizeGUIChanged = true;
} }
if (getCachedValue(KEY_GUI_SYMBOL_SIZE, 14) != dialog.sliderSymbolSize.getValue()) { if (getCachedValue(KEY_GUI_STACK_WIDTH, 30) != dialog.sliderStackWidth.getValue()) {
save(prefs, dialog.sliderSymbolSize, KEY_GUI_SYMBOL_SIZE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.sliderStackWidth, KEY_GUI_STACK_WIDTH, "true", "false", UPDATE_CACHE_POLICY);
sizeGUIChanged = true; sizeGUIChanged = true;
} }
if (getCachedValue(KEY_GUI_TOOLTIP_SIZE, 14) != dialog.sliderTooltipSize.getValue()) { if (getCachedValue(KEY_GUI_TOOLTIP_SIZE, 14) != dialog.sliderTooltipSize.getValue()) {
@ -2874,7 +2877,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "14"); load(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "14");
load(prefs, dialog.sliderEditorCardSize, KEY_GUI_CARD_EDITOR_SIZE, "14"); load(prefs, dialog.sliderEditorCardSize, KEY_GUI_CARD_EDITOR_SIZE, "14");
load(prefs, dialog.sliderEditorCardOffset, KEY_GUI_CARD_OFFSET_SIZE, "14"); load(prefs, dialog.sliderEditorCardOffset, KEY_GUI_CARD_OFFSET_SIZE, "14");
load(prefs, dialog.sliderSymbolSize, KEY_GUI_SYMBOL_SIZE, "14"); load(prefs, dialog.sliderStackWidth, KEY_GUI_STACK_WIDTH, "14");
load(prefs, dialog.sliderDialogFont, KEY_GUI_DIALOG_FONT_SIZE, "14"); load(prefs, dialog.sliderDialogFont, KEY_GUI_DIALOG_FONT_SIZE, "14");
load(prefs, dialog.sliderTooltipSize, KEY_GUI_TOOLTIP_SIZE, "14"); load(prefs, dialog.sliderTooltipSize, KEY_GUI_TOOLTIP_SIZE, "14");
load(prefs, dialog.sliderGameFeedbackArea, KEY_GUI_FEEDBACK_AREA_SIZE, "14"); load(prefs, dialog.sliderGameFeedbackArea, KEY_GUI_FEEDBACK_AREA_SIZE, "14");
@ -3367,7 +3370,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JLabel labelEditorCardSize; private javax.swing.JLabel labelEditorCardSize;
private javax.swing.JLabel labelGameFeedback; private javax.swing.JLabel labelGameFeedback;
private javax.swing.JLabel labelPreferedImageLanguage; private javax.swing.JLabel labelPreferedImageLanguage;
private javax.swing.JLabel labelSymbolSize; private javax.swing.JLabel labelStackWidth;
private javax.swing.JLabel labelTooltipSize; private javax.swing.JLabel labelTooltipSize;
private javax.swing.JLabel lblProxyPassword; private javax.swing.JLabel lblProxyPassword;
private javax.swing.JLabel lblProxyPort; private javax.swing.JLabel lblProxyPort;
@ -3398,7 +3401,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JSlider sliderEditorCardSize; private javax.swing.JSlider sliderEditorCardSize;
private javax.swing.JSlider sliderFontSize; private javax.swing.JSlider sliderFontSize;
private javax.swing.JSlider sliderGameFeedbackArea; private javax.swing.JSlider sliderGameFeedbackArea;
private javax.swing.JSlider sliderSymbolSize; private javax.swing.JSlider sliderStackWidth;
private javax.swing.JSlider sliderTooltipSize; private javax.swing.JSlider sliderTooltipSize;
private javax.swing.JPanel sounds_backgroundMusic; private javax.swing.JPanel sounds_backgroundMusic;
private javax.swing.JPanel sounds_clips; private javax.swing.JPanel sounds_clips;

View file

@ -71,6 +71,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
@ -155,7 +156,7 @@ public final class GamePanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(GamePanel.class); private static final Logger logger = Logger.getLogger(GamePanel.class);
private static final String YOUR_HAND = "Your hand"; private static final String YOUR_HAND = "Your hand";
private static final int X_PHASE_WIDTH = 55; private static final int X_PHASE_WIDTH = 55;
private static final int STACK_MIN_CARDS_OFFSET_Y = 7; private static final int STACK_MIN_CARDS_OFFSET_Y = 7; // TODO: Size bui GUISize value
private static final String CMD_AUTO_ORDER_FIRST = "cmdAutoOrderFirst"; private static final String CMD_AUTO_ORDER_FIRST = "cmdAutoOrderFirst";
private static final String CMD_AUTO_ORDER_LAST = "cmdAutoOrderLast"; private static final String CMD_AUTO_ORDER_LAST = "cmdAutoOrderLast";
@ -216,7 +217,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.feedbackPanel.setConnectedChatPanel(this.userChatPanel); this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y); this.stackObjects.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);
// Override layout (I can't edit generated code) // Override layout (I can't edit generated code)
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -228,7 +229,7 @@ public final class GamePanel extends javax.swing.JPanel {
Map<String, JComponent> myUi = getUIComponents(jLayeredBackgroundPane); Map<String, JComponent> myUi = getUIComponents(jLayeredBackgroundPane);
Plugins.getInstance().updateGamePanel(myUi); Plugins.getInstance().updateGamePanel(myUi);
// Enlarge jlayeredpane on resize // Enlarge jlayeredpane on resize of game panel
addComponentListener(new ComponentAdapter() { addComponentListener(new ComponentAdapter() {
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
@ -254,6 +255,26 @@ public final class GamePanel extends javax.swing.JPanel {
} }
}); });
// Resize the width of the stack area if the size of the play area is chnaged
ComponentAdapter componentAdapterPlayField = new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
Thread worker = new Thread() {
@Override
public void run() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setGUISize();
}
});
}
};
worker.start();
}
};
jPanel3.addComponentListener(componentAdapterPlayField);
} }
private Map<String, JComponent> getUIComponents(JLayeredPane jLayeredPane) { private Map<String, JComponent> getUIComponents(JLayeredPane jLayeredPane) {
@ -280,7 +301,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.removeListener(); this.removeListener();
this.handContainer.cleanUp(); this.handContainer.cleanUp();
this.stack.cleanUp(); this.stackObjects.cleanUp();
for (Map.Entry<UUID, PlayAreaPanel> playAreaPanelEntry : players.entrySet()) { for (Map.Entry<UUID, PlayAreaPanel> playAreaPanelEntry : players.entrySet()) {
playAreaPanelEntry.getValue().CleanUp(); playAreaPanelEntry.getValue().CleanUp();
} }
@ -333,8 +354,7 @@ public final class GamePanel extends javax.swing.JPanel {
playAreaPanel.changeGUISize(); playAreaPanel.changeGUISize();
} }
stack.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25)); stackObjects.changeGUISize();
feedbackPanel.changeGUISize(); feedbackPanel.changeGUISize();
for (CardInfoWindowDialog cardInfoWindowDialog : exiles.values()) { for (CardInfoWindowDialog cardInfoWindowDialog : exiles.values()) {
@ -349,12 +369,32 @@ public final class GamePanel extends javax.swing.JPanel {
for (CardInfoWindowDialog cardInfoWindowDialog : graveyardWindows.values()) { for (CardInfoWindowDialog cardInfoWindowDialog : graveyardWindows.values()) {
cardInfoWindowDialog.changeGUISize(); cardInfoWindowDialog.changeGUISize();
} }
this.revalidate();
this.repaint();
} }
private void setGUISize() { private void setGUISize() {
jSplitPane0.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane0.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
stackObjects.setCardDimension(GUISizeHelper.handCardDimension);
int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100;
if (newStackWidth < 360) {
newStackWidth = 360;
}
Dimension newDimension = new Dimension(jPanel3.getWidth() - newStackWidth, (int) GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize);
handContainer.setPreferredSize(newDimension);
handContainer.setMaximumSize(newDimension);
newDimension = new Dimension(newStackWidth, (int) GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize);
stackObjects.setPreferredSize(newDimension);
stackObjects.setMinimumSize(newDimension);
stackObjects.setMaximumSize(newDimension);
newDimension = new Dimension(newStackWidth, (int) pnlShortCuts.getPreferredSize().getHeight());
pnlShortCuts.setPreferredSize(newDimension);
pnlShortCuts.setMinimumSize(newDimension);
pnlShortCuts.setMaximumSize(newDimension);
} }
private void saveDividerLocations() { private void saveDividerLocations() {
@ -831,7 +871,7 @@ public final class GamePanel extends javax.swing.JPanel {
} }
private void displayStack(GameView game, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) { private void displayStack(GameView game, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) {
this.stack.loadCards(game.getStack(), bigCard, gameId, true); this.stackObjects.loadCards(game.getStack(), bigCard, gameId, true);
} }
/** /**
@ -1222,7 +1262,6 @@ public final class GamePanel extends javax.swing.JPanel {
btnStopWatching = new javax.swing.JButton(); btnStopWatching = new javax.swing.JButton();
bigCard = new mage.client.cards.BigCard(); bigCard = new mage.client.cards.BigCard();
stack = new mage.client.cards.Cards();
pnlReplay = new javax.swing.JPanel(); pnlReplay = new javax.swing.JPanel();
btnStopReplay = new javax.swing.JButton(); btnStopReplay = new javax.swing.JButton();
btnNextPlay = new javax.swing.JButton(); btnNextPlay = new javax.swing.JButton();
@ -1241,9 +1280,13 @@ public final class GamePanel extends javax.swing.JPanel {
gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48)); gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
jSplitPane2 = new javax.swing.JSplitPane(); jSplitPane2 = new javax.swing.JSplitPane();
handContainer = new HandPanel(); handContainer = new HandPanel();
handCards = new HashMap<>(); handCards = new HashMap<>();
pnlShortCuts.setOpaque(false);
pnlShortCuts.setPreferredSize(new Dimension(400, 72));
stackObjects = new mage.client.cards.Cards();
jSplitPane1.setBorder(null); jSplitPane1.setBorder(null);
jSplitPane1.setDividerSize(7); jSplitPane1.setDividerSize(7);
jSplitPane1.setResizeWeight(1.0); jSplitPane1.setResizeWeight(1.0);
@ -1257,8 +1300,6 @@ public final class GamePanel extends javax.swing.JPanel {
restoreDividerLocations(); restoreDividerLocations();
pnlShortCuts.setOpaque(false);
pnlShortCuts.setPreferredSize(new Dimension(400, 72));
lblPhase.setLabelFor(txtPhase); lblPhase.setLabelFor(txtPhase);
lblPhase.setText("Phase:"); lblPhase.setText("Phase:");
@ -1558,7 +1599,7 @@ public final class GamePanel extends javax.swing.JPanel {
} }
}); });
stack.setBackgroundColor(new Color(0, 0, 0, 0)); stackObjects.setBackgroundColor(new Color(0, 0, 0, 40));
btnStopReplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop.png"))); btnStopReplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop.png")));
btnStopReplay.addActionListener(new java.awt.event.ActionListener() { btnStopReplay.addActionListener(new java.awt.event.ActionListener() {
@ -1739,8 +1780,8 @@ public final class GamePanel extends javax.swing.JPanel {
.addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
) )
.addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING)
.addComponent(pnlShortCuts, 400, 400, 400) .addComponent(pnlShortCuts, 360, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(stack, 400, 400, 400) .addComponent(stackObjects, 360, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
) )
) )
.addGap(0) .addGap(0)
@ -1762,7 +1803,7 @@ public final class GamePanel extends javax.swing.JPanel {
.addGroup(gl_jPanel3.createSequentialGroup() .addGroup(gl_jPanel3.createSequentialGroup()
.addGap(2) .addGap(2)
.addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(stack, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(stackObjects, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
) )
.addGroup(gl_jPanel3.createSequentialGroup() .addGroup(gl_jPanel3.createSequentialGroup()
.addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
@ -2179,7 +2220,8 @@ public final class GamePanel extends javax.swing.JPanel {
private javax.swing.JLabel txtTurn; private javax.swing.JLabel txtTurn;
private Map<String, CardsView> handCards; private Map<String, CardsView> handCards;
private mage.client.cards.Cards stack;
private mage.client.cards.Cards stackObjects;
private HandPanel handContainer; private HandPanel handContainer;
private javax.swing.JSplitPane jSplitPane2; private javax.swing.JSplitPane jSplitPane2;

View file

@ -56,6 +56,8 @@ public class GUISizeHelper {
public static Font gameDialogAreaFontSmall = new java.awt.Font("Arial", 0, 12); public static Font gameDialogAreaFontSmall = new java.awt.Font("Arial", 0, 12);
public static Dimension handCardDimension; public static Dimension handCardDimension;
public static int stackWidth;
public static Dimension otherZonesCardDimension; public static Dimension otherZonesCardDimension;
public static Dimension battlefieldCardDimension; public static Dimension battlefieldCardDimension;
@ -105,28 +107,12 @@ public class GUISizeHelper {
chatFont = new java.awt.Font("Arial", 0, chatFontSize); chatFont = new java.awt.Font("Arial", 0, chatFontSize);
symbolChatSize = chatFontSize; symbolChatSize = chatFontSize;
int symbolSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_SYMBOL_SIZE, 14);
// Set basic symbol size
if (symbolSize < 25) {
basicSymbolSize = "small";
} else if (symbolSize < 45) {
basicSymbolSize = "medium";
} else {
basicSymbolSize = "large";
}
if (symbolSize < 16) {
symbolPaySize = 15;
symbolCardSize = 15;
} else {
symbolPaySize = symbolSize;
symbolCardSize = symbolSize;
}
cardTooltipFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TOOLTIP_SIZE, 14); cardTooltipFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TOOLTIP_SIZE, 14);
symbolTooltipSize = cardTooltipFontSize; symbolTooltipSize = cardTooltipFontSize;
int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14); int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14);
handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42); handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42);
stackWidth = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_STACK_WIDTH, 30);
int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14); int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14);
otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42); otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42);