KTCNPM.MainForm.java Source code

Java tutorial

Introduction

Here is the source code for KTCNPM.MainForm.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package KTCNPM;

import java.awt.Desktop;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

/**
 *
 * @author haibk
 */
public class MainForm extends javax.swing.JFrame {

    /**
     * Creates new form Form
     */
    ArrayList<String> list;
    ArrayList<String> listTAW;
    ArrayList<String> listTBF;
    ArrayList<String> listTCF;
    ArrayList<String> listEF;
    ArrayList<String> listG;

    ArrayList<Integer> arraylist = new ArrayList<>();

    public MainForm() {

        initComponents();
        jButton7.setEnabled(false);
        DefaultTableModel table = new DefaultTableModel();
        table.addColumn("TT");
        table.addColumn("Khon mc chi ph");
        table.addColumn("Cch tnh");
        table.addColumn("Gi tr");
        table.addColumn("K hiu");
        jTable1.setModel(table);
        this.validate();
    }

    /**
     * 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 MainForm Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel4 = new javax.swing.JLabel();
        jButton7 = new javax.swing.JButton();
        taw = new javax.swing.JLabel();
        tbf = new javax.swing.JLabel();
        tcf = new javax.swing.JLabel();
        ef = new javax.swing.JLabel();
        h = new javax.swing.JLabel();
        p = new javax.swing.JLabel();
        jButton8 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jButton9 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(0, 153, 153));
        jPanel1.setForeground(new java.awt.Color(0, 102, 102));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("KINH T CNG NGH PHN MM");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel1,
                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE));
        jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel1,
                        javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE));

        jTabbedPane1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jPanel2.setBackground(new java.awt.Color(226, 229, 253));

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        jLabel2.setText("Nhp bng tay");

        jButton1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton1.setText("?im cc tc nhn (TAW)");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton2.setText("?im cc Use case (TBF)");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton3.setText("H s phc tp k thut - cng ngh (TCF)");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton4.setText("H s phc tp mi tr?ng (EF)");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Th?i gian lao ng (P)");

        jButton5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton5.setText("Mc lng lao ng bnh qun (H)");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/newpackage/Calculator-icon.png"))); // NOI18N
        jButton6.setText("Tnh chi ph phn m?m");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jTable1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jTable1.setModel(
                new javax.swing.table.DefaultTableModel(
                        new Object[][] { { null, null, null, null }, { null, null, null, null },
                                { null, null, null, null }, { null, null, null, null } },
                        new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
        jScrollPane1.setViewportView(jTable1);

        jLabel4.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel4.setText("Bng chi ph phn m?m");

        jButton7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/newpackage/export-icon.png"))); // NOI18N
        jButton7.setText("Xut file PDF");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        taw.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        taw.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        tbf.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbf.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        tcf.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tcf.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        ef.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        ef.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        h.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        h.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        p.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        p.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        jButton8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/newpackage/Refresh-icon.png"))); // NOI18N
        jButton8.setText("Lm mi");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        jLabel5.setText("Nhp d liu t file excel");

        jButton9.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/newpackage/file.png"))); // NOI18N
        jButton9.setText("Ch?n file");
        jButton9.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/newpackage/file.png"))); // NOI18N
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 266,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(p, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 177,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jButton3)
                                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 299,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 299,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 299,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 299,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(h, javax.swing.GroupLayout.DEFAULT_SIZE, 101,
                                                        Short.MAX_VALUE)
                                                .addComponent(taw, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(tbf, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(tcf, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(ef, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 192,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(26, 26, 26).addComponent(jButton9,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 136,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                jPanel2Layout.createSequentialGroup().addGap(188, 188, 188).addComponent(jButton6,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 226,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout
                                        .createSequentialGroup().addGap(117, 117, 117)
                                        .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 153,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(69, 69, 69)
                                        .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addContainerGap())
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35,
                                                Short.MAX_VALUE)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(jScrollPane1,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 636,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addContainerGap())
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(jLabel4,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 260,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(164, 164, 164)))))));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(18, 18, 18)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jButton9, javax.swing.GroupLayout.DEFAULT_SIZE, 41,
                                                        Short.MAX_VALUE)
                                                .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout
                                        .createSequentialGroup()
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(27, 27, 27)))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE))
                                .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 40,
                                                Short.MAX_VALUE)
                                        .addComponent(taw, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addGap(16, 16, 16)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(tbf, javax.swing.GroupLayout.PREFERRED_SIZE, 42,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11,
                                                Short.MAX_VALUE)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(tcf, javax.swing.GroupLayout.PREFERRED_SIZE, 41,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(15, 15, 15)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(ef, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(10, 10, 10)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(h, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(p, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 48,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 48,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 47,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addContainerGap(27, Short.MAX_VALUE)))));

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL,
                new java.awt.Component[] { ef, h, p, tbf, tcf });

        jTabbedPane1.addTab("Chi ph phn m?m", jPanel2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel1,
                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jTabbedPane1));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTabbedPane1)));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        new TAW_Form(this).setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        new TBF_Form(this).setVisible(true);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        new TCF_Form(this).setVisible(true);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        new EF_Form(this).setVisible(true);
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        new H_Form(this).setVisible(true);
    }//GEN-LAST:event_jButton5ActionPerformed

    public String lamTron(double gt) {
        double x = gt / 1000000;
        String result = null;
        double thapPhan = x - (int) x;
        int t = (int) (thapPhan * 1000);
        int a = (int) x;
        result = Integer.toString(a).concat(Integer.toString(t).concat("000 VN?"));
        return result;
    }

    public void setListTAW(ArrayList<String> listTAW) {
        this.listTAW = listTAW;
    }

    public void setListTBF(ArrayList<String> listTBF) {
        this.listTBF = listTBF;
    }

    public void setListTCF(ArrayList<String> listTCF) {
        this.listTCF = listTCF;
    }

    public void setListEF(ArrayList<String> listEF) {
        this.listEF = listEF;
    }

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        boolean check = true;
        if (check && taw.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s TAW");
            check = false;
        }

        if (check && tbf.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s TBF");
            check = false;
        }
        if (check && tcf.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s TCF");
            check = false;
        }

        if (check && ef.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s EF");
            check = false;
        }
        if (check && h.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s H");
            check = false;
        }

        if (check && p.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s P");
            check = false;
        }

        if (check) {
            list = new ArrayList<>();

            float tAW = Float.parseFloat(taw.getText());
            float tBF = Float.parseFloat(tbf.getText());
            float tCF = Float.parseFloat(tcf.getText());
            float eF = Float.parseFloat(ef.getText());
            float H = Float.parseFloat(h.getText());
            float P = Float.parseFloat(p.getText());
            double E = (double) 10 / 6 * ((tAW + tBF) * tCF * eF);
            double G = (double) (1.4 * E * P * H);
            double C = (double) (0.65 * G);
            double TL = (double) (G * 1.65 * 0.06);

            double Gpm = (double) G + C + TL;
            String g = lamTron(G);
            String c = lamTron(C);
            String tl = lamTron(TL);
            String gpm = lamTron(Gpm);

            list.add("TT");
            list.add("Khon mc chi ph");
            list.add("Cch tnh");
            list.add("Gi tr");
            list.add("K hiu");
            list.add("1");
            list.add("Gi tr phn m?m");
            list.add("1,4 x E x P x H");
            list.add(g);
            list.add("G");
            list.add("2");
            list.add("Chi ph chung");
            list.add("G x t l");
            list.add(c);
            list.add("C");
            list.add("3");
            list.add("Thu nhp chu thu tnh trc");
            list.add("(G + C) x t l");
            list.add(tl);
            list.add("TL");
            list.add("4");
            list.add("Chi ph phn m?m");
            list.add("G + C + TL");
            list.add(gpm);
            list.add("Gpm");
            list.add("");
            list.add("TNG CNG");
            list.add("Gpm");
            list.add(gpm);
            list.add("");

            DefaultTableModel table = new DefaultTableModel();
            table.addColumn("TT");
            table.addColumn("Khon mc chi ph");
            table.addColumn("Cch tnh");
            table.addColumn("Gi tr");
            table.addColumn("K hiu");
            Vector v1 = new Vector();
            v1.add("1");
            v1.add("Gi tr phn m?m");
            v1.add("1.4 x E x P x H");
            v1.add(g);
            v1.add("G");

            Vector v2 = new Vector();
            v2.add("2");
            v2.add("Chi ph chung");
            v2.add("G x t l");
            v2.add(c);
            v2.add("C");

            Vector v3 = new Vector();
            v3.add("3");
            v3.add("Thu nhp chu thu tnh trc");
            v3.add("(G+C)x t l");
            v3.add(tl);
            v3.add("TL");

            Vector v4 = new Vector();
            v4.add("4");
            v4.add("Chi ph phn m?m");
            v4.add("G + C + TL");
            v4.add(gpm);
            v4.add("Gpm");

            Vector v5 = new Vector();
            v5.add(" ");
            v5.add("Tng cng");
            v5.add("Gpm");
            v5.add(gpm);
            v5.add(" ");

            table.addRow(v1);
            table.addRow(v2);
            table.addRow(v3);
            table.addRow(v4);
            table.addRow(v5);

            jTable1.setModel(table);
            this.validate();

            jButton7.setEnabled(true);

            listG = new ArrayList<>();
            listG.add("TT");
            listG.add("Hng mc");
            listG.add("Din gii");
            listG.add("Gi tr");
            listG.add("Ghi ch");
            listG.add("I");
            listG.add("Tnh im tr?ng hp s dng (Use-case)");
            listG.add("");
            listG.add("");
            listG.add("");
            listG.add("1");
            listG.add("?im Actor (TAW)");
            listG.add("Ph lc III");
            listG.add(Float.toString(tAW));
            listG.add("");
            listG.add("2");
            listG.add("?im Use-case (TBF)");
            listG.add("Ph lc IV");
            listG.add(Float.toString(tBF));
            listG.add("");
            listG.add("3");
            listG.add("Tnh im UUCP");
            listG.add("UUCP = TAW +TBF");
            listG.add(Float.toString(tAW + tBF));
            listG.add("");
            listG.add("4");
            listG.add("H s phc tp v? KT-CN (TCF)");
            listG.add("TCF = 0,6 + (0,01 x TFW)");
            listG.add(Float.toString(tCF));
            listG.add("");
            listG.add("5");
            listG.add("H s phc tp v? mi tr?ng (EF)");
            listG.add("EF = 1,4 + (-0,03 x EFW)");
            listG.add(Float.toString(eF));
            listG.add("");
            listG.add("6");
            listG.add("Tnh im AUCP");
            listG.add("AUCP = UUCP x TCF x EF");
            listG.add(Float.toString((tAW + tBF) * tCF * eF));
            listG.add("");
            listG.add("II");
            listG.add("Ni suy th?i gian lao ng (P)");
            listG.add("P : ng?i/gi?/AUCP");
            listG.add(Float.toString(P));
            listG.add("");
            listG.add("III");
            listG.add("Gi tr n lc thc t (E)");
            listG.add("E = 10/6 x AUCP");
            listG.add(Float.toString((float) E));
            listG.add("");
            listG.add("IV");
            listG.add("Mc lng lao ng bnh qun (H)");
            listG.add("H: ng?i/gi?");
            listG.add(Float.toString(H).concat(" "));
            listG.add("");
            listG.add("V");
            listG.add("Gi tr phn m?m ni b (G)");
            listG.add("G = 1,4 x E x P x H");
            listG.add(lamTron(G));
            listG.add("");
        }
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        try {
            ExportFile ex = new ExportFile();
            ex.exportFile(list, listTAW, listTBF, listTCF, listEF, listG);
            Desktop.getDesktop().open(new File("E:/KTCNPM.pdf"));
        } catch (IOException ex) {
            Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        taw.setText("");
        tbf.setText("");
        tcf.setText("");
        ef.setText("");
        h.setText("");
        p.setText("");
        DefaultTableModel table = new DefaultTableModel();
        table.addColumn("TT");
        table.addColumn("Khon mc chi ph");
        table.addColumn("Cch tnh");
        table.addColumn("Gi tr");
        table.addColumn("K hiu");
        jTable1.setModel(table);
        jButton7.setEnabled(false);
        this.validate();
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed

        try {
            JFileChooser chooser = new JFileChooser();
            chooser.showOpenDialog(null);
            chooser.setSize(50, 5000);
            File file = chooser.getSelectedFile();
            FileInputStream in = new FileInputStream(file);
            try {
                XSSFWorkbook workbook = new XSSFWorkbook(in);
                XSSFSheet mySheet = workbook.getSheetAt(0);
                Iterator<Row> rowIterator = mySheet.iterator();
                while (rowIterator.hasNext()) {
                    Row row = rowIterator.next();
                    Iterator<Cell> cellIterator = row.cellIterator();
                    while (cellIterator.hasNext()) {
                        Cell cell = cellIterator.next();
                        switch (cell.getCellType()) {
                        case Cell.CELL_TYPE_STRING: // b? qua khi xu
                            break;
                        case Cell.CELL_TYPE_NUMERIC: // ly khi data l s
                            arraylist.add((int) cell.getNumericCellValue());
                            break;

                        }
                    }
                }
            } catch (IOException ex) {
                Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (FileNotFoundException ex) {
            Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println(arraylist.size());
        for (int i = 0; i < arraylist.size(); i++) {
            System.out.println(arraylist.get(i));
        }
        if (arraylist.size() == 34) {
            // taw
            int num1 = arraylist.get(0);
            int num2 = arraylist.get(1);
            int num3 = arraylist.get(2);

            int sum_taw = num1 * 1 + num2 * 2 + num3 * 3;
            this.taw.setText(Integer.toString(sum_taw));
            this.listTAW = new ArrayList<>();
            listTAW.add("STT");
            listTAW.add("Loi tc nhn");
            listTAW.add("S tc nhn");
            listTAW.add("Tr?ng s");
            listTAW.add("Tng");
            listTAW.add("1");
            listTAW.add("?n gin");
            listTAW.add(Integer.toString(num1));
            listTAW.add("1");
            listTAW.add(Integer.toString(num1));
            listTAW.add("2");
            listTAW.add("Trung bnh");
            listTAW.add(Integer.toString(num2));
            listTAW.add("2");
            listTAW.add(Integer.toString(num2 * 2));
            listTAW.add("3");
            listTAW.add("Phc tp");
            listTAW.add(Integer.toString(num3));
            listTAW.add("3");
            listTAW.add(Integer.toString(num3 * 3));
            listTAW.add(" ");
            listTAW.add("Cng (1+2+3)");
            listTAW.add("TAW");
            listTAW.add("");
            listTAW.add(Integer.toString(sum_taw));

            // tbf
            int tbf1 = arraylist.get(3);
            int tbf2 = arraylist.get(4);
            int tbf3 = arraylist.get(5);
            float tbf_sum1 = tbf1 * 5 + tbf2 * 10 + tbf3 * 15;

            int tbf4 = arraylist.get(6);
            int tbf5 = arraylist.get(7);
            int tbf6 = arraylist.get(8);
            float tbf_sum2 = (float) ((tbf4 * 5 + tbf5 * 10 + tbf6 * 15) * 1.2);

            int tbf7 = arraylist.get(9);
            int tbf8 = arraylist.get(10);
            int tbf9 = arraylist.get(11);
            float tbf_sum3 = (float) ((tbf7 * 5 + tbf8 * 10 + tbf9 * 15) * 1.5);

            this.tbf.setText(Float.toString(tbf_sum1 + tbf_sum2 + tbf_sum3));
            this.listTBF = new ArrayList<>();

            listTBF.add("STT");
            listTBF.add("Loi");
            listTBF.add("S tr?ng hp s dng");
            listTBF.add("?im ca tng loi tr?ng hp s dng");
            listTBF.add("1");
            listTBF.add("B");
            listTBF.add("");
            listTBF.add("");
            listTBF.add("");
            listTBF.add("?n gin");
            listTBF.add(Integer.toString(tbf1));
            listTBF.add(Integer.toString(tbf1 * 5));
            listTBF.add("");
            listTBF.add("Trung bnh");
            listTBF.add(Integer.toString(tbf2));
            listTBF.add(Integer.toString(tbf2 * 10));
            listTBF.add("");
            listTBF.add("Phc tp");
            listTBF.add(Integer.toString(tbf3));
            listTBF.add(Integer.toString(tbf3 * 15));

            listTBF.add("2");
            listTBF.add("M");
            listTBF.add(" ");
            listTBF.add(" ");
            listTBF.add("");
            listTBF.add("?n gin");
            listTBF.add(Integer.toString(tbf4));
            listTBF.add(Float.toString((float) (tbf4 * 5 * 1.2)));
            listTBF.add("");
            listTBF.add("Trung bnh");
            listTBF.add(Integer.toString(tbf5));
            listTBF.add(Float.toString((float) (tbf5 * 10 * 1.2)));
            listTBF.add("");
            listTBF.add("Phc tp");
            listTBF.add(Integer.toString(tbf6));
            listTBF.add(Float.toString((float) (tbf6 * 15 * 1.2)));

            listTBF.add("3");
            listTBF.add("T");
            listTBF.add(" ");
            listTBF.add(" ");
            listTBF.add("");
            listTBF.add("?n gin");
            listTBF.add(Integer.toString(tbf7));
            listTBF.add(Float.toString((float) (tbf7 * 5 * 1.5)));
            listTBF.add("");
            listTBF.add("Trung bnh");
            listTBF.add(Integer.toString(tbf8));
            listTBF.add(Float.toString((float) (tbf8 * 10 * 1.5)));
            listTBF.add("");
            listTBF.add("Phc tp");
            listTBF.add(Integer.toString(tbf9));
            listTBF.add(Float.toString((float) (tbf9 * 15 * 1.5)));
            listTBF.add("");
            listTBF.add("Cng 1+2+3");
            listTBF.add("TBF");
            listTBF.add(Float.toString(tbf_sum1 + tbf_sum2 + tbf_sum3));

            // tcf

            int f1 = arraylist.get(12);
            int f2 = arraylist.get(13);
            int f3 = arraylist.get(14);
            int f4 = arraylist.get(15);
            int f5 = arraylist.get(16);
            int f6 = arraylist.get(17);
            int f7 = arraylist.get(18);
            int f8 = arraylist.get(19);
            int f9 = arraylist.get(20);
            int f10 = arraylist.get(21);
            int f11 = arraylist.get(22);
            int f12 = arraylist.get(23);
            int f13 = arraylist.get(24);

            float tfw = (float) (f1 * 2 + f2 + f3 + f4 + f5 + f6 * 0.5 + f7 * 0.5 + f8 * 2 + f9 + f10 + f11 + f12
                    + f13);
            float TCF = (float) (0.6 + (0.01 * tfw));

            this.tcf.setText(Float.toString(TCF));

            ArrayList<String> l = new ArrayList<>();
            l.add("TT");
            l.add("Cc h s");
            l.add("Tr?ng s");
            l.add("Gi tr xp hng");
            l.add("Kt qu");
            l.add("I");
            l.add("H s k thut - cng ngh (TFW)");
            l.add("");
            l.add("");
            l.add(Float.toString(tfw));
            l.add("1");
            l.add("H thng phn tn");
            l.add("2");
            l.add(Integer.toString(f1));
            l.add(Integer.toString(f1 * 2));
            l.add("2");
            l.add("Tnh cht p ng tc th?i hoc yu cu m bo cht lng");
            l.add("1");
            l.add(Integer.toString(f2));
            l.add(Integer.toString(f2));
            l.add("3");
            l.add("Hiu qu s dng trc tuyn");
            l.add("1");
            l.add(Integer.toString(f3));
            l.add(Integer.toString(f3));
            l.add("4");
            l.add("? phc tp ca x l bn trong");
            l.add("1");
            l.add(Integer.toString(f4));
            l.add(Integer.toString(f4));
            l.add("5");
            l.add("M ngun phi ti s dng c");
            l.add("1");
            l.add(Integer.toString(f5));
            l.add(Integer.toString(f5));
            l.add("6");
            l.add("D ci t");
            l.add("0.5");
            l.add(Integer.toString(f6));
            l.add(Float.toString((float) (f6 * 0.5)));
            l.add("7");
            l.add("D s dng");
            l.add("0.5");
            l.add(Integer.toString(f7));
            l.add(Float.toString((float) (f7 * 0.5)));
            l.add("8");
            l.add("Kh nng chuyn i");
            l.add("2");
            l.add(Integer.toString(f8));
            l.add(Integer.toString(f8 * 2));
            l.add("9");
            l.add("Kh nng d thay i");
            l.add("1");
            l.add(Integer.toString(f9));
            l.add(Integer.toString(f9));
            l.add("10");
            l.add("S dng ng th?i");
            l.add("1");
            l.add(Integer.toString(f10));
            l.add(Integer.toString(f10));
            l.add("11");
            l.add("C cc tnh nng bo mt c bit");
            l.add("1");
            l.add(Integer.toString(f11));
            l.add(Integer.toString(f11));
            l.add("12");
            l.add("Cung cp truy nhp trc tip ti cc phn m?m ca cc hng th ba");
            l.add("1");
            l.add(Integer.toString(f12));
            l.add(Integer.toString(f12));
            l.add("13");
            l.add("Yu cu phng tin o to c bit cho ng?i s dng");
            l.add("1");
            l.add(Integer.toString(f13));
            l.add(Integer.toString(f13));
            l.add("II");
            l.add("H s phc tp v? k thut - cng ngh (TCF)");
            l.add("");
            l.add("");
            l.add(Float.toString(TCF));

            this.listTCF = new ArrayList<>();
            this.listTCF = l;

            // EF

            int f111 = arraylist.get(25);
            int f21 = arraylist.get(26);
            int f31 = arraylist.get(27);
            int f41 = arraylist.get(28);
            int f51 = arraylist.get(29);
            int f61 = arraylist.get(30);
            int f71 = arraylist.get(31);
            int f81 = arraylist.get(32);

            ArrayList<Integer> list1 = new ArrayList<>();

            list1.add(f111);
            list1.add(f21);
            list1.add(f31);
            list1.add(f41);
            list1.add(f51);
            list1.add(f61);
            list1.add(f71);
            list1.add(f81);

            ArrayList<Double> trongso = new ArrayList<>();
            trongso.add(1.5);
            trongso.add(0.5);
            trongso.add(1.0);
            trongso.add(0.5);
            trongso.add(1.0);
            trongso.add(2.0);
            trongso.add(-1.0);
            trongso.add(-1.);

            float es = 0;

            for (int i = 0; i < 8; i++) {
                float s = (float) (list1.get(i) * trongso.get(i));
                if (s <= 0) {
                    es += 0;
                } else if (s > 0 && s <= 1) {
                    es += 0.05;
                } else if (s > 1 && s <= 2) {
                    es += 0.1;
                } else if (s > 2 && s <= 3) {
                    es += 0.6;
                } else {
                    es += 1;
                }

            }

            float P;
            if (es < 1) {
                P = 48;
            } else if (es >= 1 && es < 3) {
                P = 32;
            } else {
                P = 20;
            }

            float efw = (float) (f111 * 1.5 + f21 * 0.5 + f31 + f41 * 0.5 + f51 + f61 * 2 - f71 - f81);
            float EF = (float) (1.4 + (-0.03 * efw));

            this.ef.setText(Float.toString(EF));
            this.p.setText(Float.toString(P));
            this.listEF = new ArrayList<>();

            listEF.add("TT");
            listEF.add("Cc h s tc ng mi tr?ng");
            listEF.add("Tr?ng s");
            listEF.add("Gi tr xp hng");
            listEF.add("Kt qu");
            listEF.add("? n nh, kinh nghim");
            listEF.add("I");
            listEF.add("H s tc ng mi tr?ng v nhm lm vic (EFW)");
            listEF.add("");
            listEF.add("");
            listEF.add(Float.toString(efw));
            listEF.add("");
            listEF.add("");
            listEF.add("?nh gi cho tng thnh vin");
            listEF.add("");
            listEF.add("");
            listEF.add("");
            listEF.add("");
            listEF.add("1");
            listEF.add(
                    "C p dng qui trnh pht trin phn m?m theo mu RUP v c hiu bit v? RUP hoc quy trnh pht trin phn m?m tng ng");
            listEF.add("1.5");
            listEF.add(Integer.toString(f111));
            listEF.add(Float.toString((float) (f111 * 1.5)));
            listEF.add(Float.toString(giaTriNoiSuy((float) (f111 * 1.5))));

            listEF.add("2");
            listEF.add("C kinh nghim v? ng dng tng t");
            listEF.add("0.5");
            listEF.add(Integer.toString(f21));
            listEF.add(Float.toString((float) (f21 * 0.5)));
            listEF.add(Float.toString(giaTriNoiSuy((float) (f21 * 0.5))));
            listEF.add("3");
            listEF.add("C kinh nghim v? hng i tng");
            listEF.add("1");
            listEF.add(Integer.toString(f31));
            listEF.add(Float.toString((float) (f31)));
            listEF.add(Float.toString(giaTriNoiSuy((float) (f31))));
            listEF.add("4");
            listEF.add("C kh nng lnh o Nhm");
            listEF.add("0.5");
            listEF.add(Integer.toString(f41));
            listEF.add(Float.toString((float) (f41 * 0.5)));
            listEF.add(Float.toString(giaTriNoiSuy((float) (f41 * 0.5))));
            listEF.add("5");
            listEF.add("Tnh cht nng ng");
            listEF.add("1");
            listEF.add(Integer.toString(f51));
            listEF.add(Float.toString((float) (f51)));
            listEF.add(Float.toString(giaTriNoiSuy((float) (f51))));
            listEF.add("");
            listEF.add("?nh gi chung cho D n");
            listEF.add("");
            listEF.add("");
            listEF.add("");
            listEF.add("");
            listEF.add("6");
            listEF.add("? n nh ca cc yu cu");
            listEF.add("2");
            listEF.add(Integer.toString(f61));
            listEF.add(Float.toString((float) (f61 * 2)));
            listEF.add(Float.toString(giaTriNoiSuy((float) (f61 * 2))));
            listEF.add("7");
            listEF.add("S dng cc nhn vin lm bn th?i gian");
            listEF.add("-1");
            listEF.add(Integer.toString(f71));
            listEF.add(Float.toString((float) (f71 * -1)));
            listEF.add("0");
            listEF.add("8");
            listEF.add("Dng ngn ng lp trnh loi kh");
            listEF.add("-1");
            listEF.add(Integer.toString(f81));
            listEF.add(Float.toString((float) (f81 * -1)));
            listEF.add("0");
            listEF.add("II");
            listEF.add("H s phc tp v? mi tr?ng (EF)");
            listEF.add("");
            listEF.add("");
            listEF.add(Float.toString(EF));
            listEF.add("");
            listEF.add("III");
            listEF.add("? n nh kinh nghim (ES)");
            listEF.add("");
            listEF.add("");
            listEF.add(Float.toString(es));
            listEF.add("");
            listEF.add("IV");
            listEF.add("Ni suy th?i gian lao ng (P)");
            listEF.add("");
            listEF.add("");
            listEF.add(Float.toString(P));
            listEF.add("");

            //H
            float H;
            int heso = arraylist.get(33);
            switch (heso) {
            case 2:
                H = (float) (2.65 * 2350000 / (22 * 8));
                break;
            case 3:
                H = (float) (2.96 * 2350000 / (22 * 8));
                break;
            default:
                H = (float) (3.27 * 2350000 / (22 * 8));
                break;
            }

            this.h.setText(Float.toString(H));

            // thuc hien tnh ton

            this.again();

        }
    }//GEN-LAST:event_jButton9ActionPerformed

    public float giaTriNoiSuy(float s) {
        if (s <= 0) {
            return 0;
        } else if (s > 0 && s <= 1) {
            return (float) 0.05;
        } else if (s > 1 && s <= 2) {
            return (float) 0.1;
        } else if (s > 2 && s <= 3) {
            return (float) 0.6;
        } else {
            return 1;
        }

    }

    public void again() {
        boolean check = true;
        if (check && taw.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s TAW");
            check = false;
        }

        if (check && tbf.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s TBF");
            check = false;
        }
        if (check && tcf.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s TCF");
            check = false;
        }

        if (check && ef.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s EF");
            check = false;
        }
        if (check && h.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s H");
            check = false;
        }

        if (check && p.getText().isEmpty()) {
            JOptionPane.showMessageDialog(rootPane, "Cha c thng s P");
            check = false;
        }

        if (check) {
            list = new ArrayList<>();

            float tAW = Float.parseFloat(taw.getText());
            float tBF = Float.parseFloat(tbf.getText());
            float tCF = Float.parseFloat(tcf.getText());
            float eF = Float.parseFloat(ef.getText());
            float H = Float.parseFloat(h.getText());
            float P = Float.parseFloat(p.getText());
            double E = (double) 10 / 6 * ((tAW + tBF) * tCF * eF);
            double G = (double) (1.4 * E * P * H);
            double C = (double) (0.65 * G);
            double TL = (double) (G * 1.65 * 0.06);

            double Gpm = (double) G + C + TL;
            String g = lamTron(G);
            String c = lamTron(C);
            String tl = lamTron(TL);
            String gpm = lamTron(Gpm);

            list.add("TT");
            list.add("Khon mc chi ph");
            list.add("Cch tnh");
            list.add("Gi tr");
            list.add("K hiu");
            list.add("1");
            list.add("Gi tr phn m?m");
            list.add("1,4 x E x P x H");
            list.add(g);
            list.add("G");
            list.add("2");
            list.add("Chi ph chung");
            list.add("G x t l");
            list.add(c);
            list.add("C");
            list.add("3");
            list.add("Thu nhp chu thu tnh trc");
            list.add("(G + C) x t l");
            list.add(tl);
            list.add("TL");
            list.add("4");
            list.add("Chi ph phn m?m");
            list.add("G + C + TL");
            list.add(gpm);
            list.add("Gpm");
            list.add("");
            list.add("TNG CNG");
            list.add("Gpm");
            list.add(gpm);
            list.add("");

            DefaultTableModel table = new DefaultTableModel();
            table.addColumn("TT");
            table.addColumn("Khon mc chi ph");
            table.addColumn("Cch tnh");
            table.addColumn("Gi tr");
            table.addColumn("K hiu");
            Vector v1 = new Vector();
            v1.add("1");
            v1.add("Gi tr phn m?m");
            v1.add("1.4 x E x P x H");
            v1.add(g);
            v1.add("G");

            Vector v2 = new Vector();
            v2.add("2");
            v2.add("Chi ph chung");
            v2.add("G x t l");
            v2.add(c);
            v2.add("C");

            Vector v3 = new Vector();
            v3.add("3");
            v3.add("Thu nhp chu thu tnh trc");
            v3.add("(G+C)x t l");
            v3.add(tl);
            v3.add("TL");

            Vector v4 = new Vector();
            v4.add("4");
            v4.add("Chi ph phn m?m");
            v4.add("G + C + TL");
            v4.add(gpm);
            v4.add("Gpm");

            Vector v5 = new Vector();
            v5.add(" ");
            v5.add("Tng cng");
            v5.add("Gpm");
            v5.add(gpm);
            v5.add(" ");

            table.addRow(v1);
            table.addRow(v2);
            table.addRow(v3);
            table.addRow(v4);
            table.addRow(v5);

            jTable1.setModel(table);
            this.validate();

            jButton7.setEnabled(true);

            listG = new ArrayList<>();
            listG.add("TT");
            listG.add("Hng mc");
            listG.add("Din gii");
            listG.add("Gi tr");
            listG.add("Ghi ch");
            listG.add("I");
            listG.add("Tnh im tr?ng hp s dng (Use-case)");
            listG.add("");
            listG.add("");
            listG.add("");
            listG.add("1");
            listG.add("?im Actor (TAW)");
            listG.add("Ph lc III");
            listG.add(Float.toString(tAW));
            listG.add("");
            listG.add("2");
            listG.add("?im Use-case (TBF)");
            listG.add("Ph lc IV");
            listG.add(Float.toString(tBF));
            listG.add("");
            listG.add("3");
            listG.add("Tnh im UUCP");
            listG.add("UUCP = TAW +TBF");
            listG.add(Float.toString(tAW + tBF));
            listG.add("");
            listG.add("4");
            listG.add("H s phc tp v? KT-CN (TCF)");
            listG.add("TCF = 0,6 + (0,01 x TFW)");
            listG.add(Float.toString(tCF));
            listG.add("");
            listG.add("5");
            listG.add("H s phc tp v? mi tr?ng (EF)");
            listG.add("EF = 1,4 + (-0,03 x EFW)");
            listG.add(Float.toString(eF));
            listG.add("");
            listG.add("6");
            listG.add("Tnh im AUCP");
            listG.add("AUCP = UUCP x TCF x EF");
            listG.add(Float.toString((tAW + tBF) * tCF * eF));
            listG.add("");
            listG.add("II");
            listG.add("Ni suy th?i gian lao ng (P)");
            listG.add("P : ng?i/gi?/AUCP");
            listG.add(Float.toString(P));
            listG.add("");
            listG.add("III");
            listG.add("Gi tr n lc thc t (E)");
            listG.add("E = 10/6 x AUCP");
            listG.add(Float.toString((float) E));
            listG.add("");
            listG.add("IV");
            listG.add("Mc lng lao ng bnh qun (H)");
            listG.add("H: ng?i/gi?");
            listG.add(Float.toString(H).concat(" "));
            listG.add("");
            listG.add("V");
            listG.add("Gi tr phn m?m ni b (G)");
            listG.add("G = 1,4 x E x P x H");
            listG.add(lamTron(G));
            listG.add("");
        }
    }

    public void setTextTAW(String taw) {
        this.taw.setText(taw);
    }

    public void setTextTBF(String tbf) {
        this.tbf.setText(tbf);
    }

    public void setTextTCF(String tcf) {
        this.tcf.setText(tcf);
    }

    public void setTextEF(String ef) {
        this.ef.setText(ef);
    }

    public void setTextP(String p) {
        this.p.setText(p);
    }

    public void setTextH(String h) {
        this.h.setText(h);
    }

    /**
     * @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(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        }
        //</editor-fold>
        //</editor-fold>

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

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ef;
    private javax.swing.JLabel h;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    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.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel p;
    private javax.swing.JLabel taw;
    private javax.swing.JLabel tbf;
    private javax.swing.JLabel tcf;
    // End of variables declaration//GEN-END:variables
}