From b2ba439a48290a367d6abe8d3906969f21b18db1 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 8 Jun 2011 21:18:09 +0400 Subject: [PATCH] Playing with Client UI. --- .../mage/client/components/MageTextArea.java | 6 +- .../java/mage/client/game/FeedbackPanel.java | 68 ++++++++++++++++--- .../main/java/mage/client/game/GamePanel.java | 16 +++-- 3 files changed, 72 insertions(+), 18 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java index b59c21e056..bb097524bf 100644 --- a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java +++ b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java @@ -32,7 +32,7 @@ public class MageTextArea extends JEditorPane { if (text == null) return; boolean smallImages = false; - int fontSize = 12; + int fontSize = 18; String fontFamily = "arial"; @@ -41,7 +41,7 @@ public class MageTextArea extends JEditorPane { buffer.append(fontFamily); buffer.append(";font-size:"); buffer.append(fontSize); - buffer.append("pt;margin:3px 3px 3px 3px'>"); + buffer.append("pt;margin:3px 3px 3px 3px;color: #FFFFFF'>
"); text = text.replaceAll("#([^#]+)#", "$1"); text = text.replaceAll("\\s*//\\s*", "
"); @@ -55,7 +55,7 @@ public class MageTextArea extends JEditorPane { buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, smallImages)); } - buffer.append(""); + buffer.append("
"); SwingUtilities.invokeLater(new Runnable() { public void run() { diff --git a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java index 4ffa4d166a..eacc3035c6 100644 --- a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java @@ -34,21 +34,18 @@ package mage.client.game; -import java.awt.AWTEvent; -import java.awt.ActiveEvent; -import java.awt.Component; -import java.awt.EventQueue; -import java.awt.MenuComponent; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.io.Serializable; import java.util.Map; import java.util.UUID; -import javax.swing.SwingUtilities; +import javax.swing.*; import mage.client.MageFrame; import mage.client.components.MageTextArea; +import mage.client.components.arcane.GlowText; import mage.remote.Session; import org.apache.log4j.Logger; @@ -72,8 +69,9 @@ public class FeedbackPanel extends javax.swing.JPanel { /** Creates new form FeedbackPanel */ public FeedbackPanel() { - initComponents(); - } + //initComponents(); + customInitComponents(); + } public void init(UUID gameId) { this.gameId = gameId; @@ -282,6 +280,60 @@ public class FeedbackPanel extends javax.swing.JPanel { ); }// //GEN-END:initComponents + public void customInitComponents() { + btnRight = new javax.swing.JButton(); + btnLeft = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + lblMessage = new MageTextArea(); + btnSpecial = new javax.swing.JButton(); + + setBackground(new java.awt.Color(0,0,0,80)); + + btnRight.setText("Cancel"); + btnRight.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnRightActionPerformed(evt); + } + }); + + btnLeft.setText("OK"); + btnLeft.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnLeftActionPerformed(evt); + } + }); + + jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + + lblMessage.setBorder(null); + jScrollPane1.setViewportView(lblMessage); + jScrollPane1.setBorder(null); + + btnSpecial.setText("Special"); + btnSpecial.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSpecialActionPerformed(evt); + } + }); + + JLabel jlabel = new JLabel(); + jlabel.setLayout(new BorderLayout()); + jlabel.add(jScrollPane1, BorderLayout.CENTER); + + setLayout(new BorderLayout()); + + JLabel jlabel2 = new JLabel(); + jlabel2.setLayout(new FlowLayout()); + jlabel2.add(btnSpecial); + jlabel2.add(btnLeft); + jlabel2.add(btnRight); + jlabel2.setPreferredSize(new Dimension(0, 35)); + + add(jlabel, BorderLayout.CENTER); + add(jlabel2, BorderLayout.PAGE_END); + } + private void btnRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRightActionPerformed this.selected = true; clear(); diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index d3c27d897d..169bfed0e0 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -629,7 +629,7 @@ public class GamePanel extends javax.swing.JPanel { .addComponent(btnStopWatching) .addContainerGap(62, Short.MAX_VALUE)) .addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) - .addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + //.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) .addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) .addGroup(pnlGameInfoLayout.createSequentialGroup() .addContainerGap() @@ -640,8 +640,8 @@ public class GamePanel extends javax.swing.JPanel { pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlGameInfoLayout.createSequentialGroup() .addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(1, 1, 1) - .addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) + //.addGap(1, 1, 1) + //.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) /*.addGap(7, 7, 7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -770,8 +770,10 @@ public class GamePanel extends javax.swing.JPanel { jPanel.add(hand); HelperPanel helper = new HelperPanel(); - helper.setBackground(new Color(0, 0, 0, 80)); - helper.setPreferredSize(new Dimension(0, 35)); + //helper.setBackground(new Color(0, 0, 0, 80)); + //helper.setPreferredSize(new Dimension(0, 35)); + + feedbackPanel.setPreferredSize(new Dimension(0, 70)); setOpaque(false); jPanel.setOpaque(false); @@ -784,8 +786,8 @@ public class GamePanel extends javax.swing.JPanel { setLayout(new BorderLayout()); add(jScrollPane1, BorderLayout.CENTER); - add(helper, BorderLayout.PAGE_END); - + //add(helper, BorderLayout.PAGE_END); + add(feedbackPanel, BorderLayout.PAGE_END); feedbackPanel.setHelperPanel(helper); }