Java tutorial
/* * 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 client; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.PageSize; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import java.util.Date; import java.sql.*; import javax.swing.JOptionPane; import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.*; import java.awt.Desktop; import java.io.File; import java.io.FileOutputStream; import java.lang.Object; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.concurrent.ThreadLocalRandom; import javax.swing.BorderFactory; import net.proteanit.sql.DbUtils; /** * * @author Adi Malka * @author Felix Vainer */ /** * This class display all the options that a user with a level 0 permission has */ public class welcome0 extends javax.swing.JFrame { static Connection conn = loginGUI.conn; static PreparedStatement pst = null; static ResultSet rs = null; public String filename; public String filename_update; public String filename_show_contract; public String fn; String searchmethod; String searchmethod2; String tableClick; String job_title; boolean openClose; String sFileName; /** * Creates new form welcome */ public welcome0() { initComponents(); customerTab.setVisible(false); usersTab.setVisible(false); reportsTab.setVisible(false); dropManageUserLabel.setVisible(false); changePasswordLabel.setVisible(false); repWorkerDateSearchtxt.setVisible(false); repWorkerJobTitlechoice.setVisible(false); update_table(); } /** * 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() { searchGroup = new javax.swing.ButtonGroup(); WorkerHistoryGroup = new javax.swing.ButtonGroup(); jLabel1 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLabel4 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); customersButton = new javax.swing.JButton(); reportsButton = new javax.swing.JButton(); workersButton = new javax.swing.JButton(); usersButton = new javax.swing.JButton(); jLayeredPane1 = new javax.swing.JLayeredPane(); WorkersTab = new javax.swing.JTabbedPane(); AddWorkerPanel = new javax.swing.JPanel(); WorkerIDLabel = new javax.swing.JLabel(); WorkerIDText = new javax.swing.JTextField(); FirstNamerLabel = new javax.swing.JLabel(); FirstNamerText = new javax.swing.JTextField(); LastNameLabel = new javax.swing.JLabel(); LastNameText = new javax.swing.JTextField(); PhoneLabel = new javax.swing.JLabel(); PhoneText = new javax.swing.JTextField(); AddressLabel = new javax.swing.JLabel(); AddressText = new javax.swing.JTextField(); BirthdateLabel = new javax.swing.JLabel(); BirthdayDateChooserText = new com.toedter.calendar.JDateChooser(); EmailLabel = new javax.swing.JLabel(); EmailText = new javax.swing.JTextField(); PersonalContractPanel = new javax.swing.JPanel(); PersonalContractLabel = new javax.swing.JLabel(); ContractIDLabel = new javax.swing.JLabel(); ContracdIDText = new javax.swing.JTextField(); JobTitleLabel = new javax.swing.JLabel(); JobTitleText = new javax.swing.JTextField(); UploadText = new javax.swing.JTextField(); UploadContractButton = new javax.swing.JButton(); ShowContractButton = new javax.swing.JButton(); AddButton = new javax.swing.JButton(); ClearButton = new javax.swing.JButton(); background_green = new javax.swing.JLabel(); UpdateDetailsPanel = new javax.swing.JPanel(); EnterYourSearchLabel = new javax.swing.JLabel(); SearchText = new javax.swing.JTextField(); searchButton = new javax.swing.JButton(); WorkerIdRadioButton = new javax.swing.JRadioButton(); WorkerNameRadioButton = new javax.swing.JRadioButton(); FirstNamerLabel1 = new javax.swing.JLabel(); FirstNameText1 = new javax.swing.JTextField(); LastNamerLabel1 = new javax.swing.JLabel(); LastNameText1 = new javax.swing.JTextField(); PhoneLabel1 = new javax.swing.JLabel(); PhoneText1 = new javax.swing.JTextField(); AddressLabel1 = new javax.swing.JLabel(); AddressText1 = new javax.swing.JTextField(); BirthdateLabel1 = new javax.swing.JLabel(); BirthdayDateChooserText1 = new com.toedter.calendar.JDateChooser(); EmailLabel1 = new javax.swing.JLabel(); EmailText1 = new javax.swing.JTextField(); updateButton = new javax.swing.JButton(); ContractPanel = new javax.swing.JPanel(); contract_Label1 = new javax.swing.JLabel(); ContractIDLabel1 = new javax.swing.JLabel(); ContractIDText1 = new javax.swing.JTextField(); JobTitleLabel1 = new javax.swing.JLabel(); JobTitleText1 = new javax.swing.JTextField(); UploadText1 = new javax.swing.JTextField(); UploadContractButton1 = new javax.swing.JButton(); jLabel19 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); WorkersTable = new javax.swing.JTable(); RefreshButton = new javax.swing.JButton(); DeleteButton = new javax.swing.JButton(); jLabel7 = new javax.swing.JLabel(); SearchPanel = new javax.swing.JPanel(); EnterYourSearchLabel1 = new javax.swing.JLabel(); SearchText1 = new javax.swing.JTextField(); WorkerIdRadioButton1 = new javax.swing.JRadioButton(); WorkerNameRadioButton1 = new javax.swing.JRadioButton(); searchButton1 = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); WorkersTable1 = new javax.swing.JTable(); RefreshButton1 = new javax.swing.JButton(); Show_Contract_Button = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); ContractIDText2 = new javax.swing.JTextField(); ContractIDLabel2 = new javax.swing.JLabel(); customerTab = new javax.swing.JTabbedPane(); AddCustomerPanel = new javax.swing.JPanel(); CustomerIDText = new javax.swing.JTextField(); CustomerNameText = new javax.swing.JTextField(); CustomerAddressText = new javax.swing.JTextField(); CustomerPhoneText = new javax.swing.JTextField(); CustomerEmailText = new javax.swing.JTextField(); CustomerContractIDText = new javax.swing.JTextField(); AddCustomerButton = new javax.swing.JButton(); ClearCustomerButton = new javax.swing.JButton(); CustomerIDLabel = new javax.swing.JLabel(); CustomerNameLabel = new javax.swing.JLabel(); CustomerAddressLabel = new javax.swing.JLabel(); CustomerPhoneLabel = new javax.swing.JLabel(); CustomerEmailLabel = new javax.swing.JLabel(); CustomerContractLabel = new javax.swing.JLabel(); background_green5 = new javax.swing.JLabel(); UpdateDetailsCustomerPanel = new javax.swing.JPanel(); jScrollPane8 = new javax.swing.JScrollPane(); cusUpdateTable = new javax.swing.JTable(); EnterYourSearchLabel4 = new javax.swing.JLabel(); cusSearchUpdatetxt = new javax.swing.JTextField(); cusSearchUpdateButton = new javax.swing.JButton(); upCusNameRadioButton = new javax.swing.JRadioButton(); upcusIDRadioButton = new javax.swing.JRadioButton(); cusUpAddtxt = new javax.swing.JTextField(); cusUpPhonetxt = new javax.swing.JTextField(); cusUpMailtxt = new javax.swing.JTextField(); cusUpContarcttxt = new javax.swing.JTextField(); cusUpAddLabel = new javax.swing.JLabel(); cusUpPhoneLabel = new javax.swing.JLabel(); cusUpMailLabel = new javax.swing.JLabel(); cusUpContarctLabel = new javax.swing.JLabel(); cusUpdate = new javax.swing.JButton(); cusRefreshUpButton = new javax.swing.JButton(); cusDeleteButton = new javax.swing.JButton(); background_green6 = new javax.swing.JLabel(); SearchCustomerPanel = new javax.swing.JPanel(); EnterYourSearchLabel3 = new javax.swing.JLabel(); cusSearchtxt = new javax.swing.JTextField(); cusIDRadioButton = new javax.swing.JRadioButton(); cusNameRadioButton = new javax.swing.JRadioButton(); cusSearchButton = new javax.swing.JButton(); jScrollPane7 = new javax.swing.JScrollPane(); cusSearchTable = new javax.swing.JTable(); cusRefreshButton = new javax.swing.JButton(); background_green7 = new javax.swing.JLabel(); usersTab = new javax.swing.JTabbedPane(); AddUserPanel = new javax.swing.JPanel(); jScrollPane19 = new javax.swing.JScrollPane(); AddUserTable = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); WorkerDetailsLabel = new javax.swing.JLabel(); UserFirstNameLabel = new javax.swing.JLabel(); UserFirstNameText = new javax.swing.JTextField(); UserLastNameText = new javax.swing.JTextField(); UserLastNameLabel = new javax.swing.JLabel(); UserPhoneLabel = new javax.swing.JLabel(); UserPhoneText = new javax.swing.JTextField(); UserJobTitleText = new javax.swing.JTextField(); UserJobTitleLabel = new javax.swing.JLabel(); UserEmailText = new javax.swing.JTextField(); UserEmailLabel = new javax.swing.JLabel(); UserAddButton = new javax.swing.JButton(); UserClearButton = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); UserDetailsLabel = new javax.swing.JLabel(); UserNameLabel = new javax.swing.JLabel(); UserNameText = new javax.swing.JTextField(); UserPasswordLabel = new javax.swing.JLabel(); UserPasswordText = new javax.swing.JTextField(); jLabel43 = new javax.swing.JLabel(); UserPermissionLabel = new javax.swing.JLabel(); UserPermissionChoise = new java.awt.Choice(); EnterYourSearchLabel2 = new javax.swing.JLabel(); SearchText2 = new javax.swing.JTextField(); searchButton2 = new javax.swing.JButton(); WorkerIdRadioButton2 = new javax.swing.JRadioButton(); WorkerNameRadioButton2 = new javax.swing.JRadioButton(); background_green4 = new javax.swing.JLabel(); ExistingUserPanel = new javax.swing.JPanel(); jScrollPane20 = new javax.swing.JScrollPane(); ExistingUserTable = new javax.swing.JTable(); jPanel3 = new javax.swing.JPanel(); WorkerDetailsLabel1 = new javax.swing.JLabel(); ExistUserFirstNameLabel = new javax.swing.JLabel(); ExistUserLastNameLabel = new javax.swing.JLabel(); ExistUsernameLabel = new javax.swing.JLabel(); ExistUserPasswordLabel = new javax.swing.JLabel(); ExistUserPermissionLabel = new javax.swing.JLabel(); ExistUserPasswordText = new javax.swing.JTextField(); ExistUserFirstNameText = new javax.swing.JTextField(); ExistUserameText = new javax.swing.JTextField(); ExistUserLastNameText = new javax.swing.JTextField(); ExistUserPermissionText = new javax.swing.JTextField(); perlvlchoice = new java.awt.Choice(); updateExistUserButton = new javax.swing.JButton(); orderClearButton = new javax.swing.JButton(); background_green8 = new javax.swing.JLabel(); reportsTab = new javax.swing.JTabbedPane(); WorkersReportPanel = new javax.swing.JPanel(); genRepButton1 = new javax.swing.JToggleButton(); jLabel14 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); Show_report_Button1 = new javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); JobTitleChoice = new java.awt.Choice(); JobTitleChoice1 = new javax.swing.JLabel(); WorkersHistoryReportPanel = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); WorkersRepHistoryTable = new javax.swing.JTable(); showRepSearchButton = new javax.swing.JButton(); EnterYourSearchLabel5 = new javax.swing.JLabel(); repSearchButton = new javax.swing.JButton(); searchWorkerRepIDRadioButton = new javax.swing.JRadioButton(); searchWorkerRepJobTitleRadioButton = new javax.swing.JRadioButton(); searchWorkerRepDateRadioButton = new javax.swing.JRadioButton(); repWorkerJobTitlechoice = new java.awt.Choice(); repWorkerIDSearchtxt = new javax.swing.JTextField(); repWorkerDateSearchtxt = new com.toedter.calendar.JDateChooser(); RefreshButton2 = new javax.swing.JButton(); background_green9 = new javax.swing.JLabel(); logoutButton = new javax.swing.JButton(); manageUserButtonLabel = new javax.swing.JLabel(); changePasswordLabel = new javax.swing.JLabel(); dropManageUserLabel = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setUndecorated(true); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel1.setFont(new java.awt.Font("Calibri", 0, 24)); // NOI18N getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 150, 210, 50)); jLabel1.setText(loginGUI.username + " Is Logged in"); jSeparator1.setPreferredSize(new java.awt.Dimension(55, 10)); getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 222, 1240, 10)); jLabel4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel4MouseClicked(evt); } }); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(1223, 4, 55, 20)); jLabel3.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { jLabel3MouseMoved(evt); } }); jLabel3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel3MouseClicked(evt); } }); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(1151, 3, 35, 22)); customersButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Customers icon 60 x 50.png"))); // NOI18N customersButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { customersButtonActionPerformed(evt); } }); getContentPane().add(customersButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 110, 67, 60)); reportsButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Reports icon 53 x 50.png"))); // NOI18N reportsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { reportsButtonActionPerformed(evt); } }); getContentPane().add(reportsButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 110, 65, 60)); workersButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Workers icon 53 x 50.png"))); // NOI18N workersButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { workersButtonActionPerformed(evt); } }); getContentPane().add(workersButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 110, 65, 60)); usersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Users icon 53 x 50.png"))); // NOI18N usersButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { usersButtonActionPerformed(evt); } }); getContentPane().add(usersButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(670, 110, 65, -1)); WorkersTab.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N WorkersTab.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { WorkersTabMouseClicked(evt); } }); AddWorkerPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); WorkerIDLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerIDLabel.setText("Worker ID"); AddWorkerPanel.add(WorkerIDLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, -1, -1)); WorkerIDText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerIDTextActionPerformed(evt); } }); AddWorkerPanel.add(WorkerIDText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 70, 160, -1)); FirstNamerLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N FirstNamerLabel.setText("First Name"); AddWorkerPanel.add(FirstNamerLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 110, 70, -1)); FirstNamerText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { FirstNamerTextActionPerformed(evt); } }); AddWorkerPanel.add(FirstNamerText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 110, 160, -1)); LastNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N LastNameLabel.setText("Last Name"); AddWorkerPanel.add(LastNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 150, 80, -1)); LastNameText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LastNameTextActionPerformed(evt); } }); AddWorkerPanel.add(LastNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 150, 160, -1)); PhoneLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N PhoneLabel.setText("Phone Number"); AddWorkerPanel.add(PhoneLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 190, -1, -1)); PhoneText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PhoneTextActionPerformed(evt); } }); AddWorkerPanel.add(PhoneText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 190, 160, -1)); AddressLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N AddressLabel.setText("Address"); AddWorkerPanel.add(AddressLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 230, -1, -1)); AddressText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddressTextActionPerformed(evt); } }); AddWorkerPanel.add(AddressText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 230, 160, -1)); BirthdateLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N BirthdateLabel.setText("Birthdate"); AddWorkerPanel.add(BirthdateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 270, -1, -1)); AddWorkerPanel.add(BirthdayDateChooserText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 270, 160, -1)); EmailLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EmailLabel.setText("E-mail"); AddWorkerPanel.add(EmailLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 310, -1, -1)); EmailText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EmailTextActionPerformed(evt); } }); AddWorkerPanel.add(EmailText, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 310, 160, -1)); PersonalContractPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); PersonalContractPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); PersonalContractLabel.setFont(new java.awt.Font("Calibri", 0, 24)); // NOI18N PersonalContractLabel.setText("Personal Contract"); PersonalContractPanel.add(PersonalContractLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1)); ContractIDLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ContractIDLabel.setText("Contract ID"); PersonalContractPanel.add(ContractIDLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 50, -1, -1)); ContracdIDText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ContracdIDTextActionPerformed(evt); } }); PersonalContractPanel.add(ContracdIDText, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 50, 80, -1)); JobTitleLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N JobTitleLabel.setText("Job Title"); PersonalContractPanel.add(JobTitleLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 90, -1, -1)); JobTitleText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { JobTitleTextActionPerformed(evt); } }); PersonalContractPanel.add(JobTitleText, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 90, 80, -1)); UploadText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UploadTextActionPerformed(evt); } }); PersonalContractPanel.add(UploadText, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 50, 150, -1)); UploadContractButton.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N UploadContractButton.setText("Upload"); UploadContractButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UploadContractButtonActionPerformed(evt); } }); PersonalContractPanel.add(UploadContractButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 80, -1, -1)); ShowContractButton.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N ShowContractButton.setText("Show"); ShowContractButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ShowContractButtonActionPerformed(evt); } }); PersonalContractPanel.add(ShowContractButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 80, 70, -1)); AddWorkerPanel.add(PersonalContractPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 70, 387, 130)); AddButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N AddButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/plus_icon.png"))); // NOI18N AddButton.setText("Add"); AddButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddButtonActionPerformed(evt); } }); AddWorkerPanel.add(AddButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 210, -1, -1)); ClearButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N ClearButton.setText("Clear"); ClearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ClearButtonActionPerformed(evt); } }); AddWorkerPanel.add(ClearButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(830, 210, 100, 40)); background_green.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N background_green.setBorder(javax.swing.BorderFactory.createTitledBorder("")); AddWorkerPanel.add(background_green, new org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 0, 1260, 430)); WorkersTab.addTab("Add Worker", AddWorkerPanel); UpdateDetailsPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); EnterYourSearchLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EnterYourSearchLabel.setText("Enter your search"); UpdateDetailsPanel.add(EnterYourSearchLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); UpdateDetailsPanel.add(SearchText, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 160, -1)); searchButton.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N searchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/search.png"))); // NOI18N searchButton.setText("Search"); searchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchButtonActionPerformed(evt); } }); UpdateDetailsPanel.add(searchButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, -1, -1)); searchGroup.add(WorkerIdRadioButton); WorkerIdRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerIdRadioButton.setText("By ID"); WorkerIdRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); WorkerIdRadioButton.setBorderPainted(true); WorkerIdRadioButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); WorkerIdRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerIdRadioButtonActionPerformed(evt); } }); UpdateDetailsPanel.add(WorkerIdRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, 60, -1)); searchGroup.add(WorkerNameRadioButton); WorkerNameRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerNameRadioButton.setText("By Name"); WorkerNameRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); WorkerNameRadioButton.setBorderPainted(true); WorkerNameRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerNameRadioButtonActionPerformed(evt); } }); UpdateDetailsPanel.add(WorkerNameRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, 90, -1)); FirstNamerLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N FirstNamerLabel1.setText("First Name"); UpdateDetailsPanel.add(FirstNamerLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 130, 70, -1)); FirstNameText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { FirstNameText1ActionPerformed(evt); } }); UpdateDetailsPanel.add(FirstNameText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 130, 130, -1)); LastNamerLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N LastNamerLabel1.setText("Last Name"); UpdateDetailsPanel.add(LastNamerLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 170, 70, -1)); LastNameText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LastNameText1ActionPerformed(evt); } }); UpdateDetailsPanel.add(LastNameText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 170, 130, -1)); PhoneLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N PhoneLabel1.setText("Phone"); UpdateDetailsPanel.add(PhoneLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 210, 70, -1)); PhoneText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PhoneText1ActionPerformed(evt); } }); UpdateDetailsPanel.add(PhoneText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 210, 130, -1)); AddressLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N AddressLabel1.setText("Address"); UpdateDetailsPanel.add(AddressLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 250, 70, -1)); AddressText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddressText1ActionPerformed(evt); } }); UpdateDetailsPanel.add(AddressText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 250, 130, -1)); BirthdateLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N BirthdateLabel1.setText("Birthdate"); UpdateDetailsPanel.add(BirthdateLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 290, 70, -1)); BirthdayDateChooserText1.setDateFormatString("yyyy-MM-dd"); UpdateDetailsPanel.add(BirthdayDateChooserText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 290, 130, -1)); EmailLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EmailLabel1.setText("Email"); UpdateDetailsPanel.add(EmailLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 330, 70, -1)); EmailText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { EmailText1ActionPerformed(evt); } }); UpdateDetailsPanel.add(EmailText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 330, 170, -1)); updateButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N updateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/save-icon-30.png"))); // NOI18N updateButton.setText("Update"); updateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateButtonActionPerformed(evt); } }); UpdateDetailsPanel.add(updateButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(740, 250, -1, -1)); ContractPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); ContractPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); contract_Label1.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N contract_Label1.setText("Contract Update"); ContractPanel.add(contract_Label1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 170, 30)); ContractIDLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ContractIDLabel1.setText("Contract ID"); ContractPanel.add(ContractIDLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1)); ContractIDText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ContractIDText1ActionPerformed(evt); } }); ContractPanel.add(ContractIDText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 40, 80, -1)); JobTitleLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N JobTitleLabel1.setText("Job Title"); ContractPanel.add(JobTitleLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, -1, -1)); JobTitleText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { JobTitleText1ActionPerformed(evt); } }); ContractPanel.add(JobTitleText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 90, 80, -1)); UploadText1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UploadText1ActionPerformed(evt); } }); ContractPanel.add(UploadText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 40, 150, -1)); UploadContractButton1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N UploadContractButton1.setText("Upload"); UploadContractButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UploadContractButton1ActionPerformed(evt); } }); ContractPanel.add(UploadContractButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 90, -1, -1)); jLabel19.setFont(new java.awt.Font("Calibri", 0, 11)); // NOI18N jLabel19.setForeground(new java.awt.Color(255, 0, 0)); jLabel19.setText("Please upload the new contract if changes are made"); ContractPanel.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 70, -1, -1)); jButton2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N jButton2.setText("Show"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); ContractPanel.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 90, 70, -1)); UpdateDetailsPanel.add(ContractPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 250, 370, 130)); WorkersTable .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" })); WorkersTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { WorkersTableMouseClicked(evt); } }); jScrollPane1.setViewportView(WorkersTable); UpdateDetailsPanel.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 20, 800, 220)); RefreshButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N RefreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/refresh.png"))); // NOI18N RefreshButton.setText("Refresh"); RefreshButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RefreshButtonActionPerformed(evt); } }); UpdateDetailsPanel.add(RefreshButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(1010, 250, -1, -1)); DeleteButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N DeleteButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/delete icon.png"))); // NOI18N DeleteButton.setText("Delete"); DeleteButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { DeleteButtonActionPerformed(evt); } }); UpdateDetailsPanel.add(DeleteButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 250, -1, -1)); jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N UpdateDetailsPanel.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); WorkersTab.addTab("Update Details", UpdateDetailsPanel); SearchPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); EnterYourSearchLabel1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EnterYourSearchLabel1.setText("Enter your search"); SearchPanel.add(EnterYourSearchLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); SearchPanel.add(SearchText1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 160, -1)); searchGroup.add(WorkerIdRadioButton1); WorkerIdRadioButton1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerIdRadioButton1.setText("By ID"); WorkerIdRadioButton1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); WorkerIdRadioButton1.setBorderPainted(true); WorkerIdRadioButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); WorkerIdRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerIdRadioButton1ActionPerformed(evt); } }); SearchPanel.add(WorkerIdRadioButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, 60, -1)); searchGroup.add(WorkerNameRadioButton1); WorkerNameRadioButton1.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerNameRadioButton1.setText("By Name"); WorkerNameRadioButton1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); WorkerNameRadioButton1.setBorderPainted(true); WorkerNameRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerNameRadioButton1ActionPerformed(evt); } }); SearchPanel.add(WorkerNameRadioButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, 90, -1)); searchButton1.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N searchButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/search.png"))); // NOI18N searchButton1.setText("Search"); searchButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchButton1ActionPerformed(evt); } }); SearchPanel.add(searchButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, -1, -1)); WorkersTable1 .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" })); WorkersTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { WorkersTable1MouseClicked(evt); } }); jScrollPane2.setViewportView(WorkersTable1); SearchPanel.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 20, 800, 220)); RefreshButton1.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N RefreshButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/refresh.png"))); // NOI18N RefreshButton1.setText("Refresh"); RefreshButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RefreshButton1ActionPerformed(evt); } }); SearchPanel.add(RefreshButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1010, 250, -1, -1)); Show_Contract_Button.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N Show_Contract_Button .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icon-service-contract.png"))); // NOI18N Show_Contract_Button.setText("Show Contract"); Show_Contract_Button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Show_Contract_ButtonActionPerformed(evt); } }); SearchPanel.add(Show_Contract_Button, new org.netbeans.lib.awtextra.AbsoluteConstraints(800, 250, 190, 40)); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N SearchPanel.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); ContractIDText2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ContractIDText2ActionPerformed(evt); } }); SearchPanel.add(ContractIDText2, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 160, 80, -1)); ContractIDLabel2.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ContractIDLabel2.setText("Contract ID"); SearchPanel.add(ContractIDLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, -1, -1)); WorkersTab.addTab("Search", SearchPanel); customerTab.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N customerTab.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { customerTabMouseClicked(evt); } }); AddCustomerPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); CustomerIDText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CustomerIDTextActionPerformed(evt); } }); AddCustomerPanel.add(CustomerIDText, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 70, 118, -1)); AddCustomerPanel.add(CustomerNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 120, 118, -1)); AddCustomerPanel.add(CustomerAddressText, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 170, 118, -1)); AddCustomerPanel.add(CustomerPhoneText, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 220, 118, -1)); AddCustomerPanel.add(CustomerEmailText, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 270, 118, -1)); CustomerContractIDText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CustomerContractIDTextActionPerformed(evt); } }); AddCustomerPanel.add(CustomerContractIDText, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 320, 118, -1)); AddCustomerButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N AddCustomerButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/plus_icon.png"))); // NOI18N AddCustomerButton.setText("Add"); AddCustomerButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddCustomerButtonActionPerformed(evt); } }); AddCustomerPanel.add(AddCustomerButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 330, -1, -1)); ClearCustomerButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N ClearCustomerButton.setText("Clear"); ClearCustomerButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ClearCustomerButtonActionPerformed(evt); } }); AddCustomerPanel.add(ClearCustomerButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 330, 100, 40)); CustomerIDLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N CustomerIDLabel.setText("Customer ID"); AddCustomerPanel.add(CustomerIDLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 70, -1, -1)); CustomerNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N CustomerNameLabel.setText("Customer Name"); AddCustomerPanel.add(CustomerNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 120, -1, -1)); CustomerAddressLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N CustomerAddressLabel.setText("Address"); AddCustomerPanel.add(CustomerAddressLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 170, -1, -1)); CustomerPhoneLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N CustomerPhoneLabel.setText("Phone"); AddCustomerPanel.add(CustomerPhoneLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 220, -1, -1)); CustomerEmailLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N CustomerEmailLabel.setText("E-mail"); AddCustomerPanel.add(CustomerEmailLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 270, -1, -1)); CustomerContractLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N CustomerContractLabel.setText("Contract ID"); AddCustomerPanel.add(CustomerContractLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 320, -1, -1)); background_green5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N AddCustomerPanel.add(background_green5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); customerTab.addTab("Add Customer", AddCustomerPanel); UpdateDetailsCustomerPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); cusUpdateTable.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null, null, null }, { null, null, null, null, null, null }, { null, null, null, null, null, null }, { null, null, null, null, null, null } }, new String[] { "Customer ID", "Customer Name", "Address", "Phone", "E-Mail", "Contract" })); cusUpdateTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { cusUpdateTableMouseClicked(evt); } }); jScrollPane8.setViewportView(cusUpdateTable); UpdateDetailsCustomerPanel.add(jScrollPane8, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 20, 800, 220)); EnterYourSearchLabel4.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EnterYourSearchLabel4.setText("Enter your search"); UpdateDetailsCustomerPanel.add(EnterYourSearchLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); UpdateDetailsCustomerPanel.add(cusSearchUpdatetxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 160, -1)); cusSearchUpdateButton.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N cusSearchUpdateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/search.png"))); // NOI18N cusSearchUpdateButton.setText("Search"); cusSearchUpdateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusSearchUpdateButtonActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(cusSearchUpdateButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, -1, -1)); upCusNameRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N upCusNameRadioButton.setText("By Name"); upCusNameRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); upCusNameRadioButton.setBorderPainted(true); upCusNameRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upCusNameRadioButtonActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(upCusNameRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, 90, -1)); upcusIDRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N upcusIDRadioButton.setText("By ID"); upcusIDRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); upcusIDRadioButton.setBorderPainted(true); upcusIDRadioButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); upcusIDRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upcusIDRadioButtonActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(upcusIDRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, 60, -1)); cusUpAddtxt.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusUpAddtxtActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(cusUpAddtxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 130, 150, -1)); UpdateDetailsCustomerPanel.add(cusUpPhonetxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 170, 150, -1)); UpdateDetailsCustomerPanel.add(cusUpMailtxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 210, 150, -1)); UpdateDetailsCustomerPanel.add(cusUpContarcttxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 250, 150, -1)); cusUpAddLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N cusUpAddLabel.setText("Address"); UpdateDetailsCustomerPanel.add(cusUpAddLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 130, -1, -1)); cusUpPhoneLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N cusUpPhoneLabel.setText("Phone"); UpdateDetailsCustomerPanel.add(cusUpPhoneLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 170, -1, -1)); cusUpMailLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N cusUpMailLabel.setText("E-Mail"); UpdateDetailsCustomerPanel.add(cusUpMailLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 210, -1, -1)); cusUpContarctLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N cusUpContarctLabel.setText("Contract ID"); UpdateDetailsCustomerPanel.add(cusUpContarctLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 250, -1, -1)); cusUpdate.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N cusUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/save-icon-30.png"))); // NOI18N cusUpdate.setText("Update"); cusUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusUpdateActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(cusUpdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(740, 250, -1, -1)); cusRefreshUpButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N cusRefreshUpButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/refresh.png"))); // NOI18N cusRefreshUpButton.setText("Refresh"); cusRefreshUpButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusRefreshUpButtonActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(cusRefreshUpButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(1010, 250, -1, -1)); cusDeleteButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N cusDeleteButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/delete icon.png"))); // NOI18N cusDeleteButton.setText("Delete"); cusDeleteButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusDeleteButtonActionPerformed(evt); } }); UpdateDetailsCustomerPanel.add(cusDeleteButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 250, -1, -1)); background_green6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N UpdateDetailsCustomerPanel.add(background_green6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); customerTab.addTab("Update Details", UpdateDetailsCustomerPanel); SearchCustomerPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); EnterYourSearchLabel3.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EnterYourSearchLabel3.setText("Enter your search"); SearchCustomerPanel.add(EnterYourSearchLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); SearchCustomerPanel.add(cusSearchtxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 160, -1)); cusIDRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N cusIDRadioButton.setText("By ID"); cusIDRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); cusIDRadioButton.setBorderPainted(true); cusIDRadioButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); cusIDRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusIDRadioButtonActionPerformed(evt); } }); SearchCustomerPanel.add(cusIDRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, 60, -1)); cusNameRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N cusNameRadioButton.setText("By Name"); cusNameRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); cusNameRadioButton.setBorderPainted(true); cusNameRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusNameRadioButtonActionPerformed(evt); } }); SearchCustomerPanel.add(cusNameRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, 90, -1)); cusSearchButton.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N cusSearchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/search.png"))); // NOI18N cusSearchButton.setText("Search"); cusSearchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusSearchButtonActionPerformed(evt); } }); SearchCustomerPanel.add(cusSearchButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, -1, -1)); cusSearchTable.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null, null, null }, { null, null, null, null, null, null }, { null, null, null, null, null, null }, { null, null, null, null, null, null } }, new String[] { "Customer ID", "Customer Name", "Address", "Phone", "Email", "Contract ID" }) { boolean[] canEdit = new boolean[] { false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); cusSearchTable.setFocusCycleRoot(true); cusSearchTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { cusSearchTableMouseClicked(evt); } }); jScrollPane7.setViewportView(cusSearchTable); SearchCustomerPanel.add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 20, 800, 220)); cusRefreshButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N cusRefreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/refresh.png"))); // NOI18N cusRefreshButton.setText("Refresh"); cusRefreshButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cusRefreshButtonActionPerformed(evt); } }); SearchCustomerPanel.add(cusRefreshButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(1010, 250, -1, -1)); background_green7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N SearchCustomerPanel.add(background_green7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); customerTab.addTab("Search", SearchCustomerPanel); usersTab.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N usersTab.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { usersTabMouseClicked(evt); } }); AddUserPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); AddUserTable .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" })); AddUserTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { AddUserTableMouseClicked(evt); } }); jScrollPane19.setViewportView(AddUserTable); AddUserPanel.add(jScrollPane19, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 20, 800, 220)); jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); WorkerDetailsLabel.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N WorkerDetailsLabel.setText("Worker Details"); jPanel1.add(WorkerDetailsLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1)); UserFirstNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserFirstNameLabel.setText("First Name"); jPanel1.add(UserFirstNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 60, -1, -1)); UserFirstNameText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserFirstNameTextActionPerformed(evt); } }); jPanel1.add(UserFirstNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 60, 130, -1)); UserLastNameText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserLastNameTextActionPerformed(evt); } }); jPanel1.add(UserLastNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 100, 130, -1)); UserLastNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserLastNameLabel.setText("Last Name"); jPanel1.add(UserLastNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 100, 70, -1)); UserPhoneLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserPhoneLabel.setText("Phone"); jPanel1.add(UserPhoneLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 140, 70, -1)); UserPhoneText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserPhoneTextActionPerformed(evt); } }); jPanel1.add(UserPhoneText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 140, 130, -1)); UserJobTitleText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserJobTitleTextActionPerformed(evt); } }); jPanel1.add(UserJobTitleText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 180, 130, -1)); UserJobTitleLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserJobTitleLabel.setText("Job Title"); jPanel1.add(UserJobTitleLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, 70, -1)); UserEmailText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserEmailTextActionPerformed(evt); } }); jPanel1.add(UserEmailText, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 220, 160, -1)); UserEmailLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserEmailLabel.setText("Email"); jPanel1.add(UserEmailLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 220, 70, -1)); AddUserPanel.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 130, 320, 260)); UserAddButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N UserAddButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/plus_icon.png"))); // NOI18N UserAddButton.setText("Add"); UserAddButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserAddButtonActionPerformed(evt); } }); AddUserPanel.add(UserAddButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(910, 260, -1, -1)); UserClearButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N UserClearButton.setText("Clear"); UserClearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserClearButtonActionPerformed(evt); } }); AddUserPanel.add(UserClearButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(1030, 260, 110, 40)); jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); UserDetailsLabel.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N UserDetailsLabel.setText("Fill User Details"); jPanel2.add(UserDetailsLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1)); UserNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserNameLabel.setText("Username"); jPanel2.add(UserNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1)); UserNameText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserNameTextActionPerformed(evt); } }); jPanel2.add(UserNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 50, 130, -1)); UserPasswordLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserPasswordLabel.setText("Password"); jPanel2.add(UserPasswordLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, -1, -1)); UserPasswordText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UserPasswordTextActionPerformed(evt); } }); jPanel2.add(UserPasswordText, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, 130, -1)); jLabel43.setFont(new java.awt.Font("Calibri", 0, 11)); // NOI18N jLabel43.setForeground(new java.awt.Color(255, 0, 0)); jLabel43.setText("Password Must be 6 letters at least "); jPanel2.add(jLabel43, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1)); UserPermissionLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N UserPermissionLabel.setText("Permission Level"); jPanel2.add(UserPermissionLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 50, -1, -1)); UserPermissionChoise.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { UserPermissionChoiseMouseClicked(evt); } }); jPanel2.add(UserPermissionChoise, new org.netbeans.lib.awtextra.AbsoluteConstraints(400, 50, 60, -1)); UserPermissionChoise.addItem("0"); UserPermissionChoise.addItem("1"); UserPermissionChoise.addItem("2"); UserPermissionChoise.addItem("3"); AddUserPanel.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 250, 480, 140)); EnterYourSearchLabel2.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EnterYourSearchLabel2.setText("Enter your search"); AddUserPanel.add(EnterYourSearchLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); AddUserPanel.add(SearchText2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 160, -1)); searchButton2.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N searchButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/search.png"))); // NOI18N searchButton2.setText("Search"); searchButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchButton2ActionPerformed(evt); } }); AddUserPanel.add(searchButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, -1, -1)); WorkerIdRadioButton2.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerIdRadioButton2.setText("By ID"); WorkerIdRadioButton2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); WorkerIdRadioButton2.setBorderPainted(true); WorkerIdRadioButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); WorkerIdRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerIdRadioButton2ActionPerformed(evt); } }); AddUserPanel.add(WorkerIdRadioButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, 60, -1)); WorkerNameRadioButton2.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N WorkerNameRadioButton2.setText("By Name"); WorkerNameRadioButton2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); WorkerNameRadioButton2.setBorderPainted(true); WorkerNameRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { WorkerNameRadioButton2ActionPerformed(evt); } }); AddUserPanel.add(WorkerNameRadioButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 80, 90, -1)); background_green4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N AddUserPanel.add(background_green4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, -20, 1250, 470)); usersTab.addTab("Add User", AddUserPanel); ExistingUserPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); ExistingUserTable .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" })); ExistingUserTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { ExistingUserTableMouseClicked(evt); } }); jScrollPane20.setViewportView(ExistingUserTable); ExistingUserPanel.add(jScrollPane20, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 20, 800, 220)); jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); WorkerDetailsLabel1.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N WorkerDetailsLabel1.setText("User Details"); jPanel3.add(WorkerDetailsLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1)); ExistUserFirstNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ExistUserFirstNameLabel.setText("First Name"); jPanel3.add(ExistUserFirstNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 60, -1, -1)); ExistUserLastNameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ExistUserLastNameLabel.setText("Last Name"); jPanel3.add(ExistUserLastNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 100, 70, -1)); ExistUsernameLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ExistUsernameLabel.setText("User Name"); jPanel3.add(ExistUsernameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 140, 80, -1)); ExistUserPasswordLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ExistUserPasswordLabel.setText("Password"); jPanel3.add(ExistUserPasswordLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, 70, -1)); ExistUserPermissionLabel.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N ExistUserPermissionLabel.setText("Permission Level"); jPanel3.add(ExistUserPermissionLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 220, 110, -1)); jPanel3.add(ExistUserPasswordText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 180, 130, -1)); jPanel3.add(ExistUserFirstNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 60, 130, -1)); jPanel3.add(ExistUserameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 140, 130, -1)); jPanel3.add(ExistUserLastNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 100, 130, -1)); ExistUserPermissionText.setEditable(false); jPanel3.add(ExistUserPermissionText, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 220, 50, -1)); jPanel3.add(perlvlchoice, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 220, 90, -1)); perlvlchoice.addItem("0"); perlvlchoice.addItem("1"); perlvlchoice.addItem("2"); perlvlchoice.addItem("3"); ExistingUserPanel.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 320, 260)); updateExistUserButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N updateExistUserButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/save-icon-30.png"))); // NOI18N updateExistUserButton.setText("Update"); updateExistUserButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateExistUserButtonActionPerformed(evt); } }); ExistingUserPanel.add(updateExistUserButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(890, 250, -1, -1)); orderClearButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N orderClearButton.setText("Clear"); orderClearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { orderClearButtonActionPerformed(evt); } }); ExistingUserPanel.add(orderClearButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(1030, 250, 100, 40)); background_green8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N ExistingUserPanel.add(background_green8, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, -20, 1250, 470)); usersTab.addTab("Existing User", ExistingUserPanel); reportsTab.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N reportsTab.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { reportsTabMouseClicked(evt); } }); WorkersReportPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); genRepButton1.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N genRepButton1.setText("Generate Report"); genRepButton1.setOpaque(true); genRepButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { genRepButton1ActionPerformed(evt); } }); WorkersReportPanel.add(genRepButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 150, -1, 40)); jLabel14.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N jLabel14.setText("This report shows all workers by their job titles. "); WorkersReportPanel.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 70, -1, -1)); jLabel9.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N jLabel9.setText("You can see the report here "); WorkersReportPanel.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 230, -1, -1)); Show_report_Button1.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N Show_report_Button1 .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icon-service-contract.png"))); // NOI18N Show_report_Button1.setText("Show Report"); Show_report_Button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Show_report_Button1ActionPerformed(evt); } }); WorkersReportPanel.add(Show_report_Button1, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 220, 180, 40)); jLabel11.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N jLabel11.setText("Click on "); WorkersReportPanel.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 160, -1, -1)); jLabel12.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N jLabel12.setText("Choose worker job title"); WorkersReportPanel.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 110, -1, -1)); try { String sn; String sql = "select distinct job_title from workers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { sn = rs.getString("job_title"); JobTitleChoice.addItem(sn); } JobTitleChoice.addItem("All"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } WorkersReportPanel.add(JobTitleChoice, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 110, 120, -1)); JobTitleChoice1.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N JobTitleChoice1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N WorkersReportPanel.add(JobTitleChoice1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); reportsTab.addTab("Workers Report", WorkersReportPanel); WorkersHistoryReportPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); WorkersRepHistoryTable .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" })); WorkersRepHistoryTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { WorkersRepHistoryTableMouseClicked(evt); } }); jScrollPane3.setViewportView(WorkersRepHistoryTable); WorkersHistoryReportPanel.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 20, 700, 290)); showRepSearchButton.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N showRepSearchButton .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icon-service-contract.png"))); // NOI18N showRepSearchButton.setText("Show Report"); showRepSearchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showRepSearchButtonActionPerformed(evt); } }); WorkersHistoryReportPanel.add(showRepSearchButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(780, 320, -1, -1)); EnterYourSearchLabel5.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N EnterYourSearchLabel5.setText("Enter your search"); WorkersHistoryReportPanel.add(EnterYourSearchLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); repSearchButton.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N repSearchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/search.png"))); // NOI18N repSearchButton.setText("Search"); repSearchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { repSearchButtonActionPerformed(evt); } }); WorkersHistoryReportPanel.add(repSearchButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 40, -1, -1)); WorkerHistoryGroup.add(searchWorkerRepIDRadioButton); searchWorkerRepIDRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N searchWorkerRepIDRadioButton.setText("By Report ID"); searchWorkerRepIDRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); searchWorkerRepIDRadioButton.setBorderPainted(true); searchWorkerRepIDRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchWorkerRepIDRadioButtonActionPerformed(evt); } }); WorkersHistoryReportPanel.add(searchWorkerRepIDRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 90, 110, -1)); WorkerHistoryGroup.add(searchWorkerRepJobTitleRadioButton); searchWorkerRepJobTitleRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N searchWorkerRepJobTitleRadioButton.setText("By Job Title"); searchWorkerRepJobTitleRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); searchWorkerRepJobTitleRadioButton.setBorderPainted(true); searchWorkerRepJobTitleRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchWorkerRepJobTitleRadioButtonActionPerformed(evt); } }); WorkersHistoryReportPanel.add(searchWorkerRepJobTitleRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 90, 100, -1)); WorkerHistoryGroup.add(searchWorkerRepDateRadioButton); searchWorkerRepDateRadioButton.setFont(new java.awt.Font("Calibri", 0, 16)); // NOI18N searchWorkerRepDateRadioButton.setText("By Creation Date"); searchWorkerRepDateRadioButton.setBorder(javax.swing.BorderFactory.createEtchedBorder()); searchWorkerRepDateRadioButton.setBorderPainted(true); searchWorkerRepDateRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchWorkerRepDateRadioButtonActionPerformed(evt); } }); WorkersHistoryReportPanel.add(searchWorkerRepDateRadioButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 90, 140, -1)); try { String sn; String sql = "select distinct job_title from workers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { sn = rs.getString("job_title"); repWorkerJobTitlechoice.addItem(sn); } repWorkerJobTitlechoice.addItem("All"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } WorkersHistoryReportPanel.add(repWorkerJobTitlechoice, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 150, -1)); WorkersHistoryReportPanel.add(repWorkerIDSearchtxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 150, -1)); repWorkerDateSearchtxt.setDateFormatString("yyyy-MM-dd"); WorkersHistoryReportPanel.add(repWorkerDateSearchtxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 150, -1)); RefreshButton2.setFont(new java.awt.Font("Calibri", 0, 20)); // NOI18N RefreshButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/refresh.png"))); // NOI18N RefreshButton2.setText("Refresh"); RefreshButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RefreshButton2ActionPerformed(evt); } }); WorkersHistoryReportPanel.add(RefreshButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(970, 320, -1, -1)); background_green9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/background.png"))); // NOI18N WorkersHistoryReportPanel.add(background_green9, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1250, 430)); reportsTab.addTab("History", WorkersHistoryReportPanel); javax.swing.GroupLayout jLayeredPane1Layout = new javax.swing.GroupLayout(jLayeredPane1); jLayeredPane1.setLayout(jLayeredPane1Layout); jLayeredPane1Layout.setHorizontalGroup( jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(WorkersTab, javax.swing.GroupLayout.DEFAULT_SIZE, 1270, Short.MAX_VALUE) .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jLayeredPane1Layout.createSequentialGroup().addComponent(customerTab) .addContainerGap())) .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jLayeredPane1Layout.createSequentialGroup() .addComponent(usersTab, javax.swing.GroupLayout.PREFERRED_SIZE, 1257, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 13, Short.MAX_VALUE))) .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jLayeredPane1Layout .createSequentialGroup().addComponent(reportsTab).addContainerGap()))); jLayeredPane1Layout.setVerticalGroup(jLayeredPane1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(WorkersTab, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 564, Short.MAX_VALUE) .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jLayeredPane1Layout.createSequentialGroup().addComponent(customerTab) .addContainerGap())) .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jLayeredPane1Layout.createSequentialGroup() .addComponent(usersTab, javax.swing.GroupLayout.PREFERRED_SIZE, 564, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addGroup(jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(reportsTab, javax.swing.GroupLayout.DEFAULT_SIZE, 564, Short.MAX_VALUE))); jLayeredPane1.setLayer(WorkersTab, javax.swing.JLayeredPane.DEFAULT_LAYER); jLayeredPane1.setLayer(customerTab, javax.swing.JLayeredPane.DEFAULT_LAYER); jLayeredPane1.setLayer(usersTab, javax.swing.JLayeredPane.DEFAULT_LAYER); jLayeredPane1.setLayer(reportsTab, javax.swing.JLayeredPane.DEFAULT_LAYER); getContentPane().add(jLayeredPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 230, 1240, 430)); logoutButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/logout button.png"))); // NOI18N logoutButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { logoutButtonActionPerformed(evt); } }); getContentPane().add(logoutButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 100, 30, 30)); manageUserButtonLabel.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N manageUserButtonLabel.setText("Manage user"); manageUserButtonLabel .setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); manageUserButtonLabel.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { manageUserButtonLabelMouseReleased(evt); } }); getContentPane().add(manageUserButtonLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 110, 80, 20)); changePasswordLabel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { changePasswordLabelMouseMoved(evt); } }); changePasswordLabel.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { changePasswordLabelMouseClicked(evt); } }); getContentPane().add(changePasswordLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(164, 112, 106, 17)); dropManageUserLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/menu.png"))); // NOI18N dropManageUserLabel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { dropManageUserLabelMouseMoved(evt); } }); getContentPane().add(dropManageUserLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 110, 120, 40)); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setIcon( new javax.swing.ImageIcon(getClass().getResource("/Images/ ? .png"))); // NOI18N jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 3)); jLabel2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { jLabel2MouseMoved(evt); } }); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1280, 680)); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseClicked System.exit(0); }//GEN-LAST:event_jLabel4MouseClicked private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked this.setState(welcome0.ICONIFIED); }//GEN-LAST:event_jLabel3MouseClicked private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed this.setVisible(false); loginGUI lg = new loginGUI(1); lg.setVisible(true); }//GEN-LAST:event_logoutButtonActionPerformed private void customersButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customersButtonActionPerformed WorkersTab.setVisible(false); customerTab.setVisible(true); usersTab.setVisible(false); reportsTab.setVisible(false); }//GEN-LAST:event_customersButtonActionPerformed private void FirstNamerTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FirstNamerTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_FirstNamerTextActionPerformed private void PhoneTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_PhoneTextActionPerformed private void EmailTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EmailTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_EmailTextActionPerformed private void WorkerIDTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerIDTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_WorkerIDTextActionPerformed /* */ private void workersButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_workersButtonActionPerformed WorkersTab.setVisible(true); customerTab.setVisible(false); usersTab.setVisible(false); reportsTab.setVisible(false); }//GEN-LAST:event_workersButtonActionPerformed private void LastNameTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LastNameTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_LastNameTextActionPerformed private void JobTitleTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JobTitleTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_JobTitleTextActionPerformed private void UploadTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UploadTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UploadTextActionPerformed private void UploadContractButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UploadContractButtonActionPerformed try { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Open a File"); FileNameExtensionFilter docFilter = new FileNameExtensionFilter("Word Files", "docx"); FileNameExtensionFilter pdfFilter = new FileNameExtensionFilter("PDF Documents", "pdf"); chooser.addChoosableFileFilter(docFilter); chooser.addChoosableFileFilter(pdfFilter); int result = chooser.showOpenDialog(null); if (result == 0) { File f = chooser.getSelectedFile(); filename = f.getAbsolutePath(); UploadText.setText(filename); f.getAbsoluteFile(); } } //GEN-LAST:event_UploadContractButtonActionPerformed catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void ContracdIDTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContracdIDTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ContracdIDTextActionPerformed private void ShowContractButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShowContractButtonActionPerformed try { Desktop.getDesktop().open(new File(filename)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_ShowContractButtonActionPerformed private void WorkersTabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_WorkersTabMouseClicked update_table(); Uptade_search_table(); }//GEN-LAST:event_WorkersTabMouseClicked private void AddressTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddressTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_AddressTextActionPerformed private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddButtonActionPerformed int f = 0; int h = 0; fn = ContracdIDText.getText(); int ans; try { String sql = "Insert into workers (worker_id,first_name,last_name,worker_phone,worker_add,contract_id,job_title,birth_date,email) values(?,?,?,?,?,?,?,?,?)"; pst = conn.prepareStatement(sql); pst.setString(1, WorkerIDText.getText()); pst.setString(2, FirstNamerText.getText()); pst.setString(3, LastNameText.getText()); pst.setString(4, PhoneText.getText()); pst.setString(5, AddressText.getText()); pst.setString(6, ContracdIDText.getText()); pst.setString(7, JobTitleText.getText()); pst.setDate(8, new java.sql.Date(BirthdayDateChooserText.getDate().getTime())); pst.setString(9, EmailText.getText()); if (UploadText.getText().isEmpty()) { ans = JOptionPane.showConfirmDialog(null, "Are You Sure You Want To Add a Worker Without a Contract?", "Warning!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ans == 0) pst.execute(); if (ans == 1) { } } else { Path dest = Paths.get("src/WorkerContracts/" + fn + ".pdf"); Path source = Paths.get(filename); Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING); pst.execute(); } JOptionPane.showMessageDialog(null, "Worker Has Been Added"); } catch (Exception e) { h = 1; if (WorkerIDText.getText().isEmpty()) WorkerIDText.setBackground(Color.red); else WorkerIDText.setBackground(Color.white); if (FirstNamerText.getText().isEmpty()) FirstNamerText.setBackground(Color.red); else FirstNamerText.setBackground(Color.white); if (LastNameText.getText().isEmpty()) LastNameText.setBackground(Color.red); else LastNameText.setBackground(Color.white); if (PhoneText.getText().isEmpty()) PhoneText.setBackground(Color.red); else PhoneText.setBackground(Color.white); if (AddressText.getText().isEmpty()) AddressText.setBackground(Color.red); else AddressText.setBackground(Color.white); if (ContracdIDText.getText().isEmpty()) ContracdIDText.setBackground(Color.red); else ContracdIDText.setBackground(Color.white); if (JobTitleText.getText().isEmpty()) JobTitleText.setBackground(Color.red); else JobTitleText.setBackground(Color.white); if (EmailText.getText().isEmpty()) EmailText.setBackground(Color.red); else EmailText.setBackground(Color.white); if (f != 2) { JOptionPane.showMessageDialog(null, "The Marked Fields Are Empty\n Please Fill All Fields", "Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(null, e); } } if (f == 0 && h == 0) { WorkerIDText.setText(""); FirstNamerText.setText(""); LastNameText.setText(""); PhoneText.setText(""); AddressText.setText(""); ContracdIDText.setText(""); JobTitleText.setText(""); EmailText.setText(""); BirthdayDateChooserText.setCalendar(null); UploadText.setText(""); } }//GEN-LAST:event_AddButtonActionPerformed private void ClearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearButtonActionPerformed WorkerIDText.setText(""); FirstNamerText.setText(""); LastNameText.setText(""); PhoneText.setText(""); AddressText.setText(""); ContracdIDText.setText(""); JobTitleText.setText(""); BirthdayDateChooserText.setCalendar(null); EmailText.setText(""); UploadText.setText(""); }//GEN-LAST:event_ClearButtonActionPerformed private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed if (searchmethod.equals("worker_id")) { try { String sn = SearchText.getText(); String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone No',worker_add as 'Address',contract_id as 'Contract ID',job_title as 'Job Title',birth_date as 'Birth Date',email as 'Email' from workers where worker_id='" + sn + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else if (searchmethod.equals("first_name") || searchmethod2.equals("last_name")) { try { String sn = SearchText.getText(); String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone No',worker_add as 'Address',contract_id as 'Contract ID',job_title as 'Job Title',birth_date as 'Birth Date',email as 'Email' from workers where first_name='" + sn + "' OR last_name='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }//GEN-LAST:event_searchButtonActionPerformed private void WorkerIdRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerIdRadioButtonActionPerformed searchmethod = "worker_id"; }//GEN-LAST:event_WorkerIdRadioButtonActionPerformed private void WorkerNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerNameRadioButtonActionPerformed searchmethod = "first_name"; searchmethod2 = "last_name"; }//GEN-LAST:event_WorkerNameRadioButtonActionPerformed private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed fn = ContractIDText1.getText(); try { String vf = FirstNameText1.getText(); String vl = LastNameText1.getText(); Date vd = new java.sql.Date(BirthdayDateChooserText1.getDate().getTime()); String va = AddressText1.getText(); String vp = PhoneText1.getText(); String vc = ContractIDText1.getText(); String vj = JobTitleText1.getText(); String ve = EmailText1.getText(); String sql = "update workers set first_name='" + vf + "',last_name='" + vl + "',worker_add='" + va + "',worker_phone='" + vp + "',email='" + ve + "',job_title='" + vj + "',contract_id='" + vc + "',birth_date='" + vd + "' where worker_id='" + tableClick + "'"; pst = conn.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(null, "Worker Details Updated"); update_table(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } try { if (!UploadText1.getText().isEmpty()) { Path dest = Paths.get("src/WorkerContracts/" + fn + ".pdf"); Path source = Paths.get(filename_update); Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING); FirstNameText1.setText(" "); LastNameText1.setText(" "); BirthdayDateChooserText1.setCalendar(null); AddressText1.setText(" "); PhoneText1.setText(" "); ContractIDText1.setText(" "); JobTitleText1.setText(" "); EmailText1.setText(" "); UploadText1.setText(" "); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_updateButtonActionPerformed private void EmailText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EmailText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_EmailText1ActionPerformed private void FirstNameText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FirstNameText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_FirstNameText1ActionPerformed private void LastNameText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LastNameText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_LastNameText1ActionPerformed private void PhoneText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PhoneText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_PhoneText1ActionPerformed private void AddressText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddressText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_AddressText1ActionPerformed private void JobTitleText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JobTitleText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_JobTitleText1ActionPerformed private void ContractIDText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContractIDText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ContractIDText1ActionPerformed private void UploadText1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UploadText1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UploadText1ActionPerformed private void UploadContractButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UploadContractButton1ActionPerformed try { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Open a File"); FileNameExtensionFilter docFilter = new FileNameExtensionFilter("Word Files", "docx"); FileNameExtensionFilter pdfFilter = new FileNameExtensionFilter("PDF Documents", "pdf"); chooser.addChoosableFileFilter(docFilter); chooser.addChoosableFileFilter(pdfFilter); int result = chooser.showOpenDialog(null); if (result == 0) { File f = chooser.getSelectedFile(); filename_update = f.getAbsolutePath(); UploadText1.setText(filename_update); f.getAbsoluteFile(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_UploadContractButton1ActionPerformed private void WorkersTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_WorkersTableMouseClicked try { int raw = WorkersTable.getSelectedRow(); tableClick = (WorkersTable.getModel().getValueAt(raw, 0).toString()); String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,birth_date,email,contract_id,job_title from workers where worker_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("first_name"); FirstNameText1.setText(add1); String add2 = rs.getString("last_name"); LastNameText1.setText(add2); String add3 = rs.getString("worker_phone"); PhoneText1.setText(add3); String add4 = rs.getString("worker_add"); AddressText1.setText(add4); String add5 = rs.getString("email"); EmailText1.setText(add5); String add6 = rs.getString("contract_id"); ContractIDText1.setText(add6); String add7 = rs.getString("job_title"); JobTitleText1.setText(add7); Date add8 = rs.getDate("birth_date"); BirthdayDateChooserText1.setDate(add8); } //GEN-LAST:event_WorkersTableMouseClicked } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void RefreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RefreshButtonActionPerformed update_table(); }//GEN-LAST:event_RefreshButtonActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { Desktop.getDesktop().open(new File(filename_update)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_jButton2ActionPerformed private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed int ans = JOptionPane .showConfirmDialog(null, "Are You Sure You Want To Delete " + FirstNameText1.getText() + " " + LastNameText1.getText() + " From The List ?", "Warning!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ans == 0) { int raw = WorkersTable.getSelectedRow(); tableClick = (WorkersTable.getModel().getValueAt(raw, 0).toString()); String sql = "delete from workers where worker_id='" + tableClick + "'"; try { pst = conn.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(null, "Worker Deleted!"); update_table(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } if (ans == 1) { } }//GEN-LAST:event_DeleteButtonActionPerformed private void WorkerIdRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerIdRadioButton1ActionPerformed searchmethod = "worker_id"; }//GEN-LAST:event_WorkerIdRadioButton1ActionPerformed private void WorkerNameRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerNameRadioButton1ActionPerformed searchmethod = "first_name"; searchmethod2 = "last_name"; }//GEN-LAST:event_WorkerNameRadioButton1ActionPerformed private void searchButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButton1ActionPerformed if (searchmethod.equals("worker_id")) { try { String sn = SearchText1.getText(); String sql = "select select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone No',worker_add as 'Address',contract_id as 'Contract ID',job_title as 'Job Title',birth_date as 'Birth Date',email as 'Email' from workers where worker_id='" + sn + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersTable1.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else if (searchmethod.equals("first_name") || searchmethod2.equals("last_name")) { try { String sn = SearchText1.getText(); String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,contract_id,job_title,birth_date,email from workers where first_name='" + sn + "' OR last_name='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersTable1.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }//GEN-LAST:event_searchButton1ActionPerformed private void WorkersTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_WorkersTable1MouseClicked try { int raw = WorkersTable1.getSelectedRow(); tableClick = (WorkersTable1.getModel().getValueAt(raw, 0).toString()); String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,birth_date,email,contract_id,job_title from workers where worker_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("contract_id"); ContractIDText2.setText(add1); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_WorkersTable1MouseClicked private void RefreshButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RefreshButton1ActionPerformed Uptade_search_table(); }//GEN-LAST:event_RefreshButton1ActionPerformed private void Show_Contract_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Show_Contract_ButtonActionPerformed try { int raw = WorkersTable1.getSelectedRow(); tableClick = (WorkersTable1.getModel().getValueAt(raw, 0).toString()); String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,birth_date,email,contract_id,job_title from workers where worker_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("contract_id"); String worker_filename_show_contract = "src/WorkerContracts/" + add1 + ".pdf"; Desktop.getDesktop().open(new File(worker_filename_show_contract)); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "This Worker Does Not Have a Contract", "Attention", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_Show_Contract_ButtonActionPerformed private void CustomerIDTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CustomerIDTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_CustomerIDTextActionPerformed private void CustomerContractIDTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CustomerContractIDTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_CustomerContractIDTextActionPerformed private void AddCustomerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddCustomerButtonActionPerformed int f = 0; int h = 0; try { String sql = "Insert into customers (customer_id,customer_name,address,phone,email,contract_id) values(?,?,?,?,?,?)"; pst = conn.prepareStatement(sql); pst.setString(1, CustomerIDText.getText()); pst.setString(2, CustomerNameText.getText()); pst.setString(3, CustomerAddressText.getText()); pst.setString(4, CustomerPhoneText.getText()); pst.setString(5, CustomerEmailText.getText()); pst.setString(6, CustomerContractIDText.getText()); pst.executeQuery(); JOptionPane.showMessageDialog(null, "Customer Added"); } catch (Exception e) { h = 1; if (CustomerIDText.getText().isEmpty()) { CustomerIDText.setBackground(Color.red); } else { CustomerIDText.setBackground(Color.white); } if (CustomerNameText.getText().isEmpty()) { CustomerNameText.setBackground(Color.red); } else { CustomerNameText.setBackground(Color.white); } if (CustomerAddressText.getText().isEmpty()) { CustomerAddressText.setBackground(Color.red); } else { CustomerAddressText.setBackground(Color.white); } if (CustomerPhoneText.getText().isEmpty()) { CustomerPhoneText.setBackground(Color.red); } else { CustomerPhoneText.setBackground(Color.white); } if (CustomerEmailText.getText().isEmpty()) { CustomerEmailText.setBackground(Color.red); } else { CustomerEmailText.setBackground(Color.white); } if (CustomerContractIDText.getText().isEmpty()) { CustomerContractIDText.setBackground(Color.red); } else { CustomerContractIDText.setBackground(Color.white); } if (f != 2) { JOptionPane.showMessageDialog(null, "The Marked Fields Are Empty", "Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(null, e); } } if (f == 0 && h == 0) { CustomerIDText.setText(""); CustomerNameText.setText(""); CustomerAddressText.setText(""); CustomerPhoneText.setText(""); CustomerEmailText.setText(""); CustomerContractIDText.setText(""); } }//GEN-LAST:event_AddCustomerButtonActionPerformed private void ClearCustomerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearCustomerButtonActionPerformed CustomerIDText.setText(""); CustomerNameText.setText(""); CustomerAddressText.setText(""); CustomerPhoneText.setText(""); CustomerEmailText.setText(""); CustomerContractIDText.setText(""); }//GEN-LAST:event_ClearCustomerButtonActionPerformed private void cusUpdateTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cusUpdateTableMouseClicked try { int raw = cusUpdateTable.getSelectedRow(); tableClick = (cusUpdateTable.getModel().getValueAt(raw, 0).toString()); String sql = "select address,phone,email,contract_id from customers where customer_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("address"); cusUpAddtxt.setText(add1); String add2 = rs.getString("phone"); cusUpPhonetxt.setText(add2); String add3 = rs.getString("email"); cusUpMailtxt.setText(add3); String add4 = rs.getString("contract_id"); cusUpContarcttxt.setText(add4); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_cusUpdateTableMouseClicked private void cusSearchUpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusSearchUpdateButtonActionPerformed if (searchmethod.equals("customer_id")) { try { String sn = cusSearchUpdatetxt.getText(); String sql = "select customer_id as 'Customer ID',customer_name as 'Customer Name',address as 'Address',phone as 'Phone',email 'Email',contract_id as 'Contarct ID' from customers where customer_id='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); cusUpdateTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else { try { String sn = cusSearchUpdatetxt.getText(); String sql = "select customer_id as 'Customer ID',customer_name as 'Customer Name',address as 'Address',phone as 'Phone',email 'Email',contract_id as 'Contarct ID' from customers where customer_name='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); cusUpdateTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }//GEN-LAST:event_cusSearchUpdateButtonActionPerformed private void upCusNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upCusNameRadioButtonActionPerformed searchmethod = "customer_name"; }//GEN-LAST:event_upCusNameRadioButtonActionPerformed private void upcusIDRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upcusIDRadioButtonActionPerformed searchmethod = "customer_id"; }//GEN-LAST:event_upcusIDRadioButtonActionPerformed private void cusUpAddtxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusUpAddtxtActionPerformed // TODO add your handling code here: }//GEN-LAST:event_cusUpAddtxtActionPerformed private void cusUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusUpdateActionPerformed try { String vs = cusUpAddtxt.getText(); String vq = cusUpPhonetxt.getText(); String vm = cusUpMailtxt.getText(); String vds = cusUpContarcttxt.getText(); String sql = "update customers set address='" + vs + "',phone='" + vq + "',email='" + vm + "',contract_id='" + vds + "' where customer_id='" + tableClick + "'"; pst = conn.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(null, "Item Updated"); update_CustomerTable(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } update_CustomerTable(); }//GEN-LAST:event_cusUpdateActionPerformed private void cusRefreshUpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusRefreshUpButtonActionPerformed update_CustomerTable(); }//GEN-LAST:event_cusRefreshUpButtonActionPerformed private void cusDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusDeleteButtonActionPerformed int ans = JOptionPane.showConfirmDialog(null, "Are You Sure You Want To Delete This Customers", "Warning!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ans == 0) { int raw = cusUpdateTable.getSelectedRow(); tableClick = (cusUpdateTable.getModel().getValueAt(raw, 0).toString()); String sql = "delete from customers where customer_id='" + tableClick + "'"; try { pst = conn.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(null, "Customer Deleted!"); update_CustomerTable(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } if (ans == 1) { } }//GEN-LAST:event_cusDeleteButtonActionPerformed private void cusIDRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusIDRadioButtonActionPerformed searchmethod = "customer_id"; }//GEN-LAST:event_cusIDRadioButtonActionPerformed private void cusNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusNameRadioButtonActionPerformed searchmethod = "customer_name"; }//GEN-LAST:event_cusNameRadioButtonActionPerformed private void cusSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusSearchButtonActionPerformed if (searchmethod.equals("customer_id")) { try { String sn = cusSearchtxt.getText(); String sql = "select customer_id as 'Customer ID',customer_name as 'Customer Name',address as 'Address',phone as 'Phone',email 'Email',contract_id as 'Contarct ID' from customers where customer_id='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); cusSearchTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else { try { String sn = cusSearchtxt.getText(); String sql = "select customer_id as 'Customer ID',customer_name as 'Customer Name',adderss as 'Address',phone as 'Phone',email 'Email',contract_id as 'Contarct ID' from customers where customer_name='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); cusSearchTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }//GEN-LAST:event_cusSearchButtonActionPerformed private void cusSearchTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cusSearchTableMouseClicked // TODO add your handling code here: }//GEN-LAST:event_cusSearchTableMouseClicked private void cusRefreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cusRefreshButtonActionPerformed update_Customer_SearchTable(); }//GEN-LAST:event_cusRefreshButtonActionPerformed private void customerTabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_customerTabMouseClicked update_CustomerTable(); update_Customer_SearchTable(); }//GEN-LAST:event_customerTabMouseClicked private void ContractIDText2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContractIDText2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ContractIDText2ActionPerformed private void reportsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reportsButtonActionPerformed reportsTab.setVisible(true); WorkersTab.setVisible(false); customerTab.setVisible(false); usersTab.setVisible(false); }//GEN-LAST:event_reportsButtonActionPerformed private void AddUserTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_AddUserTableMouseClicked try { int raw = AddUserTable.getSelectedRow(); tableClick = (AddUserTable.getModel().getValueAt(raw, 0).toString()); String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,birth_date,email,contract_id,job_title from workers where worker_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("first_name"); UserFirstNameText.setText(add1); String add2 = rs.getString("last_name"); UserLastNameText.setText(add2); String add3 = rs.getString("worker_phone"); UserPhoneText.setText(add3); String add4 = rs.getString("job_title"); UserJobTitleText.setText(add4); String add5 = rs.getString("email"); UserEmailText.setText(add5); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_AddUserTableMouseClicked private void UserFirstNameTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserFirstNameTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserFirstNameTextActionPerformed private void UserLastNameTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserLastNameTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserLastNameTextActionPerformed private void UserPhoneTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserPhoneTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserPhoneTextActionPerformed private void UserJobTitleTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserJobTitleTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserJobTitleTextActionPerformed private void UserEmailTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserEmailTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserEmailTextActionPerformed private void UserAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserAddButtonActionPerformed int ans = JOptionPane.showConfirmDialog(null, "Are You Sure You Want To Give" + UserFirstNameText.getText() + " " + UserLastNameText.getText() + " Selected Permission ?", "Attention", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ans == 0) { try { String sql = "Insert into users (password,user_name,user_type) values(?,?,?)"; pst = conn.prepareStatement(sql); pst.setString(1, UserPasswordText.getText()); pst.setString(2, UserNameText.getText()); pst.setInt(3, UserPermissionChoise.getSelectedIndex()); pst.execute(); JOptionPane.showMessageDialog(null, "User Has Been Given Permission"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } if (ans == 1) { } }//GEN-LAST:event_UserAddButtonActionPerformed private void UserClearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserClearButtonActionPerformed UserFirstNameText.setText(""); UserLastNameText.setText(""); UserPhoneText.setText(""); UserJobTitleText.setText(""); UserEmailText.setText(""); UserNameText.setText(""); UserPasswordText.setText(""); }//GEN-LAST:event_UserClearButtonActionPerformed private void UserNameTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserNameTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserNameTextActionPerformed private void UserPasswordTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserPasswordTextActionPerformed // TODO add your handling code here: }//GEN-LAST:event_UserPasswordTextActionPerformed private void UserPermissionChoiseMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_UserPermissionChoiseMouseClicked // TODO add your handling code here: }//GEN-LAST:event_UserPermissionChoiseMouseClicked private void searchButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButton2ActionPerformed if (searchmethod.equals("worker_id")) { try { String sn = SearchText.getText(); String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone No',worker_add as 'Address',contract_id as 'Contract ID',job_title as 'Job Title',birth_date as 'Birth Date',email as 'Email' from workers where worker_id='" + sn + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); AddUserTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else if (searchmethod.equals("first_name") || searchmethod2.equals("last_name")) { try { String sn = SearchText.getText(); String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone No',worker_add as 'Address',contract_id as 'Contract ID',job_title as 'Job Title',birth_date as 'Birth Date',email as 'Email' from workers where first_name='" + sn + "' OR last_name='" + sn + "'"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); AddUserTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }//GEN-LAST:event_searchButton2ActionPerformed private void WorkerIdRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerIdRadioButton2ActionPerformed searchmethod = "worker_id"; }//GEN-LAST:event_WorkerIdRadioButton2ActionPerformed private void WorkerNameRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_WorkerNameRadioButton2ActionPerformed searchmethod = "first_name"; searchmethod2 = "last_name"; }//GEN-LAST:event_WorkerNameRadioButton2ActionPerformed private void ExistingUserTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ExistingUserTableMouseClicked try { int raw = ExistingUserTable.getSelectedRow(); tableClick = (ExistingUserTable.getModel().getValueAt(raw, 0).toString()); String sql = "select worker_id,first_name,last_name,user_name,password,user_type from users where worker_id='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) { String add1 = rs.getString("first_name"); ExistUserFirstNameText.setText(add1); String add2 = rs.getString("last_name"); ExistUserLastNameText.setText(add2); String add3 = rs.getString("user_name"); ExistUserameText.setText(add3); String add4 = rs.getString("password"); ExistUserPasswordText.setText(add4); String add5 = rs.getString("user_type"); ExistUserPermissionText.setText(add5); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_ExistingUserTableMouseClicked private void usersTabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_usersTabMouseClicked user_update_table(); user_existing_table(); }//GEN-LAST:event_usersTabMouseClicked private void usersButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usersButtonActionPerformed WorkersTab.setVisible(false); customerTab.setVisible(false); reportsTab.setVisible(false); usersTab.setVisible(true); user_update_table(); }//GEN-LAST:event_usersButtonActionPerformed private void updateExistUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateExistUserButtonActionPerformed int ans; try { int raw = ExistingUserTable.getSelectedRow(); tableClick = (ExistingUserTable.getModel().getValueAt(raw, 0).toString()); String un = ExistUserameText.getText(); String up = ExistUserPasswordText.getText(); String ul = perlvlchoice.getSelectedItem(); String sql = "update users set user_name='" + un + "',password='" + up + "',user_type='" + ul + "' where worker_id='" + tableClick + "'"; pst = conn.prepareStatement(sql); ans = JOptionPane.showConfirmDialog(null, "Are You Sure You Want To Update User Details ?", "Attention", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (ans == 0) { pst.execute(); JOptionPane.showMessageDialog(null, "User Details Updated"); } else { } user_existing_table(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } ExistUserFirstNameText.setText(""); ExistUserLastNameText.setText(""); ExistUserameText.setText(""); ExistUserPasswordText.setText(""); ExistUserPermissionText.setText(""); }//GEN-LAST:event_updateExistUserButtonActionPerformed private void orderClearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderClearButtonActionPerformed ExistUserFirstNameText.setText(""); ExistUserLastNameText.setText(""); ExistUserameText.setText(""); ExistUserPasswordText.setText(""); ExistUserPermissionText.setText(""); }//GEN-LAST:event_orderClearButtonActionPerformed private void manageUserButtonLabelMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_manageUserButtonLabelMouseReleased if (openClose == false) { dropManageUserLabel.setVisible(true); changePasswordLabel.setVisible(true); openClose = true; } else { dropManageUserLabel.setVisible(false); changePasswordLabel.setVisible(false); openClose = false; } }//GEN-LAST:event_manageUserButtonLabelMouseReleased private void jLabel2MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseMoved changePasswordLabel.setBorder(null); jLabel3.setBorder(null); }//GEN-LAST:event_jLabel2MouseMoved private void jLabel3MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseMoved jLabel3.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1)); }//GEN-LAST:event_jLabel3MouseMoved private void genRepButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_genRepButton1ActionPerformed Document doc = new Document(); PdfWriter docWriter = null; int repID = ThreadLocalRandom.current().nextInt(10000, 99999 + 1); DecimalFormat df = new DecimalFormat("0.00"); //Date d = Calendar.getInstance().getTime(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Date date = new Date(); String fileName = null; job_title = JobTitleChoice.getSelectedItem(); try { //special font sizes com.itextpdf.text.Font bfBold12 = new com.itextpdf.text.Font( com.itextpdf.text.Font.FontFamily.TIMES_ROMAN, 12, com.itextpdf.text.Font.BOLD, new BaseColor(0, 0, 0)); com.itextpdf.text.Font bf12 = new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.TIMES_ROMAN, 12); //file path String dt = dateFormat.format(date); sFileName = "Report No- " + repID + " Workers Report- " + dt + " Job Title " + job_title + " .pdf"; String path = "src/WorkerReports/" + sFileName; docWriter = PdfWriter.getInstance(doc, new FileOutputStream(path)); DateFormat dateFormat3 = new SimpleDateFormat("dd/MM/yyyy HH:mm"); String d = dateFormat3.format(Calendar.getInstance().getTime()); //document header attributes doc.addCreationDate(); doc.setPageSize(PageSize.LETTER); //open document doc.open(); //create a paragraph com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance("src/Images/logo for pdf.png"); com.itextpdf.text.Font font1 = new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.HELVETICA, 25, com.itextpdf.text.Font.BOLD); Paragraph paragraph = new Paragraph(); Paragraph paragraph2 = new Paragraph("This report was generated by " + loginGUI.username + " at " + d + "\nYou can see Yatzig's workers by the job title you chose"); image.setAlignment(com.itextpdf.text.Image.RIGHT); doc.add(image); //specify column widths float[] columnWidths = { 3f, 3f, 3f, 4f, 3f, 3f, 5f, 3f }; //create PDF table with the given widths PdfPTable table = new PdfPTable(columnWidths); // set table width a percentage of the page width table.setWidthPercentage(100f); //insert column headings insertCell(table, "Worker ID", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "First Name", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "Last Name", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "Phone", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "Address", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "Birth Date", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "Email", Element.ALIGN_CENTER, 1, bfBold12); insertCell(table, "Job Title", Element.ALIGN_CENTER, 1, bfBold12); table.setHeaderRows(1); //insert an empty row /* insertCell(table, "", Element.ALIGN_LEFT, 4, bfBold12);*/ //create section heading by cell merging /* insertCell(table, "New York Orders ...", Element.ALIGN_LEFT, 4, bfBold12);*/ /*double orderTotal, total = 0;*/ String add1, add2, add3, add4, add5, add6, add7, add8; if (job_title.equals("All")) try { String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,birth_date,email,job_title from workers order by job_title "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { add1 = rs.getString("worker_id"); add2 = rs.getString("first_name"); add3 = rs.getString("last_name"); add4 = rs.getString("worker_phone"); add5 = rs.getString("worker_add"); add6 = dateFormat.format(rs.getDate("birth_date")); add7 = rs.getString("email"); add8 = rs.getString("job_title"); insertCell(table, add1, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add2, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add3, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add4, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add5, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add6, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add7, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add8, Element.ALIGN_CENTER, 1, bf12); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } else try { String sql = "select worker_id,first_name,last_name,worker_phone,worker_add,birth_date,email,job_title from workers where job_title='" + job_title + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { add1 = rs.getString("worker_id"); add2 = rs.getString("first_name"); add3 = rs.getString("last_name"); add4 = rs.getString("worker_phone"); add5 = rs.getString("worker_add"); add6 = dateFormat.format(rs.getDate("birth_date")); add7 = rs.getString("email"); add8 = rs.getString("job_title"); insertCell(table, add1, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add2, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add3, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add4, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add5, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add6, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add7, Element.ALIGN_CENTER, 1, bf12); insertCell(table, add8, Element.ALIGN_CENTER, 1, bf12); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } //add the PDF table to the paragraph paragraph2.add(table); // add the paragraph to the document doc.add(new Paragraph("\nWorkers Report " + dt + "\n", font1)); doc.add(paragraph2); } catch (DocumentException dex) { dex.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } finally { if (doc != null) { //close the document doc.close(); JOptionPane.showMessageDialog(null, "Report No " + repID + " Generated!"); } if (docWriter != null) { //close the writer docWriter.close(); } } saveToDB(job_title, date, repID); }//GEN-LAST:event_genRepButton1ActionPerformed private void saveToDB(String s, Date date, int pi) { try { String sql = "Insert into reports (report_no,report_create_date,repProj_start_date,repProj_due_date,repStatus,fileName,reportCategory) values(?,?,?,?,?,?,?)"; pst = conn.prepareStatement(sql); pst.setInt(1, pi); pst.setDate(2, new java.sql.Date(date.getTime())); pst.setDate(3, null); pst.setDate(4, null); pst.setString(5, s); pst.setString(6, sFileName); pst.setString(7, "Workers"); pst.execute(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void Show_report_Button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Show_report_Button1ActionPerformed String filename_show_report = "src/WorkerReports/" + sFileName; try { Desktop.getDesktop().open(new File(filename_show_report)); } catch (Exception e) { JOptionPane.showMessageDialog(null, "The Report Generetad Wasn't Found", "Error", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_Show_report_Button1ActionPerformed private void reportsTabMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reportsTabMouseClicked Workers_rep_Search_Table(); }//GEN-LAST:event_reportsTabMouseClicked private void dropManageUserLabelMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dropManageUserLabelMouseMoved changePasswordLabel.setBorder(null); }//GEN-LAST:event_dropManageUserLabelMouseMoved private void changePasswordLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_changePasswordLabelMouseClicked changePassword cp = new changePassword(); cp.pack(); cp.setLocationRelativeTo(null); cp.setVisible(true); }//GEN-LAST:event_changePasswordLabelMouseClicked private void changePasswordLabelMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_changePasswordLabelMouseMoved changePasswordLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); }//GEN-LAST:event_changePasswordLabelMouseMoved private void WorkersRepHistoryTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_WorkersRepHistoryTableMouseClicked try { int raw = WorkersRepHistoryTable.getSelectedRow(); tableClick = (WorkersRepHistoryTable.getModel().getValueAt(raw, 0).toString()); String sql = "select fileName from reports where report_no='" + tableClick + "' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if (rs.next()) sFileName = rs.getString("fileName"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_WorkersRepHistoryTableMouseClicked private void showRepSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showRepSearchButtonActionPerformed String fn = "src/WorkerReports/" + sFileName; try { Desktop.getDesktop().open(new File(fn)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_showRepSearchButtonActionPerformed private void repSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repSearchButtonActionPerformed if (searchmethod.equals("ID")) { try { String sn = repWorkerIDSearchtxt.getText(); String sql = "select report_no as 'Report ID',report_create_date as 'Creation Date',repStatus as 'Status' from reports where report_no='" + sn + "' and reportCategory = 'Workers' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersRepHistoryTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else if (searchmethod.equals("JobTitle")) { try { String sn = repWorkerJobTitlechoice.getSelectedItem(); String sql = "select report_no as 'Report ID',report_create_date as 'Creation Date',repStatus as 'Status' from reports where repStatus='" + sn + "' and reportCategory = 'Workers' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersRepHistoryTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } else if (searchmethod.equals("Date")) { DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); String sd = dateFormat1.format(repWorkerDateSearchtxt.getDate()); try { String sql = "select report_no,report_create_date,repStatus from reports where repProj_start_date<='" + sd + "' and repProj_due_date>='" + sd + "' and reportCategory = 'Workers' order by report_create_date"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersRepHistoryTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }//GEN-LAST:event_repSearchButtonActionPerformed private void searchWorkerRepIDRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchWorkerRepIDRadioButtonActionPerformed searchmethod = "ID"; repWorkerDateSearchtxt.setVisible(false); repWorkerDateSearchtxt.setEnabled(false); repWorkerIDSearchtxt.setVisible(true); repWorkerIDSearchtxt.setEnabled(true); repWorkerJobTitlechoice.setVisible(false); repWorkerJobTitlechoice.setEnabled(false); this.validate(); }//GEN-LAST:event_searchWorkerRepIDRadioButtonActionPerformed private void searchWorkerRepJobTitleRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchWorkerRepJobTitleRadioButtonActionPerformed searchmethod = "JobTitle"; repWorkerIDSearchtxt.setVisible(false); repWorkerIDSearchtxt.setEnabled(false); repWorkerDateSearchtxt.setVisible(false); repWorkerDateSearchtxt.setEnabled(false); repWorkerJobTitlechoice.setVisible(true); repWorkerJobTitlechoice.setEnabled(true); this.validate(); }//GEN-LAST:event_searchWorkerRepJobTitleRadioButtonActionPerformed private void searchWorkerRepDateRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchWorkerRepDateRadioButtonActionPerformed searchmethod = "Date"; repWorkerIDSearchtxt.setVisible(false); repWorkerIDSearchtxt.setEnabled(false); repWorkerDateSearchtxt.setVisible(true); repWorkerDateSearchtxt.setEnabled(true); repWorkerJobTitlechoice.setVisible(false); repWorkerJobTitlechoice.setEnabled(false); this.validate(); }//GEN-LAST:event_searchWorkerRepDateRadioButtonActionPerformed private void RefreshButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RefreshButton2ActionPerformed Workers_rep_Search_Table(); }//GEN-LAST:event_RefreshButton2ActionPerformed /** * @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(welcome0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(welcome0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(welcome0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(welcome0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new welcome0().setVisible(true); } }); } /** * Retrieves the information from the DB and Display it in the jTable component */ private void update_table() { try { String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone',worker_add as 'Address', birth_date as 'Birthdate', email as 'Email',contract_id as 'Contract ID',job_title as 'Job Title' from workers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void Uptade_search_table() { try { String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone',worker_add as 'Address', birth_date as 'Birthdate', email as 'Email',contract_id as 'Contract ID',job_title as 'Job Title' from workers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersTable1.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void update_Customer_SearchTable() { try { String sql = "select customer_id as 'Customer ID',customer_name as 'Customer Name',address as 'Address',phone as 'Phone',email 'Email',contract_id as 'Contarct ID' from customers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); cusSearchTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void update_CustomerTable() { try { String sql = "select customer_id as 'Customer ID',customer_name as 'Customer Name',address as 'Address',phone as 'Phone',email 'Email',contract_id as 'Contarct ID' from customers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); cusUpdateTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void user_update_table() { try { String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',worker_phone as 'Phone',worker_add as 'Address', birth_date as 'Birthdate', email as 'Email',contract_id as 'Contract ID',job_title as 'Job Title' from workers"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); AddUserTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void user_existing_table() { try { String sql = "select worker_id as 'Worker ID',first_name as 'First Name',last_name as 'Last Name',user_name as 'User Name',password as 'Password', user_type as 'Permission Level' from users"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); ExistingUserTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void Workers_rep_Search_Table() { try { String sql = "select report_no as 'Report ID',report_create_date as 'Creation Date',repStatus as 'Workers Job Title' from reports where reportCategory='Workers' ORDER by report_create_date"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(sql); WorkersRepHistoryTable.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } private void insertCell(PdfPTable table, String text, int align, int colspan, com.itextpdf.text.Font font) { //create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), font)); //set the cell alignment cell.setHorizontalAlignment(align); //set the cell column span in case you want to merge two or more cells cell.setColspan(colspan); //in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } //add the call to the table table.addCell(cell); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton AddButton; private javax.swing.JButton AddCustomerButton; private javax.swing.JPanel AddCustomerPanel; private javax.swing.JPanel AddUserPanel; private javax.swing.JTable AddUserTable; private javax.swing.JPanel AddWorkerPanel; private javax.swing.JLabel AddressLabel; private javax.swing.JLabel AddressLabel1; private javax.swing.JTextField AddressText; private javax.swing.JTextField AddressText1; private javax.swing.JLabel BirthdateLabel; private javax.swing.JLabel BirthdateLabel1; private com.toedter.calendar.JDateChooser BirthdayDateChooserText; private com.toedter.calendar.JDateChooser BirthdayDateChooserText1; private javax.swing.JButton ClearButton; private javax.swing.JButton ClearCustomerButton; private javax.swing.JTextField ContracdIDText; private javax.swing.JLabel ContractIDLabel; private javax.swing.JLabel ContractIDLabel1; private javax.swing.JLabel ContractIDLabel2; private javax.swing.JTextField ContractIDText1; private javax.swing.JTextField ContractIDText2; private javax.swing.JPanel ContractPanel; private javax.swing.JLabel CustomerAddressLabel; private javax.swing.JTextField CustomerAddressText; private javax.swing.JTextField CustomerContractIDText; private javax.swing.JLabel CustomerContractLabel; private javax.swing.JLabel CustomerEmailLabel; private javax.swing.JTextField CustomerEmailText; private javax.swing.JLabel CustomerIDLabel; private javax.swing.JTextField CustomerIDText; private javax.swing.JLabel CustomerNameLabel; private javax.swing.JTextField CustomerNameText; private javax.swing.JLabel CustomerPhoneLabel; private javax.swing.JTextField CustomerPhoneText; private javax.swing.JButton DeleteButton; private javax.swing.JLabel EmailLabel; private javax.swing.JLabel EmailLabel1; private javax.swing.JTextField EmailText; private javax.swing.JTextField EmailText1; private javax.swing.JLabel EnterYourSearchLabel; private javax.swing.JLabel EnterYourSearchLabel1; private javax.swing.JLabel EnterYourSearchLabel2; private javax.swing.JLabel EnterYourSearchLabel3; private javax.swing.JLabel EnterYourSearchLabel4; private javax.swing.JLabel EnterYourSearchLabel5; private javax.swing.JLabel ExistUserFirstNameLabel; private javax.swing.JTextField ExistUserFirstNameText; private javax.swing.JLabel ExistUserLastNameLabel; private javax.swing.JTextField ExistUserLastNameText; private javax.swing.JLabel ExistUserPasswordLabel; private javax.swing.JTextField ExistUserPasswordText; private javax.swing.JLabel ExistUserPermissionLabel; private javax.swing.JTextField ExistUserPermissionText; private javax.swing.JTextField ExistUserameText; private javax.swing.JLabel ExistUsernameLabel; private javax.swing.JPanel ExistingUserPanel; private javax.swing.JTable ExistingUserTable; private javax.swing.JTextField FirstNameText1; private javax.swing.JLabel FirstNamerLabel; private javax.swing.JLabel FirstNamerLabel1; private javax.swing.JTextField FirstNamerText; private java.awt.Choice JobTitleChoice; private javax.swing.JLabel JobTitleChoice1; private javax.swing.JLabel JobTitleLabel; private javax.swing.JLabel JobTitleLabel1; private javax.swing.JTextField JobTitleText; private javax.swing.JTextField JobTitleText1; private javax.swing.JLabel LastNameLabel; private javax.swing.JTextField LastNameText; private javax.swing.JTextField LastNameText1; private javax.swing.JLabel LastNamerLabel1; private javax.swing.JLabel PersonalContractLabel; private javax.swing.JPanel PersonalContractPanel; private javax.swing.JLabel PhoneLabel; private javax.swing.JLabel PhoneLabel1; private javax.swing.JTextField PhoneText; private javax.swing.JTextField PhoneText1; private javax.swing.JButton RefreshButton; private javax.swing.JButton RefreshButton1; private javax.swing.JButton RefreshButton2; private javax.swing.JPanel SearchCustomerPanel; private javax.swing.JPanel SearchPanel; private javax.swing.JTextField SearchText; private javax.swing.JTextField SearchText1; private javax.swing.JTextField SearchText2; private javax.swing.JButton ShowContractButton; private javax.swing.JButton Show_Contract_Button; private javax.swing.JButton Show_report_Button1; private javax.swing.JPanel UpdateDetailsCustomerPanel; private javax.swing.JPanel UpdateDetailsPanel; private javax.swing.JButton UploadContractButton; private javax.swing.JButton UploadContractButton1; private javax.swing.JTextField UploadText; private javax.swing.JTextField UploadText1; private javax.swing.JButton UserAddButton; private javax.swing.JButton UserClearButton; private javax.swing.JLabel UserDetailsLabel; private javax.swing.JLabel UserEmailLabel; private javax.swing.JTextField UserEmailText; private javax.swing.JLabel UserFirstNameLabel; private javax.swing.JTextField UserFirstNameText; private javax.swing.JLabel UserJobTitleLabel; private javax.swing.JTextField UserJobTitleText; private javax.swing.JLabel UserLastNameLabel; private javax.swing.JTextField UserLastNameText; private javax.swing.JLabel UserNameLabel; private javax.swing.JTextField UserNameText; private javax.swing.JLabel UserPasswordLabel; private javax.swing.JTextField UserPasswordText; private java.awt.Choice UserPermissionChoise; private javax.swing.JLabel UserPermissionLabel; private javax.swing.JLabel UserPhoneLabel; private javax.swing.JTextField UserPhoneText; private javax.swing.JLabel WorkerDetailsLabel; private javax.swing.JLabel WorkerDetailsLabel1; private javax.swing.ButtonGroup WorkerHistoryGroup; private javax.swing.JLabel WorkerIDLabel; private javax.swing.JTextField WorkerIDText; private javax.swing.JRadioButton WorkerIdRadioButton; private javax.swing.JRadioButton WorkerIdRadioButton1; private javax.swing.JRadioButton WorkerIdRadioButton2; private javax.swing.JRadioButton WorkerNameRadioButton; private javax.swing.JRadioButton WorkerNameRadioButton1; private javax.swing.JRadioButton WorkerNameRadioButton2; private javax.swing.JPanel WorkersHistoryReportPanel; private javax.swing.JTable WorkersRepHistoryTable; private javax.swing.JPanel WorkersReportPanel; private javax.swing.JTabbedPane WorkersTab; private javax.swing.JTable WorkersTable; private javax.swing.JTable WorkersTable1; private javax.swing.JLabel background_green; private javax.swing.JLabel background_green4; private javax.swing.JLabel background_green5; private javax.swing.JLabel background_green6; private javax.swing.JLabel background_green7; private javax.swing.JLabel background_green8; private javax.swing.JLabel background_green9; private javax.swing.JLabel changePasswordLabel; private javax.swing.JLabel contract_Label1; private javax.swing.JButton cusDeleteButton; private javax.swing.JRadioButton cusIDRadioButton; private javax.swing.JRadioButton cusNameRadioButton; private javax.swing.JButton cusRefreshButton; private javax.swing.JButton cusRefreshUpButton; private javax.swing.JButton cusSearchButton; private javax.swing.JTable cusSearchTable; private javax.swing.JButton cusSearchUpdateButton; private javax.swing.JTextField cusSearchUpdatetxt; private javax.swing.JTextField cusSearchtxt; private javax.swing.JLabel cusUpAddLabel; private javax.swing.JTextField cusUpAddtxt; private javax.swing.JLabel cusUpContarctLabel; private javax.swing.JTextField cusUpContarcttxt; private javax.swing.JLabel cusUpMailLabel; private javax.swing.JTextField cusUpMailtxt; private javax.swing.JLabel cusUpPhoneLabel; private javax.swing.JTextField cusUpPhonetxt; private javax.swing.JButton cusUpdate; private javax.swing.JTable cusUpdateTable; private javax.swing.JTabbedPane customerTab; private javax.swing.JButton customersButton; private javax.swing.JLabel dropManageUserLabel; private javax.swing.JToggleButton genRepButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel43; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel9; private javax.swing.JLayeredPane jLayeredPane1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane19; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane20; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane7; private javax.swing.JScrollPane jScrollPane8; private javax.swing.JSeparator jSeparator1; private javax.swing.JButton logoutButton; private javax.swing.JLabel manageUserButtonLabel; private javax.swing.JButton orderClearButton; private java.awt.Choice perlvlchoice; private javax.swing.JButton repSearchButton; private com.toedter.calendar.JDateChooser repWorkerDateSearchtxt; private javax.swing.JTextField repWorkerIDSearchtxt; private java.awt.Choice repWorkerJobTitlechoice; private javax.swing.JButton reportsButton; private javax.swing.JTabbedPane reportsTab; private javax.swing.JButton searchButton; private javax.swing.JButton searchButton1; private javax.swing.JButton searchButton2; private javax.swing.ButtonGroup searchGroup; private javax.swing.JRadioButton searchWorkerRepDateRadioButton; private javax.swing.JRadioButton searchWorkerRepIDRadioButton; private javax.swing.JRadioButton searchWorkerRepJobTitleRadioButton; private javax.swing.JButton showRepSearchButton; private javax.swing.JRadioButton upCusNameRadioButton; private javax.swing.JRadioButton upcusIDRadioButton; private javax.swing.JButton updateButton; private javax.swing.JButton updateExistUserButton; private javax.swing.JButton usersButton; private javax.swing.JTabbedPane usersTab; private javax.swing.JButton workersButton; // End of variables declaration//GEN-END:variables }