com.farouk.projectapp.ManagerGUI.java Source code

Java tutorial

Introduction

Here is the source code for com.farouk.projectapp.ManagerGUI.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 com.farouk.projectapp;

import com.itextpdf.text.Document;
import com.itextpdf.text.Chapter;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.List;

import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Section;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import java.awt.Color;
import java.awt.Component;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import javax.swing.DefaultListModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.JFrame;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author farou_000
 */
public class ManagerGUI extends javax.swing.JFrame {

    /**
     * Creates new form ManagerGUI
     */
    public ManagerGUI(String name) {

        initComponents();
        jLabel1.setText("Welcome " + name);
    }

    /**
     * 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() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        DefaultListModel modelEmployeesNames = new DefaultListModel();
        try {
            for (User u : SQLConnectMana.getEmployeesFromDb()) {
                modelEmployeesNames.addElement(u.getLogin());
            }
        } catch (Exception e) {
            System.err.println("no users !!");
        }
        jList1 = new javax.swing.JList<>();
        jLabel2 = new javax.swing.JLabel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        DefaultTableModel a = new DefaultTableModel();
        jTable1 = new javax.swing.JTable() {
            public boolean isCellEditable(int d, int c) {
                return false;
            }
        };
        jLabel4 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jDateChooser1 = new com.toedter.calendar.JDateChooser();
        jDateChooser2 = new com.toedter.calendar.JDateChooser();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        DefaultTableModel b = new DefaultTableModel();
        jTable2 = new javax.swing.JTable() {
            public boolean isCellEditable(int d, int c) {
                return false;
            }

            @Override
            public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
                Component comp = super.prepareRenderer(renderer, row, col);
                String value = getModel().getValueAt(row, 1).toString();
                int a = SQLConnectMana.ifBanned(employeeID, value);
                if (a == 1) {
                    comp.setBackground(Color.GRAY);
                } else {
                    comp.setBackground(Color.white);
                    comp.setForeground(Color.black);
                }

                return comp;
            }
        };
        jButton3 = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        jSeparator2 = new javax.swing.JSeparator();
        jButton8 = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jButton9 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        DefaultListModel modelCompaniesName = new DefaultListModel();
        try {
            for (String p : SQLConnectEmp.getAllCompaniesNames()) {
                modelCompaniesName.addElement(p);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        jList2 = new javax.swing.JList<>();
        jScrollPane5 = new javax.swing.JScrollPane();
        DefaultTableModel c = new DefaultTableModel();
        jTable3 = new javax.swing.JTable() {
            public boolean isCellEditable(int d, int c) {
                return false;
            }
        };
        jButton5 = new javax.swing.JButton();
        jScrollPane6 = new javax.swing.JScrollPane();
        DefaultListModel li = new DefaultListModel();
        jList3 = new javax.swing.JList<>();
        jLabel11 = new javax.swing.JLabel();
        jButton6 = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();
        jButton7 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Calibri", 0, 17)); // NOI18N

        jButton1.setForeground(new java.awt.Color(204, 0, 0));
        jButton1.setText("Log out");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout
                .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(jLabel1)
                                .addGap(33, 33, 33).addComponent(jButton1).addContainerGap()));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jButton1).addComponent(jLabel1))
                        .addContainerGap()));

        jList1.setModel(modelEmployeesNames);
        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList1MouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jList1);

        jLabel2.setFont(new java.awt.Font("Calibri", 0, 13)); // NOI18N
        jLabel2.setText("Employees");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(jPanel4Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                .addGroup(jPanel4Layout.createSequentialGroup().addComponent(jLabel2).addGap(0, 77,
                                        Short.MAX_VALUE)))
                        .addContainerGap()));
        jPanel4Layout
                .setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createSequentialGroup().addGap(29, 29, 29).addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 268,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(48, Short.MAX_VALUE)));

        jScrollPane2.setVisible(false);

        jTable1.setModel(a);
        UpdatejTable1();
        jScrollPane2.setViewportView(jTable1);

        jLabel4.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel4.setText("Recent Transactions in  :");

        jPanel7.setVisible(false);

        jLabel8.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel8.setText("From :");

        jLabel9.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel9.setText("To :");

        jButton2.setText("Go !");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton4.setText("Reset");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(jPanel7Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap().addGroup(jPanel7Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 166,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel8))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 163,
                                        Short.MAX_VALUE)
                                .addGroup(jPanel7Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 166,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel9))
                                .addGap(70, 70, 70))
                        .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jButton2)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jButton4).addGap(0, 0,
                                Short.MAX_VALUE)))));
        jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup().addGroup(jPanel7Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                                        jDateChooser2, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))
                        .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jDateChooser1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                        .addComponent(jButton2).addGap(18, 18, 18).addComponent(jButton4).addGap(4, 4, 4)));

        jPanel7Layout.linkSize(javax.swing.SwingConstants.VERTICAL,
                new java.awt.Component[] { jDateChooser1, jDateChooser2 });

        jLabel5.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(jPanel5Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel4)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 698,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5).addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(281, Short.MAX_VALUE)));
        jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addGap(20, 20, 20).addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 162,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(jLabel5).addGap(26, 26, 26)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(66, Short.MAX_VALUE)));

        jTabbedPane2.addTab("    General Info    ", jPanel5);

        jLabel7.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        jScrollPane3.setVisible(false);

        jTable2.setModel(b);
        UpdatejTable2();
        jTable2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable2MouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(jTable2);

        jButton3.setForeground(new java.awt.Color(255, 51, 51));
        jButton3.setText("Prohibit Purchase");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(jPanel6Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addGroup(jPanel6Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel7)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton3)).addContainerGap(527, Short.MAX_VALUE)));
        jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup().addGap(19, 19, 19).addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 144,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29).addComponent(jButton3).addContainerGap(231, Short.MAX_VALUE)));

        jTabbedPane2.addTab("    Reported Companies    ", jPanel6);

        jButton8.setForeground(new java.awt.Color(0, 153, 0));
        jButton8.setText("Send Message");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N

        jEditorPane1.setEditable(false);
        jScrollPane7.setViewportView(jEditorPane1);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        if (jTextArea1.getText().isEmpty()) {
            jButton8.setEnabled(false);
        }
        jTextArea1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextArea1KeyReleased(evt);
            }
        });
        jScrollPane8.setViewportView(jTextArea1);

        jButton9.setForeground(new java.awt.Color(0, 153, 0));
        jButton9.setText("Send To All");
        jButton9.setEnabled(false);
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(jPanel9Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup().addGroup(jPanel9Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jPanel9Layout.createSequentialGroup().addGroup(jPanel9Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel9Layout.createSequentialGroup().addGap(236, 236, 236).addComponent(
                                        jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 239,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap()
                                        .addComponent(jLabel12)))
                                .addGap(119, 119, 119))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                jPanel9Layout.createSequentialGroup().addContainerGap().addGroup(jPanel9Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout
                                                .createSequentialGroup()
                                                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        480, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(jPanel9Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING, false)
                                                        .addComponent(jButton8,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addComponent(jButton9,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE))
                                                .addGap(0, 8, Short.MAX_VALUE)))))
                        .addContainerGap(380, Short.MAX_VALUE)));
        jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup().addGap(28, 28, 28).addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 222,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel9Layout.createSequentialGroup().addGap(31, 31, 31).addComponent(
                                        jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel9Layout.createSequentialGroup().addGap(40, 40, 40)
                                        .addComponent(jButton8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jButton9)))
                        .addContainerGap(41, Short.MAX_VALUE)));

        jTabbedPane2.addTab("    Messages    ", jPanel9);

        jLabel3.setFont(new java.awt.Font("Calibri", 1, 15)); // NOI18N

        jLabel6.setFont(new java.awt.Font("Calibri", 1, 15)); // NOI18N
        jLabel6.setText("Please Choose an Employee to begin.");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(23, 23, 23)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 4,
                                                Short.MAX_VALUE)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        994, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel3)))
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(64, 64, 64)
                                        .addComponent(jLabel6).addGap(0, 0, Short.MAX_VALUE)))));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 492,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(41, Short.MAX_VALUE))
                .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)));

        jTabbedPane1.addTab("    Employees' Operations    ", jPanel2);

        jLabel10.setFont(new java.awt.Font("Calibri", 0, 13)); // NOI18N
        jLabel10.setText("List of Companies (NASDAQ)");

        jList2.setModel(modelCompaniesName);
        jList2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList2MouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(jList2);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(jPanel8Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel10))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup().addGap(16, 16, 16).addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
                        .addContainerGap()));

        jTable3.setModel(c);
        UpdatejTable3();
        jScrollPane5.setViewportView(jTable3);

        jButton5.setForeground(new java.awt.Color(255, 51, 51));
        jButton5.setText("Prohibit Purchase");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jList3.setModel(li);
        UpdatejList3();
        jList3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList3MouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(jList3);

        jLabel11.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        jLabel11.setText("Companies you prohibited for all employees :");

        jButton6.setForeground(new java.awt.Color(0, 102, 255));
        jButton6.setText("Allow");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(jPanel3Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addGap(21, 21, 21)
                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup().addGap(41, 41, 41)
                                        .addGroup(jPanel3Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel3Layout.createSequentialGroup()
                                                        .addGroup(jPanel3Layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                .addComponent(jLabel11)
                                                                .addComponent(jScrollPane6,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 323,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(jButton5,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 258,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addGap(26, 26, 26).addComponent(jButton6,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 96,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        665, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addContainerGap(242, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel3Layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        314, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(385, 385, 385)))));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(jPanel8,
                                javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createSequentialGroup().addGap(49, 49, 49)
                                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 222,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(29, 29, 29).addComponent(jButton5).addGap(18, 18, 18)
                                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(7, 7, 7).addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel3Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jButton6))))
                        .addContainerGap(51, Short.MAX_VALUE)));

        jTabbedPane1.addTab("    Companies' Operations    ", jPanel3);

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

        jButton7.setText("generate PDF!");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton7).addGap(18, 18, 18)
                        .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 11,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(54, 54, 54))
                .addGroup(
                        layout.createSequentialGroup().addGap(46, 46, 46)
                                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1191,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(27, Short.MAX_VALUE)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                layout.createSequentialGroup()
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jButton7).addGap(7, 7, 7))
                        .addGroup(layout.createSequentialGroup().addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 603,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(19, Short.MAX_VALUE)));

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

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        this.setVisible(false);
        EmployeeGUI emp = new EmployeeGUI();
        emp.setLocationRelativeTo(null);
        emp.setVisible(true);
        emp.setExtendedState(JFrame.MAXIMIZED_BOTH);
        emp.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
        //Transaction Table

        employeeID = SQLConnectEmp.getUserID(jList1.getSelectedValue().toString());
        jLabel3.setText("Currently working on : " + jList1.getSelectedValue().toString());
        jScrollPane2.setVisible(true);
        jLabel6.setVisible(false);
        UpdatejTable1();
        jLabel5.setText("Total of " + jList1.getSelectedValue().toString() + "'s Portfolio : "
                + SQLConnectMana.getLatestTotal(employeeID) + ".");
        jLabel12.setText("Sent messages to : " + jList1.getSelectedValue().toString());
        //Date Picker
        jPanel7.setVisible(true);

        //Reports Table
        jScrollPane3.setVisible(true);
        jLabel7.setText("Reported Companies from : " + jList1.getSelectedValue().toString());
        UpdatejTable2();

        //Messages
        UpdatejEditorPane1();

    }//GEN-LAST:event_jList1MouseClicked

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        if (reportedToBan.equals("")) {
            JOptionPane.showMessageDialog(rootPane, "Please choose a company first.", "Oh", WIDTH);
        } else {
            SQLConnectMana.addBanned(employeeID, reportedToBan);
            UpdatejTable2();
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jTable2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable2MouseClicked
        int row = jTable2.getSelectedRow();
        reportedToBan = (jTable2.getModel().getValueAt(row, 1).toString());
        if (SQLConnectMana.ifBanned(employeeID, reportedToBan) == 1) {
            jButton3.setText("Allow Purchase");
        } else if (SQLConnectMana.ifBanned(employeeID, reportedToBan) == 0) {
            jButton3.setText("Prohibit Purchase");
        }

    }//GEN-LAST:event_jTable2MouseClicked

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        DefaultTableModel modelTransactionEmploye = new DefaultTableModel();
        modelTransactionEmploye
                .setColumnIdentifiers(new String[] { "Name", "Operation", "Quantity", "Price Paid", "Date" });
        for (Transaction t : SQLConnectMana.getTransactionsBtwnDates(employeeID,
                jDateChooser1.getDate().toLocaleString(), jDateChooser2.getDate().toLocaleString())) {
            modelTransactionEmploye.addRow(new String[] { t.getSymbol(), t.getOperation(),
                    Integer.toString(t.getQuantity()), Double.toString(t.getPricePaid()), t.getDate() });
        }
        jTable1.setModel(modelTransactionEmploye);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        UpdatejTable1();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jList2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList2MouseClicked
        companyName = SQLConnectEmp.getSymbolOfCompanyFromDB(jList2.getSelectedValue().toString());
        UpdatejTable3();
    }//GEN-LAST:event_jList2MouseClicked

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        if (companyName.equals("")) {
            JOptionPane.showMessageDialog(rootPane, "Please choose a company first.", "Oh", WIDTH);
        } else {
            SQLConnectMana.addBannedForAll(companyName);
            UpdatejList3();
        }
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jList3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList3MouseClicked
        banned = jList3.getSelectedValue().toString();
    }//GEN-LAST:event_jList3MouseClicked

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        SQLConnectMana.removeBanForAll(banned);
        UpdatejList3();
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        String message = jTextArea1.getText().replaceAll("'", "''");
        jTextArea1.setText(null);
        jButton8.setEnabled(false);

        SQLConnectMana.sendMessage(employeeID, message);
        UpdatejEditorPane1();

    }//GEN-LAST:event_jButton8ActionPerformed

    private void jTextArea1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea1KeyReleased
        if (jTextArea1.getText().isEmpty()) {
            jButton8.setEnabled(false);
            jButton9.setEnabled(false);
        } else {
            jButton8.setEnabled(true);
            jButton9.setEnabled(true);
        }
    }//GEN-LAST:event_jTextArea1KeyReleased

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        String pdfName = JOptionPane.showInputDialog(rootPane, "Enter Title", "Please enter a title", WIDTH);
        if (pdfName.isEmpty()) {
            pdfName = "Global Report";
        }
        Document document = new Document();
        int numEMployees = 1;

        try {
            PdfWriter.getInstance(document, new FileOutputStream(pdfName + ".pdf"));

            document.open();
            document.addAuthor("TeamPirates");
            document.addTitle("Global Report");

            Font font1 = new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.BOLD);
            Font font2 = new Font(Font.FontFamily.TIMES_ROMAN, 15, Font.UNDERLINE);

            for (User u : SQLConnectMana.getEmployeesFromDb()) {
                JTable jTableTran = new JTable();
                JTable jTableReport = new JTable();

                Chapter chapter = new Chapter(
                        new Paragraph(new Phrase("Employee : " + u.getLogin() + "\n\n", font1)), numEMployees);

                Section section1 = chapter.addSection(new Paragraph(new Phrase("Recent Transactions :\n", font2)),
                        9);

                Section section2 = chapter.addSection(new Paragraph(new Phrase("Reported Companies :\n", font2)),
                        9);

                // Transactions :
                DefaultTableModel modelPDFtrans = new DefaultTableModel();
                modelPDFtrans.setColumnIdentifiers(
                        new String[] { "Name", "Operation", "Quantity", "Price Paid", "Date" });
                for (Transaction t : SQLConnectMana.getTransactions(u.getId())) {
                    modelPDFtrans.addRow(new String[] { t.getSymbol(), t.getOperation(),
                            Integer.toString(t.getQuantity()), Double.toString(t.getPricePaid()), t.getDate() });
                }
                jTableTran.setModel(modelPDFtrans);

                PdfPTable pdfTableTrans = new PdfPTable(jTableTran.getColumnCount());

                for (int i = 0; i < jTableTran.getColumnCount(); i++) {
                    pdfTableTrans.addCell(jTableTran.getColumnName(i));
                }
                //extracting data from the JTable and inserting it to PdfPTable
                for (int rows = 0; rows < jTableTran.getRowCount(); rows++) {
                    for (int cols = 0; cols < jTableTran.getColumnCount(); cols++) {
                        pdfTableTrans.addCell(jTableTran.getModel().getValueAt(rows, cols).toString());

                    }
                }
                Paragraph blank = new Paragraph("\n\n");
                section1.add(blank);
                section1.add(pdfTableTrans);

                section1.add(blank);
                //Reported Companies :
                DefaultTableModel modelPDFReported = new DefaultTableModel();
                modelPDFReported.setColumnIdentifiers(
                        new String[] { "Name", "Symbol", "Stock Price ()", "Quantity Bought" });
                for (Company c : SQLConnectMana.getNameOfReported(u.getId())) {
                    modelPDFReported.addRow(new String[] { c.getName(), c.getSymbol(),
                            String.valueOf(c.getStockPrice().doubleValue()),
                            Integer.toString(c.getNumberOwned()) });
                }
                jTableReport.setModel(modelPDFReported);
                PdfPTable pdfTableReport = new PdfPTable(jTableReport.getColumnCount());

                for (int i = 0; i < jTableReport.getColumnCount(); i++) {
                    pdfTableReport.addCell(jTableReport.getColumnName(i));
                }
                //extracting data from the JTable and inserting it to PdfPTable
                for (int rows = 0; rows < jTableReport.getRowCount(); rows++) {
                    for (int cols = 0; cols < jTableReport.getColumnCount(); cols++) {
                        pdfTableReport.addCell(jTableReport.getModel().getValueAt(rows, cols).toString());
                    }
                }
                section2.add(blank);
                section2.add(pdfTableReport);
                section2.add(blank);
                //End of doc for a single employee
                document.add(chapter);

                numEMployees++;

            }
            Chapter ban = new Chapter(new Paragraph(new Phrase("Prohibited Companies :\n\n", font1)),
                    ++numEMployees);

            com.itextpdf.text.List bannedCompanies = new List(List.ORDERED);
            for (String lii : SQLConnectMana.getBannedCompForAll()) {
                bannedCompanies.add(new com.itextpdf.text.ListItem(lii));
            }
            ban.add(bannedCompanies);
            document.add(ban);
            document.close();
        } catch (DocumentException | FileNotFoundException e) {
            System.err.println("Sorry Problem in pdf.\n" + e);
        }

    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        String message = jTextArea1.getText().replaceAll("'", "''");
        jTextArea1.setText(null);
        jButton9.setEnabled(false);

        for (User u : SQLConnectMana.getEmployeesFromDb()) {
            SQLConnectMana.sendMessage(u.getId(), message);
        }
        UpdatejEditorPane1();
    }//GEN-LAST:event_jButton9ActionPerformed

    /**
     * Updates the editor for showing real time messages sent to employees.
     */
    private void UpdatejEditorPane1() {
        StringBuilder mes = new StringBuilder();
        for (Message m : SQLConnectMana.getMessages(employeeID)) {
            mes.append(m.toString());
        }
        jEditorPane1.setText(mes.toString());
        jEditorPane1.setCaretPosition(0);
    }

