mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
UI: fixed rare error with game end dialog;
This commit is contained in:
parent
e768c375dc
commit
4c55fe701e
1 changed files with 276 additions and 277 deletions
|
@ -1,326 +1,325 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GameEndDialog.java
|
* GameEndDialog.java
|
||||||
*
|
*
|
||||||
* Created on Jul 31, 2013, 9:41:00 AM
|
* Created on Jul 31, 2013, 9:41:00 AM
|
||||||
*/
|
*/
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
import java.awt.Color;
|
import mage.client.MageFrame;
|
||||||
import java.awt.Image;
|
import mage.client.game.GamePanel;
|
||||||
import java.awt.Rectangle;
|
import mage.client.util.Format;
|
||||||
import java.awt.image.BufferedImage;
|
import mage.client.util.ImageHelper;
|
||||||
import java.io.File;
|
import mage.client.util.audio.AudioManager;
|
||||||
import java.io.FileNotFoundException;
|
import mage.client.util.gui.BufferedImageBuilder;
|
||||||
import java.io.PrintWriter;
|
import mage.view.GameEndView;
|
||||||
import java.text.DateFormat;
|
import mage.view.PlayerView;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.game.GamePanel;
|
|
||||||
import mage.client.util.Format;
|
|
||||||
import mage.client.util.ImageHelper;
|
|
||||||
import mage.client.util.audio.AudioManager;
|
|
||||||
import mage.client.util.gui.BufferedImageBuilder;
|
|
||||||
import mage.view.GameEndView;
|
|
||||||
import mage.view.PlayerView;
|
|
||||||
|
|
||||||
/**
|
import javax.swing.*;
|
||||||
*
|
import java.awt.*;
|
||||||
* @author LevelX2
|
import java.awt.image.BufferedImage;
|
||||||
*/
|
import java.io.File;
|
||||||
public class GameEndDialog extends MageDialog {
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
private final DateFormat df = DateFormat.getDateTimeInstance();
|
/**
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class GameEndDialog extends MageDialog {
|
||||||
|
|
||||||
/**
|
private final DateFormat df = DateFormat.getDateTimeInstance();
|
||||||
* Creates new form GameEndDialog
|
|
||||||
*
|
|
||||||
* @param gameEndView
|
|
||||||
*/
|
|
||||||
public GameEndDialog(GameEndView gameEndView) {
|
|
||||||
|
|
||||||
initComponents();
|
/**
|
||||||
this.modal = true;
|
* Creates new form GameEndDialog
|
||||||
|
*
|
||||||
|
* @param gameEndView
|
||||||
|
*/
|
||||||
|
public GameEndDialog(GameEndView gameEndView) {
|
||||||
|
|
||||||
pnlText.setOpaque(true);
|
initComponents();
|
||||||
pnlText.setBackground(new Color(240, 240, 240, 140));
|
this.modal = true;
|
||||||
|
|
||||||
Rectangle r = new Rectangle(610, 250);
|
pnlText.setOpaque(true);
|
||||||
Image image = ImageHelper.getImageFromResources(gameEndView.hasWon() ? "/game_won.jpg" : "/game_lost.jpg");
|
pnlText.setBackground(new Color(240, 240, 240, 140));
|
||||||
BufferedImage imageResult = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
|
||||||
ImageIcon icon = new ImageIcon(imageResult);
|
|
||||||
lblResultImage.setIcon(icon);
|
|
||||||
|
|
||||||
this.lblGameInfo.setText(gameEndView.getGameInfo());
|
Rectangle r = new Rectangle(610, 250);
|
||||||
this.lblMatchInfo.setText(gameEndView.getMatchInfo());
|
Image image = ImageHelper.getImageFromResources(gameEndView.hasWon() ? "/game_won.jpg" : "/game_lost.jpg");
|
||||||
this.lblAdditionalInfo.setText(gameEndView.getAdditionalInfo());
|
BufferedImage imageResult = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||||
|
ImageIcon icon = new ImageIcon(imageResult);
|
||||||
|
lblResultImage.setIcon(icon);
|
||||||
|
|
||||||
String autoSave = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_LOG_AUTO_SAVE, "true");
|
this.lblGameInfo.setText(gameEndView.getGameInfo());
|
||||||
if (autoSave.equals("true")) {
|
this.lblMatchInfo.setText(gameEndView.getMatchInfo());
|
||||||
this.saveGameLog(gameEndView);
|
this.lblAdditionalInfo.setText(gameEndView.getAdditionalInfo());
|
||||||
}
|
|
||||||
|
|
||||||
// game duration
|
String autoSave = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_LOG_AUTO_SAVE, "true");
|
||||||
txtDurationGame.setText(" " + Format.getDuration(gameEndView.getStartTime(), gameEndView.getEndTime()));
|
if (autoSave.equals("true")) {
|
||||||
txtDurationGame.setToolTipText(new StringBuilder(df.format(gameEndView.getStartTime())).append(" - ").append(df.format(gameEndView.getEndTime())).toString());
|
this.saveGameLog(gameEndView);
|
||||||
|
}
|
||||||
|
|
||||||
// match duration
|
// game duration
|
||||||
Calendar cal = Calendar.getInstance();
|
txtDurationGame.setText(" " + Format.getDuration(gameEndView.getStartTime(), gameEndView.getEndTime()));
|
||||||
txtDurationMatch.setText(" " + Format.getDuration(gameEndView.getMatchView().getStartTime(), cal.getTime()));
|
txtDurationGame.setToolTipText(new StringBuilder(df.format(gameEndView.getStartTime())).append(" - ").append(df.format(gameEndView.getEndTime())).toString());
|
||||||
txtDurationMatch.setToolTipText(new StringBuilder(df.format(gameEndView.getMatchView().getStartTime())).append(" - ").append(df.format(cal.getTime())).toString());
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(" ");
|
// match duration
|
||||||
for (PlayerView player : gameEndView.getPlayers()) {
|
Calendar cal = Calendar.getInstance();
|
||||||
sb.append(player.getName()).append(" Life: ").append(player.getLife()).append(' ');
|
txtDurationMatch.setText(" " + Format.getDuration(gameEndView.getMatchView().getStartTime(), cal.getTime()));
|
||||||
}
|
txtDurationMatch.setToolTipText(new StringBuilder(df.format(gameEndView.getMatchView().getStartTime())).append(" - ").append(df.format(cal.getTime())).toString());
|
||||||
this.txtLife.setText(sb.toString());
|
|
||||||
|
|
||||||
if (gameEndView.hasWon()) {
|
StringBuilder sb = new StringBuilder(" ");
|
||||||
AudioManager.playPlayerWon();
|
for (PlayerView player : gameEndView.getPlayers()) {
|
||||||
} else {
|
sb.append(player.getName()).append(" Life: ").append(player.getLife()).append(' ');
|
||||||
AudioManager.playPlayerLost();
|
}
|
||||||
}
|
this.txtLife.setText(sb.toString());
|
||||||
|
|
||||||
txtMatchScore.setText(gameEndView.getMatchView().getResult());
|
if (gameEndView.hasWon()) {
|
||||||
}
|
AudioManager.playPlayerWon();
|
||||||
|
} else {
|
||||||
|
AudioManager.playPlayerLost();
|
||||||
|
}
|
||||||
|
|
||||||
private void saveGameLog(GameEndView gameEndView) {
|
txtMatchScore.setText(gameEndView.getMatchView().getResult());
|
||||||
String dir = "gamelogs";
|
}
|
||||||
File saveDir = new File(dir);
|
|
||||||
//Here comes the existence check
|
|
||||||
if (!saveDir.exists()) {
|
|
||||||
saveDir.mkdirs();
|
|
||||||
}
|
|
||||||
// get game log
|
|
||||||
try {
|
|
||||||
GamePanel gamePanel = MageFrame.getGame(gameEndView.getMatchView().getGames().get(gameEndView.getMatchView().getGames().size() - 1));
|
|
||||||
if (gamePanel != null) {
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
|
||||||
sdf.applyPattern("yyyyMMdd_HHmmss");
|
|
||||||
String fileName = new StringBuilder(dir).append(File.separator)
|
|
||||||
.append(sdf.format(gameEndView.getStartTime()))
|
|
||||||
.append('_').append(gameEndView.getMatchView().getGameType())
|
|
||||||
.append('_').append(gameEndView.getMatchView().getGames().size())
|
|
||||||
.append(".txt").toString();
|
|
||||||
PrintWriter out = new PrintWriter(fileName);
|
|
||||||
out.print(gamePanel.getGameLog());
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
} catch (FileNotFoundException ex) {
|
|
||||||
JOptionPane.showMessageDialog(this, "Error while writing game log to file\n\n" + ex, "Error writing gamelog", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
private void saveGameLog(GameEndView gameEndView) {
|
||||||
|
String dir = "gamelogs";
|
||||||
|
File saveDir = new File(dir);
|
||||||
|
//Here comes the existence check
|
||||||
|
if (!saveDir.exists()) {
|
||||||
|
saveDir.mkdirs();
|
||||||
|
}
|
||||||
|
// get game log
|
||||||
|
try {
|
||||||
|
if (gameEndView.getMatchView().getGames().size() > 0) {
|
||||||
|
GamePanel gamePanel = MageFrame.getGame(gameEndView.getMatchView().getGames().get(gameEndView.getMatchView().getGames().size() - 1));
|
||||||
|
if (gamePanel != null) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||||
|
sdf.applyPattern("yyyyMMdd_HHmmss");
|
||||||
|
String fileName = new StringBuilder(dir).append(File.separator)
|
||||||
|
.append(sdf.format(gameEndView.getStartTime()))
|
||||||
|
.append('_').append(gameEndView.getMatchView().getGameType())
|
||||||
|
.append('_').append(gameEndView.getMatchView().getGames().size())
|
||||||
|
.append(".txt").toString();
|
||||||
|
PrintWriter out = new PrintWriter(fileName);
|
||||||
|
out.print(gamePanel.getGameLog());
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
JOptionPane.showMessageDialog(this, "Error while writing game log to file\n\n" + ex, "Error writing gamelog", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
public void showDialog() {
|
}
|
||||||
this.setLocation(100, 100);
|
|
||||||
this.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void showDialog() {
|
||||||
* This method is called from within the constructor to initialize the form.
|
this.setLocation(100, 100);
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
this.setVisible(true);
|
||||||
* regenerated by the Form Editor.
|
}
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
jPanel2 = new javax.swing.JPanel();
|
/**
|
||||||
tabPane = new javax.swing.JTabbedPane();
|
* This method is called from within the constructor to initialize the form.
|
||||||
tabResult = new javax.swing.JLayeredPane();
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
pnlText = new javax.swing.JLayeredPane();
|
* regenerated by the Form Editor.
|
||||||
lblGameInfo = new javax.swing.JLabel();
|
*/
|
||||||
lblMatchInfo = new javax.swing.JLabel();
|
@SuppressWarnings("unchecked")
|
||||||
lblAdditionalInfo = new javax.swing.JLabel();
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
lblResultImage = new javax.swing.JLabel();
|
private void initComponents() {
|
||||||
tabStatistics = new javax.swing.JPanel();
|
|
||||||
lblDurationGame = new javax.swing.JLabel();
|
|
||||||
txtDurationGame = new javax.swing.JLabel();
|
|
||||||
lblLife = new javax.swing.JLabel();
|
|
||||||
txtLife = new javax.swing.JLabel();
|
|
||||||
lblDurationMatch = new javax.swing.JLabel();
|
|
||||||
txtDurationMatch = new javax.swing.JLabel();
|
|
||||||
lblMatchScore = new javax.swing.JLabel();
|
|
||||||
txtMatchScore = new javax.swing.JLabel();
|
|
||||||
lblPlayerInfo = new javax.swing.JLabel();
|
|
||||||
txtPlayerInfo = new javax.swing.JLabel();
|
|
||||||
btnOk = new javax.swing.JButton();
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
jPanel2 = new javax.swing.JPanel();
|
||||||
jPanel2.setLayout(jPanel2Layout);
|
tabPane = new javax.swing.JTabbedPane();
|
||||||
jPanel2Layout.setHorizontalGroup(
|
tabResult = new javax.swing.JLayeredPane();
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
pnlText = new javax.swing.JLayeredPane();
|
||||||
.addGap(0, 100, Short.MAX_VALUE)
|
lblGameInfo = new javax.swing.JLabel();
|
||||||
);
|
lblMatchInfo = new javax.swing.JLabel();
|
||||||
jPanel2Layout.setVerticalGroup(
|
lblAdditionalInfo = new javax.swing.JLabel();
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
lblResultImage = new javax.swing.JLabel();
|
||||||
.addGap(0, 100, Short.MAX_VALUE)
|
tabStatistics = new javax.swing.JPanel();
|
||||||
);
|
lblDurationGame = new javax.swing.JLabel();
|
||||||
|
txtDurationGame = new javax.swing.JLabel();
|
||||||
|
lblLife = new javax.swing.JLabel();
|
||||||
|
txtLife = new javax.swing.JLabel();
|
||||||
|
lblDurationMatch = new javax.swing.JLabel();
|
||||||
|
txtDurationMatch = new javax.swing.JLabel();
|
||||||
|
lblMatchScore = new javax.swing.JLabel();
|
||||||
|
txtMatchScore = new javax.swing.JLabel();
|
||||||
|
lblPlayerInfo = new javax.swing.JLabel();
|
||||||
|
txtPlayerInfo = new javax.swing.JLabel();
|
||||||
|
btnOk = new javax.swing.JButton();
|
||||||
|
|
||||||
setTitle("Game end information");
|
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||||
|
jPanel2.setLayout(jPanel2Layout);
|
||||||
|
jPanel2Layout.setHorizontalGroup(
|
||||||
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 100, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
jPanel2Layout.setVerticalGroup(
|
||||||
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 100, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
|
||||||
pnlText.setBackground(new java.awt.Color(200, 100, 100));
|
setTitle("Game end information");
|
||||||
pnlText.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
|
||||||
pnlText.setOpaque(true);
|
|
||||||
|
|
||||||
lblGameInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
pnlText.setBackground(new java.awt.Color(200, 100, 100));
|
||||||
lblGameInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
pnlText.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
lblGameInfo.setText("gameInfo");
|
pnlText.setOpaque(true);
|
||||||
pnlText.add(lblGameInfo);
|
|
||||||
lblGameInfo.setBounds(11, 1, 550, 25);
|
|
||||||
|
|
||||||
lblMatchInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
lblGameInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
||||||
lblMatchInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
lblGameInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
lblMatchInfo.setText("matchInfo");
|
lblGameInfo.setText("gameInfo");
|
||||||
pnlText.add(lblMatchInfo);
|
pnlText.add(lblGameInfo);
|
||||||
lblMatchInfo.setBounds(10, 30, 550, 25);
|
lblGameInfo.setBounds(11, 1, 550, 25);
|
||||||
|
|
||||||
lblAdditionalInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
lblMatchInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
||||||
lblAdditionalInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
lblMatchInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
lblAdditionalInfo.setText("additionalInfo");
|
lblMatchInfo.setText("matchInfo");
|
||||||
pnlText.add(lblAdditionalInfo);
|
pnlText.add(lblMatchInfo);
|
||||||
lblAdditionalInfo.setBounds(10, 60, 550, 25);
|
lblMatchInfo.setBounds(10, 30, 550, 25);
|
||||||
|
|
||||||
tabResult.add(pnlText);
|
lblAdditionalInfo.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
|
||||||
pnlText.setBounds(20, 150, 570, 90);
|
lblAdditionalInfo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
|
lblAdditionalInfo.setText("additionalInfo");
|
||||||
|
pnlText.add(lblAdditionalInfo);
|
||||||
|
lblAdditionalInfo.setBounds(10, 60, 550, 25);
|
||||||
|
|
||||||
lblResultImage.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
|
tabResult.add(pnlText);
|
||||||
lblResultImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
pnlText.setBounds(20, 150, 570, 90);
|
||||||
tabResult.add(lblResultImage);
|
|
||||||
lblResultImage.setBounds(0, 0, 610, 250);
|
|
||||||
|
|
||||||
tabPane.addTab("Result", tabResult);
|
lblResultImage.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
|
||||||
|
lblResultImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
|
tabResult.add(lblResultImage);
|
||||||
|
lblResultImage.setBounds(0, 0, 610, 250);
|
||||||
|
|
||||||
lblDurationGame.setText("Duration game:");
|
tabPane.addTab("Result", tabResult);
|
||||||
|
|
||||||
txtDurationGame.setText("Duration Game");
|
lblDurationGame.setText("Duration game:");
|
||||||
txtDurationGame.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
|
||||||
|
|
||||||
lblLife.setText("Life at end:");
|
txtDurationGame.setText("Duration Game");
|
||||||
|
txtDurationGame.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
txtLife.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
lblLife.setText("Life at end:");
|
||||||
|
|
||||||
lblDurationMatch.setText("Duration match:");
|
txtLife.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
txtDurationMatch.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
lblDurationMatch.setText("Duration match:");
|
||||||
|
|
||||||
lblMatchScore.setText("Match score:");
|
txtDurationMatch.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
txtMatchScore.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
lblMatchScore.setText("Match score:");
|
||||||
|
|
||||||
lblPlayerInfo.setText("Player info:");
|
txtMatchScore.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
txtPlayerInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
lblPlayerInfo.setText("Player info:");
|
||||||
|
|
||||||
javax.swing.GroupLayout tabStatisticsLayout = new javax.swing.GroupLayout(tabStatistics);
|
txtPlayerInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
tabStatistics.setLayout(tabStatisticsLayout);
|
|
||||||
tabStatisticsLayout.setHorizontalGroup(
|
|
||||||
tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(lblDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(lblMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(lblDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(txtPlayerInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(txtDurationGame, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE)
|
|
||||||
.addComponent(txtLife, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
|
||||||
.addComponent(txtDurationMatch, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
|
||||||
.addComponent(txtMatchScore, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
tabStatisticsLayout.setVerticalGroup(
|
|
||||||
tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lblDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(txtDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(txtLife, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lblDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(txtDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lblMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(txtMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(txtPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addContainerGap(105, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
|
|
||||||
tabPane.addTab("Statistics", tabStatistics);
|
javax.swing.GroupLayout tabStatisticsLayout = new javax.swing.GroupLayout(tabStatistics);
|
||||||
|
tabStatistics.setLayout(tabStatisticsLayout);
|
||||||
|
tabStatisticsLayout.setHorizontalGroup(
|
||||||
|
tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lblDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lblMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lblDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(txtPlayerInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(txtDurationGame, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE)
|
||||||
|
.addComponent(txtLife, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
||||||
|
.addComponent(txtDurationMatch, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
|
||||||
|
.addComponent(txtMatchScore, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE))
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
tabStatisticsLayout.setVerticalGroup(
|
||||||
|
tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(tabStatisticsLayout.createSequentialGroup()
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(lblDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(txtDurationGame, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
|
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(txtLife, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
|
.addComponent(lblDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(txtDurationMatch, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
|
.addComponent(lblMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(txtMatchScore, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(tabStatisticsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(lblPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(txtPlayerInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addContainerGap(105, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
|
|
||||||
btnOk.setText("OK");
|
tabPane.addTab("Statistics", tabStatistics);
|
||||||
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
btnOk.setText("OK");
|
||||||
getContentPane().setLayout(layout);
|
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
||||||
layout.setHorizontalGroup(
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
btnOkActionPerformed(evt);
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
}
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
});
|
||||||
.addComponent(btnOk)
|
|
||||||
.addContainerGap())
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 626, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(btnOk)
|
|
||||||
.addGap(0, 8, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
|
|
||||||
pack();
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
getContentPane().setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(btnOk)
|
||||||
|
.addContainerGap())
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 626, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(btnOk)
|
||||||
|
.addGap(0, 8, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
|
|
||||||
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
|
pack();
|
||||||
this.removeDialog();
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
}//GEN-LAST:event_btnOkActionPerformed
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
|
||||||
private javax.swing.JButton btnOk;
|
this.removeDialog();
|
||||||
private javax.swing.JPanel jPanel2;
|
}//GEN-LAST:event_btnOkActionPerformed
|
||||||
private javax.swing.JLabel lblAdditionalInfo;
|
|
||||||
private javax.swing.JLabel lblDurationGame;
|
|
||||||
private javax.swing.JLabel lblDurationMatch;
|
|
||||||
private javax.swing.JLabel lblGameInfo;
|
|
||||||
private javax.swing.JLabel lblLife;
|
|
||||||
private javax.swing.JLabel lblMatchInfo;
|
|
||||||
private javax.swing.JLabel lblMatchScore;
|
|
||||||
private javax.swing.JLabel lblPlayerInfo;
|
|
||||||
private javax.swing.JLabel lblResultImage;
|
|
||||||
private javax.swing.JLayeredPane pnlText;
|
|
||||||
private javax.swing.JTabbedPane tabPane;
|
|
||||||
private javax.swing.JLayeredPane tabResult;
|
|
||||||
private javax.swing.JPanel tabStatistics;
|
|
||||||
private javax.swing.JLabel txtDurationGame;
|
|
||||||
private javax.swing.JLabel txtDurationMatch;
|
|
||||||
private javax.swing.JLabel txtLife;
|
|
||||||
private javax.swing.JLabel txtMatchScore;
|
|
||||||
private javax.swing.JLabel txtPlayerInfo;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
|
|
||||||
}
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton btnOk;
|
||||||
|
private javax.swing.JPanel jPanel2;
|
||||||
|
private javax.swing.JLabel lblAdditionalInfo;
|
||||||
|
private javax.swing.JLabel lblDurationGame;
|
||||||
|
private javax.swing.JLabel lblDurationMatch;
|
||||||
|
private javax.swing.JLabel lblGameInfo;
|
||||||
|
private javax.swing.JLabel lblLife;
|
||||||
|
private javax.swing.JLabel lblMatchInfo;
|
||||||
|
private javax.swing.JLabel lblMatchScore;
|
||||||
|
private javax.swing.JLabel lblPlayerInfo;
|
||||||
|
private javax.swing.JLabel lblResultImage;
|
||||||
|
private javax.swing.JLayeredPane pnlText;
|
||||||
|
private javax.swing.JTabbedPane tabPane;
|
||||||
|
private javax.swing.JLayeredPane tabResult;
|
||||||
|
private javax.swing.JPanel tabStatistics;
|
||||||
|
private javax.swing.JLabel txtDurationGame;
|
||||||
|
private javax.swing.JLabel txtDurationMatch;
|
||||||
|
private javax.swing.JLabel txtLife;
|
||||||
|
private javax.swing.JLabel txtMatchScore;
|
||||||
|
private javax.swing.JLabel txtPlayerInfo;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue