Playing with Client UI.

This commit is contained in:
magenoxx 2011-06-08 21:18:09 +04:00
parent 588f173254
commit b2ba439a48
3 changed files with 72 additions and 18 deletions

View file

@ -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'><b><center>");
text = text.replaceAll("#([^#]+)#", "<i>$1</i>");
text = text.replaceAll("\\s*//\\s*", "<hr width='50%'>");
@ -55,7 +55,7 @@ public class MageTextArea extends JEditorPane {
buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, smallImages));
}
buffer.append("</body></html>");
buffer.append("</b></center></body></html>");
SwingUtilities.invokeLater(new Runnable() {
public void run() {

View file

@ -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 {
);
}// </editor-fold>//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();

View file

@ -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);
}