Sizable GUI - game dialog area elements resize now.

This commit is contained in:
LevelX2 2016-02-20 02:31:47 +01:00
parent e15807b9ed
commit 249d709cc7
4 changed files with 40 additions and 28 deletions

View file

@ -97,11 +97,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
}
private void setGUISize() {
btnLeft.setFont(GUISizeHelper.gameDialogAreaFont);
btnRight.setFont(GUISizeHelper.gameDialogAreaFont);
btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont);
btnUndo.setFont(GUISizeHelper.gameDialogAreaFont);
helper.changeGUISize();
}

View file

@ -380,9 +380,8 @@ public final class GamePanel extends javax.swing.JPanel {
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
feedbackAreaHeight = GUISizeHelper.gameDialogAreaFontSizeBig + GUISizeHelper.gameDialogAreaFontSizeSmall + GUISizeHelper.gameDialogAreaButtonHigh + 50;
feedbackAreaHeight = GUISizeHelper.gameDialogAreaFontSizeBig + GUISizeHelper.gameDialogAreaFontSizeSmall + GUISizeHelper.gameDialogAreaButtonHigh + 60;
helper.setPreferredSize(new Dimension(100, feedbackAreaHeight));
stackObjects.setCardDimension(GUISizeHelper.handCardDimension);
int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100;
if (newStackWidth < 360) {

View file

@ -30,7 +30,7 @@ package mage.client.game;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -69,9 +69,9 @@ public class HelperPanel extends JPanel {
private javax.swing.JButton btnRight;
private javax.swing.JButton btnSpecial;
private javax.swing.JButton btnUndo;
//private javax.swing.JButton btnEndTurn;
//private javax.swing.JButton btnStopTimer;
private MageTextArea textArea;
JPanel buttonContainer;
@ -114,52 +114,66 @@ public class HelperPanel extends JPanel {
}
private void setGUISize() {
buttonContainer.setPreferredSize(new Dimension(100, GUISizeHelper.gameDialogAreaFont.getSize() + 10));
buttonContainer.setPreferredSize(new Dimension(getWidth(), GUISizeHelper.gameDialogButtonHeight + 20));
buttonContainer.setMinimumSize(new Dimension(160, GUISizeHelper.gameDialogButtonHeight + 20));
buttonContainer.setMaximumSize(new Dimension(Integer.MAX_VALUE, GUISizeHelper.gameDialogButtonHeight + 20));
Dimension buttonDimension = new Dimension(GUISizeHelper.gameDialogButtonWidth, GUISizeHelper.gameDialogButtonHeight);
btnLeft.setFont(GUISizeHelper.gameDialogAreaFont);
btnRight.setFont(GUISizeHelper.gameDialogAreaFont);
btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont);
btnUndo.setFont(GUISizeHelper.gameDialogAreaFont);
if (message != null) {
int pos = this.message.indexOf("font-size:");
if (pos > 0) {
String newMessage = this.message.substring(0, pos + 10) + GUISizeHelper.gameDialogAreaFontSizeBig + this.message.substring(pos + 12);
pos = this.message.indexOf("font-size:", pos + 10);
if (pos > 0) {
newMessage = this.message.substring(0, pos + 10) + GUISizeHelper.gameDialogAreaFontSizeSmall + this.message.substring(pos + 12);
}
setBasicMessage(newMessage);
}
}
GUISizeHelper.changePopupMenuFont(popupMenuAskNo);
GUISizeHelper.changePopupMenuFont(popupMenuAskYes);
revalidate();
repaint();
}
private void initComponents() {
initPopupMenuTriggerOrder();
setBackground(new Color(0, 0, 0, 100));
//setLayout(new GridBagLayout());
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
// setBorder(new LineBorder(Color.WHITE, 1));
setOpaque(false);
textArea = new MageTextArea();
// textArea.setBorder(new LineBorder(Color.GREEN, 1));
textArea.setText("<Empty>");
add(textArea);
buttonContainer = new JPanel();
// buttonContainer.setBorder(new LineBorder(Color.RED, 1));
buttonContainer.setPreferredSize(new Dimension(100, 30));
buttonContainer.setMinimumSize(new Dimension(20, 20));
buttonContainer.setMaximumSize(new Dimension(2000, 100));
buttonContainer.setLayout(new GridBagLayout());
buttonContainer.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 0));
buttonContainer.setOpaque(false);
JPanel jPanel = new JPanel();
textArea = new MageTextArea();
textArea.setText("<Empty>");
jPanel.setOpaque(false);
jPanel.setBackground(new Color(0, 0, 0, 80));
jPanel.add(textArea);
add(jPanel);
add(buttonContainer);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
btnSpecial = new JButton("Special");
btnSpecial.setVisible(false);
buttonContainer.add(btnSpecial);
btnLeft = new JButton("OK");
btnLeft.setVisible(false);
buttonContainer.add(btnLeft);
btnRight = new JButton("Cancel");
btnRight.setVisible(false);
buttonContainer.add(btnRight);
btnUndo = new JButton("Undo");
btnUndo.setVisible(false);
buttonContainer.add(btnUndo);

View file

@ -57,6 +57,8 @@ public class GUISizeHelper {
public static int gameDialogAreaFontSizeSmall = 11;
public static int gameDialogAreaButtonHigh = 16;
public static Font gameDialogAreaFont = new java.awt.Font("Arial", 0, 12);
public static int gameDialogButtonHeight;
public static int gameDialogButtonWidth;
public static Dimension handCardDimension;
public static int stackWidth;
@ -111,7 +113,9 @@ public class GUISizeHelper {
gameDialogAreaFontSizeTooltip = feedbackFontSize - 2;
gameDialogAreaFontSizeSmall = (feedbackFontSize / 2) + 2;
gameDialogAreaButtonHigh = feedbackFontSize;
gameDialogAreaFont = new Font("Arial", 0, dialogFontSize);
gameDialogAreaFont = new Font("Arial", 0, feedbackFontSize);
gameDialogButtonHeight = feedbackFontSize + 6;
gameDialogButtonWidth = feedbackFontSize * 2 + 40;
int chatFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CHAT_FONT_SIZE, 14);
chatFont = new java.awt.Font("Arial", 0, chatFontSize);