forked from External/mage
Sizable GUI - game dialog area elements resize now.
This commit is contained in:
parent
e15807b9ed
commit
249d709cc7
4 changed files with 40 additions and 28 deletions
|
|
@ -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);
|
||||
|
||||
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.setOpaque(false);
|
||||
|
||||
JPanel jPanel = new JPanel();
|
||||
|
||||
textArea = new MageTextArea();
|
||||
// textArea.setBorder(new LineBorder(Color.GREEN, 1));
|
||||
textArea.setText("<Empty>");
|
||||
add(textArea);
|
||||
|
||||
jPanel.setOpaque(false);
|
||||
jPanel.setBackground(new Color(0, 0, 0, 80));
|
||||
jPanel.add(textArea);
|
||||
add(jPanel);
|
||||
|
||||
buttonContainer = new JPanel();
|
||||
// buttonContainer.setBorder(new LineBorder(Color.RED, 1));
|
||||
buttonContainer.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 0));
|
||||
buttonContainer.setOpaque(false);
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue