/*
 * ScoreGUI.java
 *
 * Created on February 7, 2008, 12:57 PM
 */

/**
 *
 * @author  dwr46301
 */
public class ScoreGUI extends javax.swing.JFrame {
    private ScoreKeeper scorer;
    
    /** Creates new form ScoreGUI */
    public ScoreGUI() {
        initComponents();
        scorer = new ScoreKeeper();
    }
    
    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jLabel5 = new javax.swing.JLabel();
        scoreField = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        made3Button = new javax.swing.JButton();
        missed3Button = new javax.swing.JButton();
        missed1Button = new javax.swing.JButton();
        made1Button = new javax.swing.JButton();
        missed2Button = new javax.swing.JButton();
        made2Button = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        FG3percentField = new javax.swing.JTextField();
        FG2percentField = new javax.swing.JTextField();
        FTpercentField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jButton1 = new javax.swing.JButton();

        jLabel5.setText("jLabel5");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        scoreField.setEditable(false);
        scoreField.setFont(new java.awt.Font("Lucida Console", 0, 36));
        scoreField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        scoreField.setText("0");

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24));
        jLabel1.setText("SCORE:");

        made3Button.setText("made");
        made3Button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                made3ButtonMouseClicked(evt);
            }
        });

        missed3Button.setText("missed");
        missed3Button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                missed3ButtonMouseClicked(evt);
            }
        });

        missed1Button.setText("missed");
        missed1Button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                missed1ButtonMouseClicked(evt);
            }
        });

        made1Button.setText("made");
        made1Button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                made1ButtonMouseClicked(evt);
            }
        });

        missed2Button.setText("missed");
        missed2Button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                missed2ButtonMouseClicked(evt);
            }
        });

        made2Button.setText("made");
        made2Button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                made2ButtonMouseClicked(evt);
            }
        });

        jLabel2.setText("3 pt FG:");

        jLabel3.setText("2 pt FG:");

        jLabel4.setText("FT:");

        FG3percentField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        FG3percentField.setText("0.0");

        FG2percentField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        FG2percentField.setText("0.0");

        FTpercentField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        FTpercentField.setText("0.0");

        jLabel6.setText("%");

        jLabel8.setText("%");

        jLabel9.setText("%");

        jButton1.setText("Reset Score");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(scoreField, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4))
                        .addGap(13, 13, 13)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jButton1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(missed1Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(missed2Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(missed3Button, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(made3Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(made2Button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(made1Button, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(FTpercentField)
                            .addComponent(FG2percentField)
                            .addComponent(FG3percentField, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel6)
                            .addComponent(jLabel9))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(scoreField, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(11, 11, 11)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(missed3Button)
                    .addComponent(made3Button)
                    .addComponent(FG3percentField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(missed2Button)
                    .addComponent(made2Button)
                    .addComponent(FG2percentField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(missed1Button)
                    .addComponent(made1Button)
                    .addComponent(FTpercentField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        scorer.reset();
        scoreField.setText("0");
        FG3percentField.setText("0.0");
        FG2percentField.setText("0.0");
        FTpercentField.setText("0.0");
        
    }//GEN-LAST:event_jButton1MouseClicked

    private void made1ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_made1ButtonMouseClicked
        scorer.made(1);
        FTpercentField.setText("" + scorer.getPercent(1));
        scoreField.setText("" + scorer.getScore());
    }//GEN-LAST:event_made1ButtonMouseClicked

    private void missed1ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_missed1ButtonMouseClicked
        scorer.missed(1);
        FTpercentField.setText("" + scorer.getPercent(1));

    }//GEN-LAST:event_missed1ButtonMouseClicked

    private void made2ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_made2ButtonMouseClicked
        scorer.made(2);
        FG2percentField.setText("" + scorer.getPercent(2));
        scoreField.setText("" + scorer.getScore());
    }//GEN-LAST:event_made2ButtonMouseClicked

    private void missed2ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_missed2ButtonMouseClicked
        scorer.missed(2);
        FG2percentField.setText("" + scorer.getPercent(2));

    }//GEN-LAST:event_missed2ButtonMouseClicked

    private void made3ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_made3ButtonMouseClicked
        scorer.made(3);
        FG3percentField.setText("" + scorer.getPercent(3));
        scoreField.setText("" + scorer.getScore());
    }//GEN-LAST:event_made3ButtonMouseClicked

    private void missed3ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_missed3ButtonMouseClicked
        scorer.missed(3);
        FG3percentField.setText("" + scorer.getPercent(3));

    }//GEN-LAST:event_missed3ButtonMouseClicked
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ScoreGUI().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField FG2percentField;
    private javax.swing.JTextField FG3percentField;
    private javax.swing.JTextField FTpercentField;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton made1Button;
    private javax.swing.JButton made2Button;
    private javax.swing.JButton made3Button;
    private javax.swing.JButton missed1Button;
    private javax.swing.JButton missed2Button;
    private javax.swing.JButton missed3Button;
    private javax.swing.JTextField scoreField;
    // End of variables declaration//GEN-END:variables
    
}