    /**
     * Updates List of banned companies.
     */
    private void UpdatejList3() {
        DefaultListModel l = new DefaultListModel();
        for (String lii : SQLConnectMana.getBannedCompForAll()) {
            l.addElement(lii);
        }
        jList3.setModel(l);
    }

    /**
     * Updates Table automatically for showing transactions made by employees of
     * a certain company.
     */
    private void UpdatejTable3() {
        DefaultTableModel modelTransactionCompany = new DefaultTableModel();
        modelTransactionCompany
                .setColumnIdentifiers(new String[] { "Employee", "Operation", "Quantity", "Price Paid", "Date" });
        for (Transaction t : SQLConnectMana.getTransByCompany(companyName)) {
            modelTransactionCompany.addRow(new String[] { t.getUser(), t.getOperation(),
                    Integer.toString(t.getQuantity()), Double.toString(t.getPricePaid()), t.getDate() });
        }
        jTable3.setModel(modelTransactionCompany);
    }

    /**
     * Updates Table for showing reported companies of an employee.
     */
    private void UpdatejTable2() {
        DefaultTableModel modelReportedEmployee = new DefaultTableModel();
        modelReportedEmployee
                .setColumnIdentifiers(new String[] { "Name", "Symbol", "Stock Price ()", "Quantity Bought" });
        for (Company c : SQLConnectMana.getNameOfReported(employeeID)) {
            modelReportedEmployee.addRow(new String[] { c.getName(), c.getSymbol(),
                    String.valueOf(c.getStockPrice().doubleValue()), Integer.toString(c.getNumberOwned()) });
        }
        jTable2.setModel(modelReportedEmployee);
    }

