forked from External/mage
Some more changes to GUI to better support high screen resolutions.
This commit is contained in:
parent
a2d4c4738a
commit
1835671f3d
22 changed files with 1366 additions and 859 deletions
|
|
@ -24,20 +24,22 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* ErrorDialog.java
|
||||
*
|
||||
* Created on Dec 23, 2009, 11:01:32 AM
|
||||
*/
|
||||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.remote.Session;
|
||||
import mage.view.UserRequestMessage;
|
||||
|
||||
/**
|
||||
|
|
@ -48,15 +50,43 @@ public class UserRequestDialog extends MageDialog {
|
|||
|
||||
private UserRequestMessage userRequestMessage;
|
||||
|
||||
/** Creates new form AskDialog */
|
||||
/**
|
||||
* Creates new form AskDialog
|
||||
*/
|
||||
public UserRequestDialog() {
|
||||
initComponents();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
Font font = GUISizeHelper.gameRequestsFont;
|
||||
lblText.setFont(font);
|
||||
lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
|
||||
lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
|
||||
lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
|
||||
btn1.setFont(font);
|
||||
btn1.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn1.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn1.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn2.setFont(font);
|
||||
btn2.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn2.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn2.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn3.setFont(font);
|
||||
btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
JComponent c = (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) this.getUI()).getNorthPane();
|
||||
c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
|
||||
c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
|
||||
c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
|
||||
c.setFont(font);
|
||||
}
|
||||
|
||||
public void showDialog(UserRequestMessage userRequestMessage) {
|
||||
this.userRequestMessage = userRequestMessage;
|
||||
this.setTitle(userRequestMessage.getTitel());
|
||||
String text = "<html><p style=\"text-align:center; margin-left:50px; margin-right:50px\">" + userRequestMessage.getMessage() + "</p></html>";
|
||||
String text = "<html><p style=\"text-align:center; margin-left:10px; margin-right:10px\">" + userRequestMessage.getMessage() + "</p></html>";
|
||||
this.lblText.setText(text);
|
||||
if (userRequestMessage.getButton1Text() != null) {
|
||||
this.btn1.setText(userRequestMessage.getButton1Text());
|
||||
|
|
@ -80,10 +110,10 @@ public class UserRequestDialog extends MageDialog {
|
|||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -99,8 +129,14 @@ public class UserRequestDialog extends MageDialog {
|
|||
|
||||
lblText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lblText.setText("message to the user");
|
||||
lblText.setMaximumSize(new java.awt.Dimension(400, 60));
|
||||
lblText.setMinimumSize(new java.awt.Dimension(400, 60));
|
||||
lblText.setPreferredSize(new java.awt.Dimension(400, 60));
|
||||
|
||||
btn3.setText("btn3");
|
||||
btn3.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||
btn3.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||
btn3.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||
btn3.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btn3ActionPerformed(evt);
|
||||
|
|
@ -108,6 +144,9 @@ public class UserRequestDialog extends MageDialog {
|
|||
});
|
||||
|
||||
btn2.setText("btn2");
|
||||
btn2.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||
btn2.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||
btn2.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||
btn2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btn2ActionPerformed(evt);
|
||||
|
|
@ -115,6 +154,9 @@ public class UserRequestDialog extends MageDialog {
|
|||
});
|
||||
|
||||
btn1.setText("btn1");
|
||||
btn1.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||
btn1.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||
btn1.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||
btn1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btn1ActionPerformed(evt);
|
||||
|
|
@ -130,24 +172,24 @@ public class UserRequestDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(0, 289, Short.MAX_VALUE)
|
||||
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
|
||||
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btn1)
|
||||
.addComponent(btn2)
|
||||
.addComponent(btn3))
|
||||
.addComponent(btn1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btn2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btn3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(12, 12, 12))
|
||||
);
|
||||
|
||||
|
|
@ -176,10 +218,7 @@ public class UserRequestDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btn3ActionPerformed
|
||||
|
||||
private void sendUserReplay(PlayerAction playerAction) {
|
||||
Session session = MageFrame.getSession();
|
||||
if (session != null && playerAction != null) {
|
||||
session.sendPlayerAction(playerAction, userRequestMessage.getGameId(), userRequestMessage.getRelatedUserId());
|
||||
}
|
||||
MageFrame.getInstance().sendUserReplay(playerAction, userRequestMessage);
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue