
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.*;
import java.awt.Toolkit;
import java.io.File;
import javax.imageio.ImageIO;
import java.io.IOException;

public class CardGameGUI extends javax.swing.JFrame {

    /**
     * Creates new form CardGameGUI
     */
    public CardGameGUI() {
        initComponents();
        
    }
    
    /**
     * 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
    private void initComponents() {

        jhand1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButtonStart = new javax.swing.JButton();
        jhand2 = new javax.swing.JLabel();
        jhand3 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabelWindow = new javax.swing.JLabel();
        jLabelDeck = new javax.swing.JLabel();
        jTextFieldDeck = new javax.swing.JTextField();
        jhand4 = new javax.swing.JLabel();
        jfield1 = new javax.swing.JLabel();
        jfield2 = new javax.swing.JLabel();
        jfield3 = new javax.swing.JLabel();
        jfield4 = new javax.swing.JLabel();
        jfield5 = new javax.swing.JLabel();
        jfieldOp1 = new javax.swing.JLabel();
        jfieldOp2 = new javax.swing.JLabel();
        jfieldOp3 = new javax.swing.JLabel();
        jfieldOp4 = new javax.swing.JLabel();
        jfieldOp5 = new javax.swing.JLabel();
        jhandOp1 = new javax.swing.JLabel();
        jhandOp2 = new javax.swing.JLabel();
        jhandOp3 = new javax.swing.JLabel();
        jhandOp4 = new javax.swing.JLabel();
        jhandOp5 = new javax.swing.JLabel();
        jLabelDeckOpp = new javax.swing.JLabel();
        jhand5 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jgraveA = new javax.swing.JLabel();
        jgraveB = new javax.swing.JLabel();
        jTextFieldDeckOp = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("YU_GI_PO!");
        setBackground(new java.awt.Color(255, 153, 51));
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/MediaResources/latest.png")));

        jhand1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhand1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhand1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhand1MouseEntered(evt);
            }
        });

        jTextField1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jTextField1.setToolTipText("");
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jButton1.setText("Exit");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButtonStart.setText("Start");
        jButtonStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonStartActionPerformed(evt);
            }
        });

        jhand2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhand2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhand2MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhand2MouseEntered(evt);
            }
        });

        jhand3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhand3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhand3MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhand3MouseEntered(evt);
            }
        });

        jTextArea1.setColumns(20);
        jTextArea1.setFont(new java.awt.Font("Monospaced", 0, 18)); // NOI18N
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        jLabelWindow.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelWindow.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        jLabelDeck.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelDeck.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelDeckMouseClicked(evt);
            }
        });

        jTextFieldDeck.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jTextFieldDeck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldDeckActionPerformed(evt);
            }
        });

        jhand4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhand4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhand4MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhand4MouseEntered(evt);
            }
        });

        jfield1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfield1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfield1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfield1MouseEntered(evt);
            }
        });

        jfield2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfield2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfield2MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfield2MouseEntered(evt);
            }
        });

        jfield3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfield3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfield3MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfield3MouseEntered(evt);
            }
        });

        jfield4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfield4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfield4MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfield4MouseEntered(evt);
            }
        });

        jfield5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfield5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfield5MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfield5MouseEntered(evt);
            }
        });

        jfieldOp1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfieldOp1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfieldOp1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfieldOp1MouseEntered(evt);
            }
        });

        jfieldOp2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfieldOp2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfieldOp2MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfieldOp2MouseEntered(evt);
            }
        });

        jfieldOp3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfieldOp3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfieldOp3MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfieldOp3MouseEntered(evt);
            }
        });

        jfieldOp4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfieldOp4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfieldOp4MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfieldOp4MouseEntered(evt);
            }
        });

        jfieldOp5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jfieldOp5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jfieldOp5MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jfieldOp5MouseEntered(evt);
            }
        });

        jhandOp1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhandOp1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhandOp1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhandOp1MouseEntered(evt);
            }
        });

        jhandOp2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhandOp2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhandOp2MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhandOp2MouseEntered(evt);
            }
        });

        jhandOp3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhandOp3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhandOp3MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhandOp3MouseEntered(evt);
            }
        });

        jhandOp4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhandOp4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhandOp4MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhandOp4MouseEntered(evt);
            }
        });

        jhandOp5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhandOp5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhandOp5MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhandOp5MouseEntered(evt);
            }
        });

        jLabelDeckOpp.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelDeckOpp.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelDeckOppMouseClicked(evt);
            }
        });

        jhand5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jhand5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jhand5MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jhand5MouseEntered(evt);
            }
        });

        jButton2.setText("Next Phase");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jTextField2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

        jTextField3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

        jgraveA.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jgraveA.setToolTipText("");
        jgraveA.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jgraveAMouseEntered(evt);
            }
        });

        jgraveB.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        jTextFieldDeckOp.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabelWindow, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButtonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(43, 43, 43)
                                .addComponent(jgraveB, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(61, 61, 61)
                                .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelDeckOpp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jTextFieldDeckOp, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(49, 49, 49)))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jhandOp1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jfieldOp1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jfieldOp2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jhandOp2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jhand1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jhand2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jfield1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jfield2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(10, 10, 10)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jhand3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jhand4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jhand5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jfield3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jfield4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jfield5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jLabelDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jgraveA, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(27, 27, 27)
                                .addComponent(jTextFieldDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(29, 29, 29))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(jfieldOp3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jfieldOp4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jfieldOp5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(jhandOp3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jhandOp4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jhandOp5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jhandOp3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jhandOp2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jhandOp1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jhandOp5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelDeckOpp, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jgraveB, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jhandOp4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextFieldDeckOp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jfieldOp3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jfieldOp4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jfieldOp5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jfieldOp2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jfieldOp1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldDeck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField1))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jfield1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jfield3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jfield4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jfield5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jfield2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jgraveA, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jhand1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jhand2, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jhand3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jhand4, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jhand5, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(82, 82, 82))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addComponent(jLabelWindow, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButtonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private static final int FROMHAND = 1;
    private static final int FROMFIELD = 2;
    private static final int FROMOPFIELD = 3;
    private static final int FROMOPHAND = 4;
    private static final int FROMGRAVE = 5;
    private static final int FROMOPGRAVE = 6;
    
    private static final int FACEUP_ATKPOS = 1;
    private static final int FACEUP_DEFPOS = 2;
    private static final int FACEDOWN_DEFPOS = 3;
    
    
    private static final int A = 1;
    private static final int B = 2;
    private static final int NONE = 3;
    
    
        
    private int side;
    private int casilla;
    
            
    Deck deckA;
    Deck deckB;
    Hand handA;
    Hand handB;
    Field fieldA;
    Field fieldB;
    Grave graveA;
    Grave graveB;
    
  
    //Field fieldB;
    GameMaster gm;
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        System.exit(0);
        
    }//GEN-LAST:event_jButton1ActionPerformed
	private ImageIcon resizeCard(int alto, String direccion) {                                         
        ImageIcon imageIcon = new ImageIcon(getClass().getResource( direccion ));
        Image image = imageIcon.getImage();
        Image newimg = image.getScaledInstance((int)(alto/1.43), alto, java.awt.Image.SCALE_SMOOTH);
        return new ImageIcon(newimg); 
    } 
    private void jButtonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStartActionPerformed
        // TODO add your handling code here:
        deckA = new Deck();
        deckB = new Deck();
        //Hand mano;
        handA = new Hand(deckA.getDECK());
        handB = new Hand(deckB.getDECK());
        //fieldA:
        fieldA = new Field();
        fieldB = new Field();
        
        //graveyard:
        graveA = new Grave();
        graveB = new Grave();
        
        //gm = new GameMaster(fieldA, fieldB, handA, handB);
        gm = new GameMaster(fieldA, fieldB, handA, handB, graveA, graveB);
       
        
        updateView();
       
        
        
    }//GEN-LAST:event_jButtonStartActionPerformed
    private void updateView(){
        //deckA:
        ImageIcon ImagenCarta;
        //DeckA:
        if(Integer.parseInt(deckA.deckSize())>0)
        {
            ImagenCarta =  resizeCard(jLabelDeck.getHeight(), "/MediaResources/faceDown.jpg");
            jLabelDeck.setIcon(ImagenCarta);
        }    
            
        else jLabelDeck.setIcon(null);
        //deckB:
        if(Integer.parseInt(deckB.deckSize())>0)
        {
            ImagenCarta =  resizeCard(jLabelDeckOpp.getHeight(), "/MediaResources/faceDown.jpg");
            jLabelDeckOpp.setIcon(ImagenCarta);
        }
        
        else jLabelDeckOpp.setIcon(null);
        //handA:
        if(handA.handSize()>=1)
        {
            ImagenCarta =  resizeCard(jhand1.getHeight(), handA.getCard(0).getCardIDPath());
            jhand1.setIcon(ImagenCarta);
        }        
        else jhand1.setIcon(null);
        if(handA.handSize()>=2)//jhand2.setIcon(new javax.swing.ImageIcon(getClass().getResource(handA.getCard(1).getCardIDPath(1))));
        {
            ImagenCarta =  resizeCard(jhand2.getHeight(), handA.getCard(1).getCardIDPath());
            jhand2.setIcon(ImagenCarta);
        }
        else jhand2.setIcon(null);
        if(handA.handSize()>=3)
        {
            ImagenCarta =  resizeCard(jhand3.getHeight(), handA.getCard(2).getCardIDPath());
            jhand3.setIcon(ImagenCarta);
        }        
        else jhand3.setIcon(null);
        if(handA.handSize()>=4)
        {
            ImagenCarta =  resizeCard(jhand4.getHeight(), handA.getCard(3).getCardIDPath());
            jhand4.setIcon(ImagenCarta);
        }        
        else jhand4.setIcon(null);
        if(handA.handSize()>=5)
        {
            ImagenCarta =  resizeCard(jhand5.getHeight(), handA.getCard(4).getCardIDPath());
            jhand5.setIcon(ImagenCarta);
        }
        else jhand5.setIcon(null);
        //handB:
        if(handB.handSize()>=1)
        {
            ImagenCarta =  resizeCard(jhandOp1.getHeight(), handB.getCard(0).getCardIDPath());
            jhandOp1.setIcon(ImagenCarta);
        }        
        else jhandOp1.setIcon(null);
        if(handB.handSize()>=2)
        {
            ImagenCarta =  resizeCard(jhandOp2.getHeight(), handB.getCard(1).getCardIDPath());
            jhandOp2.setIcon(ImagenCarta);
        }  
                else jhandOp2.setIcon(null);
        if(handB.handSize()>=3)
        {
            ImagenCarta =  resizeCard(jhandOp3.getHeight(), handB.getCard(2).getCardIDPath());
            jhandOp3.setIcon(ImagenCarta);
        } 
        else jhandOp3.setIcon(null);
        if(handB.handSize()>=4)
        {
            ImagenCarta =  resizeCard(jhandOp4.getHeight(), handB.getCard(3).getCardIDPath());
            jhandOp4.setIcon(ImagenCarta);
        } 
        else jhandOp4.setIcon(null);
        if(handB.handSize()>=5)
        {
            ImagenCarta =  resizeCard(jhandOp5.getHeight(), handB.getCard(4).getCardIDPath());
            jhandOp5.setIcon(ImagenCarta);
        }     
        else jhandOp5.setIcon(null);
        //fieldA:
        
        drawCardOnField(jfield1,0,fieldA);
        if((side==A)&(casilla==0)&(gm.getPhase() == gm.SELECT_B)){        
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(0).getCardIDPath()));
            icon = arrowUp(resizeCard(jfield1.getHeight(),fieldA.getCard(0).getCardIDPath()));
            jfield1.setIcon(icon);
        }
        drawCardOnField(jfield2,1,fieldA);
        if((side==A)&casilla==1&(gm.getPhase() == gm.SELECT_B)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(1).getCardIDPath()));
            
           
            icon = arrowUp(resizeCard(jfield2.getHeight(),fieldA.getCard(1).getCardIDPath()));
            jfield2.setIcon(icon);
        }
        drawCardOnField(jfield3,2,fieldA);
        if((side==A)&casilla==2&(gm.getPhase() == gm.SELECT_B)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(2).getCardIDPath()));
            
           
            icon = arrowUp(resizeCard(jfield3.getHeight(),fieldA.getCard(2).getCardIDPath()));
            jfield3.setIcon(icon);
        }
        drawCardOnField(jfield4,3,fieldA);
        if((side==A)&casilla==3&(gm.getPhase() == gm.SELECT_B)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(3).getCardIDPath()));
            
           
            icon = arrowUp(resizeCard(jfield4.getHeight(),fieldA.getCard(3).getCardIDPath()));
            jfield4.setIcon(icon);
        }
        drawCardOnField(jfield5,4,fieldA);
        if((side==A)&casilla==4&(gm.getPhase() == gm.SELECT_B)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(4).getCardIDPath()));
            
           
            icon = arrowUp(resizeCard(jfield5.getHeight(),fieldA.getCard(4).getCardIDPath()));
            jfield5.setIcon(icon);
        }
        
        
        //fieldB:
        drawCardOnField(jfieldOp1,0,fieldB);
        if((side==B)&&(casilla==0)&&(gm.getPhase() == gm.SELECT_A)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldB.getCard(0).getCardIDPath()));
            
           
            icon = arrowDown(resizeCard(jfieldOp1.getHeight(),fieldB.getCard(0).getCardIDPath()));
            jfieldOp1.setIcon(icon);
        }
        drawCardOnField(jfieldOp2,1,fieldB);
        if((side==B)&casilla==1&(gm.getPhase() == gm.SELECT_A)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldB.getCard(1).getCardIDPath()));
            
           
            icon = arrowDown(resizeCard(jfieldOp2.getHeight(),fieldB.getCard(1).getCardIDPath()));
            jfieldOp2.setIcon(icon);
        }
        drawCardOnField(jfieldOp3,2,fieldB);
        if((side==B)&casilla==2&(gm.getPhase() == gm.SELECT_A)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldB.getCard(2).getCardIDPath()));
            
           
            icon = arrowDown(resizeCard(jfieldOp3.getHeight(),fieldB.getCard(2).getCardIDPath()));
            jfieldOp3.setIcon(icon);
        }
        drawCardOnField(jfieldOp4,3,fieldB);
        if((side==B)&casilla==3&(gm.getPhase() == gm.SELECT_A)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldB.getCard(3).getCardIDPath()));
            
           
            icon = arrowDown(resizeCard(jfieldOp4.getHeight(),fieldB.getCard(3).getCardIDPath()));
            jfieldOp4.setIcon(icon);
        }
        drawCardOnField(jfieldOp5,4,fieldB);
        if((side==B)&casilla==4&(gm.getPhase() == gm.SELECT_A)){
            
            ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(fieldB.getCard(4).getCardIDPath()));
            
           
            icon = arrowDown(resizeCard(jfieldOp5.getHeight(),fieldB.getCard(4).getCardIDPath()));
            jfieldOp5.setIcon(icon);
        }
        
        
        //gaveyard:
        if (graveA.graveSize()>0){
            ImagenCarta =  resizeCard(jgraveA.getHeight(), graveA.getCard(graveA.graveSize()-1).getCardIDPath());
            jgraveA.setIcon(ImagenCarta);
        }
        else jgraveA.setIcon(null);
        
        if (graveB.graveSize()>0){
            ImagenCarta =  resizeCard(jgraveB.getHeight(), graveB.getCard(graveB.graveSize()-1).getCardIDPath());
            jgraveB.setIcon(ImagenCarta);
        }
        else jgraveB.setIcon(null);
        
        //jgraveB.setIcon(null);
        //deck counter:
        jTextFieldDeck.setText(deckA.deckSize());
        jTextFieldDeckOp.setText(deckB.deckSize());
        jTextField1.setText(gm.getPhaseStr());
        jTextField2.setText(gm.getHealthA());
        jTextField3.setText(gm.getHealthB());
        
    }
    
    private void drawCardOnField(JLabel jfield,int i,  Field field){
	ImageIcon ImagenCarta;

        
        
        
	if(field.getCard(i) != null){
            if (field.getBattlePos(i)==FACEUP_ATKPOS) {
                ImagenCarta =  resizeCard(jfield.getHeight(), field.getCard(i).getCardIDPath());
                jfield.setIcon(ImagenCarta);
            }
            
           
            else if (field.getBattlePos(i)==FACEUP_DEFPOS) {
                ImagenCarta =  resizeCard(jfield.getHeight(), field.getCard(i).getCardIDPath());
                jfield.setIcon(new javax.swing.ImageIcon(rotImage(ImagenCarta)));//
                
            }
            else if (field.getBattlePos(i)==FACEDOWN_DEFPOS){
                ImagenCarta =  resizeCard(jfield.getHeight(), "/MediaResources/faceDown.jpg");
                //ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("/MediaResources/faceDown.jpg"));
                jfield.setIcon(new javax.swing.ImageIcon(rotImage(ImagenCarta)));
                
            }
        
        }
        
        else jfield.setIcon(null);
        
        
        
        


}
    
    private void detailScreen(int pos, int source){
        if(source==FROMHAND){
            String cardInfo = handA.getCard(pos).getNAME()+"\n"+"ATK: "+Integer.toString(handA.getCard(pos).getATK())+" /DEF: "+Integer.toString(handA.getCard(pos).getDEF())+"\n";
                jTextArea1.setText(cardInfo);
                jLabelWindow.setIcon(new javax.swing.ImageIcon(getClass().getResource(handA.getCard(pos).getCardIDPath())));//mostrar imagen de la carta, modificar luego para que la mano sean miniaturas y esta de tamaño grande
        }
        if(source==FROMFIELD){
            if(fieldA.getCard(pos) == null) return;
            String cardInfo = fieldA.getCard(pos).getNAME()+"\n"+"ATK: "+Integer.toString(fieldA.getCard(pos).getATK())+" /DEF: "+Integer.toString(fieldA.getCard(pos).getDEF())+"\n"+"Battle Position: "+Integer.toString(fieldA.getBattlePos(pos));
                jTextArea1.setText(cardInfo);
                jLabelWindow.setIcon(new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(pos).getCardIDPath())));//mostrar imagen de la carta, modificar luego para que la mano sean miniaturas y esta de tamaño grande
        }
        if(source==FROMGRAVE){
            String cardInfo = graveA.getCard(pos).getNAME()+"\n"+"ATK: "+Integer.toString(graveA.getCard(pos).getATK())+" /DEF: "+Integer.toString(graveA.getCard(pos).getDEF())+"\n";
            jTextArea1.setText(cardInfo);
            jLabelWindow.setIcon(new javax.swing.ImageIcon(getClass().getResource(graveA.getCard(pos).getCardIDPath())));//mostrar imagen de la carta, modificar luego para que la mano sean miniaturas y esta de tamaño grande

        }
        if(source==FROMOPFIELD){
            if(fieldB.getCard(pos) == null) return;
            String cardInfo = fieldB.getCard(pos).getNAME()+"\n"+"ATK: "+Integer.toString(fieldB.getCard(pos).getATK())+" /DEF: "+Integer.toString(fieldB.getCard(pos).getDEF())+"\n"+"Battle Position: "+Integer.toString(fieldB.getBattlePos(pos));
                jTextArea1.setText(cardInfo);
                jLabelWindow.setIcon(new javax.swing.ImageIcon(getClass().getResource(fieldB.getCard(pos).getCardIDPath())));//mostrar imagen de la carta, modificar luego para que la mano sean miniaturas y esta de tamaño grande
        }
        if(source==FROMOPHAND){
            String cardInfo = handB.getCard(pos).getNAME()+"\n"+"ATK: "+Integer.toString(handB.getCard(pos).getATK())+" /DEF: "+Integer.toString(handB.getCard(pos).getDEF())+"\n";
                jTextArea1.setText(cardInfo);
                jLabelWindow.setIcon(new javax.swing.ImageIcon(getClass().getResource(handB.getCard(pos).getCardIDPath())));//mostrar imagen de la carta, modificar luego para que la mano sean miniaturas y esta de tamaño grande
        }
    }
    
    public BufferedImage rotate90ToLeft( BufferedImage inputImage ){
//The most of code is same as before
	int width = inputImage.getWidth();
	int height = inputImage.getHeight();
	BufferedImage returnImage = new BufferedImage( height, width , inputImage.getType()  );
//We have to change the width and height because when you rotate the image by 90 degree, the
//width is height and height is width <img src='http://forum.codecall.net/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />

	for( int x = 0; x < width; x++ ) {
		for( int y = 0; y < height; y++ ) {
                    returnImage.setRGB(y,width-x-1, inputImage.getRGB(x, y));
//Again check the Picture for better understanding
		}
		}
	return returnImage;

}
    
    private BufferedImage rotImage(ImageIcon icon){
        //icon =new javax.swing.ImageIcon(getClass().getResource(campo.getCard(index).getCardIDPath(index)));
        BufferedImage bi = new BufferedImage(
    icon.getIconWidth(),
    icon.getIconHeight(),
    BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bi.createGraphics();
    // paint the Icon to the BufferedImage.
    icon.paintIcon(null, g, 0,0);
    //icon2 = icon;
    g.dispose(); 
    bi=rotate90ToLeft(bi);
    return bi;
}
    
    
    private ImageIcon arrowUp(ImageIcon icon){

    ImageIcon icon2 = resizeCard(icon.getIconHeight(),"/MediaResources/arrow.png");
    Image image1 = icon.getImage(); 
    Image image2  = icon2.getImage();
    int w = icon.getIconWidth() ;//+ image2.width;
    int h = icon.getIconHeight();//Math.max(image1.height, image2.height);
    BufferedImage image = new BufferedImage(w, h,  BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    g2.drawImage(image1, 0, 0, null);
    g2.drawImage(image2, 0, 0, null);
    g2.dispose();

ImageIcon newImg = new ImageIcon(image);

    return newImg;
}
    
    private ImageIcon arrowDown(ImageIcon icon){

    ImageIcon icon2 = resizeCard(icon.getIconHeight(),"/MediaResources/arrowDown.png");
    Image image1 = icon.getImage(); 
    Image image2  = icon2.getImage();
    int w = icon.getIconWidth() ;//+ image2.width;
    int h = icon.getIconHeight();//Math.max(image1.height, image2.height);
    BufferedImage image = new BufferedImage(w, h,  BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    g2.drawImage(image1, 0, 0, null);
    g2.drawImage(image2, 0, 0, null);
    g2.dispose();

ImageIcon newImg = new ImageIcon(image);

    return newImg;
}
    
    private void jhand1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand1MouseEntered
        // TODO add your handling code here:
        if(handA.handSize()>=1){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(0,FROMHAND);
        }
    }//GEN-LAST:event_jhand1MouseEntered

    private void jhand2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand2MouseEntered
        // TODO add your handling code here:
        if(handA.handSize()>=2){
            detailScreen(1,FROMHAND);        }
    }//GEN-LAST:event_jhand2MouseEntered

    private void jhand3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand3MouseEntered
        // TODO add your handling code here:
        if(handA.handSize()>=3){
            detailScreen(2,FROMHAND);        }
    }//GEN-LAST:event_jhand3MouseEntered

    private void jTextFieldDeckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldDeckActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldDeckActionPerformed

    private void jLabelDeckMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDeckMouseClicked
        // TODO add your handling code here:
        if((handA.handSize()<5)&&(Integer.parseInt(deckA.deckSize())>=1)&&(gm.getPhase() == gm.DRAW_A))
        {
            handA.addCard(deckA.getCard(0));
            gm.nextPhase();
            updateView();
        }
        else if((Integer.parseInt(deckA.deckSize())>=1)&&(gm.getPhase() == gm.DRAW_A))
        {
            gm.nextPhase();
            updateView();
        }
        
    }//GEN-LAST:event_jLabelDeckMouseClicked

    private void jhand4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand4MouseEntered
        // TODO add your handling code here:
        if(handA.handSize()>=4){
            detailScreen(3,FROMHAND);
    }//GEN-LAST:event_jhand4MouseEntered
    }
    private void jhand5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand5MouseEntered
        // TODO add your handling code here:
        if(handA.handSize()>=5){
            detailScreen(4,FROMHAND);
        }
    }//GEN-LAST:event_jhand5MouseEntered

    private void jhand1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand1MouseClicked
        // TODO add your handling code here:
        //if(handA.handSize()>=1){
        //    fieldA.playCard(handA.getCard(0), FACEUP_ATKPOS);
        //    handA.removeCard(0);
        //    //jfield1.setIcon(new javax.swing.ImageIcon(getClass().getResource(fieldA.getCard(0).getCardIDPath(0))));
        //    updateView();
        //}
        if(gm.getPhase() == gm.MAIN_A) gm.playCard(evt, 0);
        updateView();
    }//GEN-LAST:event_jhand1MouseClicked

    private void jfield1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield1MouseEntered
        // TODO add your handling code here:
        if(fieldA.getCard(0)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(0,FROMFIELD);
        }
    }//GEN-LAST:event_jfield1MouseEntered

    private void jfield2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield2MouseEntered
        // TODO add your handling code here:
        if(fieldA.getCard(1)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(1,FROMFIELD);
        }
    }//GEN-LAST:event_jfield2MouseEntered

    private void jfield3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield3MouseEntered
        // TODO add your handling code here:
        if(fieldA.getCard(2)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(2,FROMFIELD);
        }
    }//GEN-LAST:event_jfield3MouseEntered

    private void jfield4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield4MouseEntered
        // TODO add your handling code here:
        if(fieldA.getCard(3)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(3,FROMFIELD);
        }
    }//GEN-LAST:event_jfield4MouseEntered

    private void jfield5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield5MouseEntered
        // TODO add your handling code here:
        if(fieldA.getCard(4)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(4,FROMFIELD);
        }
    }//GEN-LAST:event_jfield5MouseEntered

    private void jhand2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand2MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A) gm.playCard(evt, 1);
        updateView();
    }//GEN-LAST:event_jhand2MouseClicked

    private void jfield1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield1MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A)
        {
            fieldA.changeBattlePos(0);
        }
        else if(gm.getPhase() == gm.BATTLE_A)
        {
            gm.selectAttacker(0);
            side = A;
            casilla = 0;
        }
        else if(gm.getPhase() == gm.SELECT_A)
        {
            gm.battle(0);
            side = NONE;
        }
        updateView();
        //codigo temporal para PROBAR los metodos de Field:
        //if(fieldA.getBatPos(0)==1)
    }//GEN-LAST:event_jfield1MouseClicked

    private void jhand3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand3MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A) gm.playCard(evt, 2);
        updateView();
    }//GEN-LAST:event_jhand3MouseClicked

    private void jhand4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand4MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A) gm.playCard(evt, 3);
        updateView();
    }//GEN-LAST:event_jhand4MouseClicked

    private void jhand5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhand5MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A) gm.playCard(evt, 4);
        updateView();
    }//GEN-LAST:event_jhand5MouseClicked

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1ActionPerformed

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
        // TODO add your handling code here:
        if((Integer.parseInt(deckB.deckSize())==0)&&(gm.getPhase() == gm.END_A)) gm.ForceEnd();
        else if((Integer.parseInt(deckA.deckSize())==0)&&(gm.getPhase() == gm.END_B)) gm.ForceEnd();
        
        if((gm.getPhase() != gm.DRAW_B)&&(gm.getPhase() != gm.DRAW_A)) gm.nextPhase();
        updateView();
    }//GEN-LAST:event_jButton2MouseClicked

    private void jfield2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield2MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A)
        {
            fieldA.changeBattlePos(1);
        }
        else if(gm.getPhase() == gm.BATTLE_A)
        {
            gm.selectAttacker(1);
            side = A;
            casilla = 1;
        }
        else if(gm.getPhase() == gm.SELECT_A)
        {
            gm.battle(1);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfield2MouseClicked

    private void jfield3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield3MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A)
        {
            fieldA.changeBattlePos(2);
        }
        else if(gm.getPhase() == gm.BATTLE_A)
        {
            gm.selectAttacker(2);
            side = A;
            casilla = 2;
        }
        else if(gm.getPhase() == gm.SELECT_A)
        {
            gm.battle(2);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfield3MouseClicked

    private void jfield4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield4MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A)
        {
            fieldA.changeBattlePos(3);
        }
        else if(gm.getPhase() == gm.BATTLE_A)
        {
            gm.selectAttacker(3);
            side = A;
            casilla = 3;
        }
        else if(gm.getPhase() == gm.SELECT_A)
        {
            gm.battle(3);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfield4MouseClicked

    private void jfield5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfield5MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_A)
        {
            fieldA.changeBattlePos(4);
        }
        else if(gm.getPhase() == gm.BATTLE_A)
        {
            gm.selectAttacker(4);
            side = A;
            casilla = 4;
        }
        else if(gm.getPhase() == gm.SELECT_A)
        {
            gm.battle(4);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfield5MouseClicked

    private void jhandOp1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp1MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B) gm.playCard(evt, 0);
        updateView();
    }//GEN-LAST:event_jhandOp1MouseClicked

    private void jhandOp2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp2MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B) gm.playCard(evt, 1);
        updateView();
    }//GEN-LAST:event_jhandOp2MouseClicked

    private void jhandOp3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp3MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B) gm.playCard(evt, 2);
        updateView();
    }//GEN-LAST:event_jhandOp3MouseClicked

    private void jhandOp4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp4MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B) gm.playCard(evt, 3);
        updateView();
    }//GEN-LAST:event_jhandOp4MouseClicked

    private void jhandOp5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp5MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B) gm.playCard(evt, 4);
        updateView();
    }//GEN-LAST:event_jhandOp5MouseClicked

    private void jfieldOp1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp1MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B)
        {
            fieldB.changeBattlePos(0);
        }
        else if(gm.getPhase() == gm.BATTLE_B)
        {
            gm.selectAttacker(0);
            side = B;
            casilla = 0;
            
        }
        else if(gm.getPhase() == gm.SELECT_B)
        {
            gm.battle(0);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfieldOp1MouseClicked

    private void jfieldOp2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp2MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B)
        {
            fieldB.changeBattlePos(1);
        }
        else if(gm.getPhase() == gm.BATTLE_B)
        {
            gm.selectAttacker(1);
            side = B;
            casilla = 1;
        }
        else if(gm.getPhase() == gm.SELECT_B)
        {
            gm.battle(1);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfieldOp2MouseClicked

    private void jfieldOp3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp3MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B)
        {
            fieldB.changeBattlePos(2);
        }
        else if(gm.getPhase() == gm.BATTLE_B)
        {
            gm.selectAttacker(2);
            side = B;
            casilla = 2;
        }
        else if(gm.getPhase() == gm.SELECT_B)
        {
            gm.battle(2);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfieldOp3MouseClicked

    private void jfieldOp4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp4MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B)
        {
            fieldB.changeBattlePos(3);
        }
        else if(gm.getPhase() == gm.BATTLE_B)
        {
            gm.selectAttacker(3);
            side = B;
            casilla = 3;
        }
        else if(gm.getPhase() == gm.SELECT_B)
        {
            gm.battle(3);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfieldOp4MouseClicked

    private void jfieldOp5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp5MouseClicked
        // TODO add your handling code here:
        if(gm.getPhase() == gm.MAIN_B)
        {
            fieldB.changeBattlePos(4);
        }
        else if(gm.getPhase() == gm.BATTLE_B)
        {
            gm.selectAttacker(4);
            side = B;
            casilla = 4;
        }
        else if(gm.getPhase() == gm.SELECT_B)
        {
            gm.battle(4);
            side = NONE;
        }
        updateView();
    }//GEN-LAST:event_jfieldOp5MouseClicked

    private void jLabelDeckOppMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDeckOppMouseClicked
        // TODO add your handling code here:
        if((handB.handSize()<5)&&(Integer.parseInt(deckB.deckSize())>=1)&&(gm.getPhase() == gm.DRAW_B))
        {
            handB.addCard(deckB.getCard(0));
            gm.nextPhase();
            updateView();
        }
        else if((Integer.parseInt(deckB.deckSize())>=1)&&(gm.getPhase() == gm.DRAW_B))
        {
            gm.nextPhase();
            updateView();
        }
    }//GEN-LAST:event_jLabelDeckOppMouseClicked

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jgraveAMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jgraveAMouseEntered
        // TODO add your handling code here:
        if(graveA.graveSize()>=1){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(graveA.graveSize()-1,FROMGRAVE);
        }
    }//GEN-LAST:event_jgraveAMouseEntered

    private void jfieldOp1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp1MouseEntered
        // TODO add your handling code here:
        if(fieldB.getCard(0)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(0,FROMOPFIELD);
        }
    }//GEN-LAST:event_jfieldOp1MouseEntered

    private void jfieldOp2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp2MouseEntered
        // TODO add your handling code here:
        if(fieldB.getCard(1)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(1,FROMOPFIELD);
        }
    }//GEN-LAST:event_jfieldOp2MouseEntered

    private void jfieldOp3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp3MouseEntered
        // TODO add your handling code here:
        if(fieldB.getCard(2)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(2,FROMOPFIELD);
        }
    }//GEN-LAST:event_jfieldOp3MouseEntered

    private void jfieldOp4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp4MouseEntered
        // TODO add your handling code here:
        if(fieldB.getCard(3)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(3,FROMOPFIELD);
        }
    }//GEN-LAST:event_jfieldOp4MouseEntered

    private void jfieldOp5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jfieldOp5MouseEntered
        // TODO add your handling code here:
        if(fieldB.getCard(4)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(4,FROMOPFIELD);
        }
    }//GEN-LAST:event_jfieldOp5MouseEntered

    private void jhandOp1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp1MouseEntered
        // TODO add your handling code here:
        if(handB.getCard(0)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(0,FROMOPHAND);
        }
    }//GEN-LAST:event_jhandOp1MouseEntered

    private void jhandOp2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp2MouseEntered
        // TODO add your handling code here:
        if(handB.getCard(1)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(1,FROMOPHAND);
        }
    }//GEN-LAST:event_jhandOp2MouseEntered

    private void jhandOp3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp3MouseEntered
        // TODO add your handling code here:
        if(handB.getCard(2)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(2,FROMOPHAND);
        }
    }//GEN-LAST:event_jhandOp3MouseEntered

    private void jhandOp4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp4MouseEntered
        // TODO add your handling code here:
        if(handB.getCard(3)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(3,FROMOPHAND);
        }
    }//GEN-LAST:event_jhandOp4MouseEntered

    private void jhandOp5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jhandOp5MouseEntered
        // TODO add your handling code here:
        if(handB.getCard(4)!=null){//añadir luego if(mano.getCard(0) distinto de null) para evitar errores cuando la mano varie de tamaño durante una partida
            detailScreen(4,FROMOPHAND);
        }
    }//GEN-LAST:event_jhandOp5MouseEntered
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CardGameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CardGameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CardGameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CardGameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CardGameGUI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButtonStart;
    private javax.swing.JLabel jLabelDeck;
    private javax.swing.JLabel jLabelDeckOpp;
    private javax.swing.JLabel jLabelWindow;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextFieldDeck;
    private javax.swing.JTextField jTextFieldDeckOp;
    private javax.swing.JLabel jfield1;
    private javax.swing.JLabel jfield2;
    private javax.swing.JLabel jfield3;
    private javax.swing.JLabel jfield4;
    private javax.swing.JLabel jfield5;
    private javax.swing.JLabel jfieldOp1;
    private javax.swing.JLabel jfieldOp2;
    private javax.swing.JLabel jfieldOp3;
    private javax.swing.JLabel jfieldOp4;
    private javax.swing.JLabel jfieldOp5;
    private javax.swing.JLabel jgraveA;
    private javax.swing.JLabel jgraveB;
    private javax.swing.JLabel jhand1;
    private javax.swing.JLabel jhand2;
    private javax.swing.JLabel jhand3;
    private javax.swing.JLabel jhand4;
    private javax.swing.JLabel jhand5;
    private javax.swing.JLabel jhandOp1;
    private javax.swing.JLabel jhandOp2;
    private javax.swing.JLabel jhandOp3;
    private javax.swing.JLabel jhandOp4;
    private javax.swing.JLabel jhandOp5;
    // End of variables declaration//GEN-END:variables


}