    /**
     * Updates Table for showing transactions of an employee.
     */
    private void UpdatejTable1() {
        DefaultTableModel modelTransactionEmploye = new DefaultTableModel();
        modelTransactionEmploye
                .setColumnIdentifiers(new String[] { "Name", "Operation", "Quantity", "Price Paid", "Date" });
        for (Transaction t : SQLConnectMana.getTransactions(employeeID)) {
            modelTransactionEmploye.addRow(new String[] { t.getSymbol(), t.getOperation(),
                    Integer.toString(t.getQuantity()), Double.toString(t.getPricePaid()), t.getDate() });
        }
        jTable1.setModel(modelTransactionEmploye);
    }

    /**
     * @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 ("Mac OS X".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;

                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);

        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);

        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ManagerGUI.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);

        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ManagerGUI.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 ManagerGUI().setVisible(true);
            }
        });
    }

    private int employeeID = 0;
    private String reportedToBan = "";
    private String banned = "";
    private String companyName = "";

    // Variables declaration - do not modify//GEN-BEGIN:variables
    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 com.toedter.calendar.JDateChooser jDateChooser1;
    private com.toedter.calendar.JDateChooser jDateChooser2;
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    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 jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList<String> jList1;
    private javax.swing.JList<String> jList2;
    private javax.swing.JList<String> jList3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTable jTable3;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
}