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 Boss; import Rmanager.Boss; import Rmanager.Request; import java.awt.Toolkit; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import static java.lang.Integer.parseInt; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import login.login; import Rmanager.Connection; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.Font; import com.itextpdf.text.FontFactory; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import java.awt.Desktop; import java.io.File; import java.io.FileOutputStream; /** * * @author Reda ben * */ public class BOss extends javax.swing.JFrame { /** * Creates new form BOss */ public BOss() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); listPanel2 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jLabel18 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); listPanel = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); addPanel = new javax.swing.JPanel(); jComboBox1 = new javax.swing.JComboBox(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField1 = new javax.swing.JTextField(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jRadioButton3 = new javax.swing.JRadioButton(); jCheckBox1 = new javax.swing.JCheckBox(); jCheckBox2 = new javax.swing.JCheckBox(); jLabel9 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); editPanel = new javax.swing.JPanel(); jComboBox2 = new javax.swing.JComboBox(); jTextField8 = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); jTextField6 = new javax.swing.JTextField(); jRadioButton4 = new javax.swing.JRadioButton(); jRadioButton5 = new javax.swing.JRadioButton(); jRadioButton6 = new javax.swing.JRadioButton(); jCheckBox3 = new javax.swing.JCheckBox(); jCheckBox4 = new javax.swing.JCheckBox(); jLabel17 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("../logo.png"))); setMinimumSize(new java.awt.Dimension(1000, 600)); setUndecorated(true); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); listPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jScrollPane2.setName(""); // NOI18N jScrollPane2.setVerifyInputWhenFocusTarget(false); jTable2.setBackground(new java.awt.Color(37, 116, 169)); jTable2.setFont(new java.awt.Font("Gadugi", 0, 18)); // NOI18N jTable2.setForeground(new java.awt.Color(255, 255, 255)); jTable2.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 }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { 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[] { "Request ID", "Team", "Validated", "Date" }) { Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean[] { false, false, false, false }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jTable2.setToolTipText(""); jTable2.setFocusable(false); jTable2.setGridColor(new java.awt.Color(28, 92, 134)); jTable2.setName(""); // NOI18N jTable2.setRowHeight(28); jTable2.setRowMargin(3); jTable2.setSelectionForeground(new java.awt.Color(28, 110, 163)); jTable2.getTableHeader().setReorderingAllowed(false); jTable2.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTable2FocusGained(evt); } }); jTable2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTable2MouseClicked(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jTable2MousePressed(evt); } }); jScrollPane2.setViewportView(jTable2); jTable2.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); if (jTable2.getColumnModel().getColumnCount() > 0) { jTable2.getColumnModel().getColumn(0).setResizable(false); jTable2.getColumnModel().getColumn(1).setResizable(false); jTable2.getColumnModel().getColumn(2).setResizable(false); jTable2.getColumnModel().getColumn(3).setResizable(false); } listPanel2.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 880, 330)); jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/deleteButton.png"))); // NOI18N jLabel18.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel18.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel18MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel18MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel18MouseExited(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel18MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel18MouseReleased(evt); } }); listPanel2.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 340, 150, 46)); jLabel20.setBackground(new java.awt.Color(47, 142, 208)); jLabel20.setOpaque(true); listPanel2.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 880, 410)); getContentPane().add(listPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(113, 120, 883, 400)); listPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jScrollPane1.setName(""); // NOI18N jScrollPane1.setVerifyInputWhenFocusTarget(false); jTable1.setBackground(new java.awt.Color(37, 116, 169)); jTable1.setFont(new java.awt.Font("Gadugi", 0, 18)); // NOI18N jTable1.setForeground(new java.awt.Color(255, 255, 255)); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, null, null, null, null }, { null, 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[] { "Request ID", "Team", "Date", "Seen", "Validated" }) { Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } }); jTable1.setToolTipText(""); jTable1.setFocusable(false); jTable1.setGridColor(new java.awt.Color(28, 92, 134)); jTable1.setName(""); // NOI18N jTable1.setRowHeight(28); jTable1.setRowMargin(3); jTable1.setSelectionForeground(new java.awt.Color(28, 110, 163)); jTable1.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(jTable1); jTable1.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); if (jTable1.getColumnModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(0).setResizable(false); jTable1.getColumnModel().getColumn(1).setResizable(false); jTable1.getColumnModel().getColumn(2).setResizable(false); jTable1.getColumnModel().getColumn(4).setResizable(false); } listPanel.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 885, 305)); jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/deleteButton.png"))); // NOI18N jLabel12.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel12.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel12MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel12MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel12MouseExited(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel12MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel12MouseReleased(evt); } }); listPanel.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 320, 150, 46)); jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/edit.png"))); // NOI18N jLabel13.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel13.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel13MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel13MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel13MouseExited(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel13MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel13MouseReleased(evt); } }); listPanel.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 320, 150, 46)); jLabel11.setBackground(new java.awt.Color(47, 142, 208)); jLabel11.setOpaque(true); listPanel.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 880, 410)); getContentPane().add(listPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(113, 120, 883, 400)); addPanel.setOpaque(false); addPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jComboBox1.setBackground(new java.awt.Color(38, 98, 140)); jComboBox1.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jComboBox1.setForeground(new java.awt.Color(38, 98, 140)); addPanel.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 160, 160, 46)); jTextField3.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField3.setText("Address"); jTextField3.setBorder(null); jTextField3.setOpaque(false); jTextField3.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField3MouseDragged(evt); } }); jTextField3.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField3FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField3FocusLost(evt); } }); jTextField3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField3MouseClicked(evt); } }); addPanel.add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 235, 290, 46)); jTextField4.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField4.setText("Address 2"); jTextField4.setBorder(null); jTextField4.setOpaque(false); jTextField4.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField4MouseDragged(evt); } }); jTextField4.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField4FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField4FocusLost(evt); } }); jTextField4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField4MouseClicked(evt); } }); addPanel.add(jTextField4, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 235, 290, 46)); jTextField2.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField2.setText("Phone Number"); jTextField2.setBorder(null); jTextField2.setOpaque(false); jTextField2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField2MouseDragged(evt); } }); jTextField2.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField2FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField2FocusLost(evt); } }); jTextField2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField2MouseClicked(evt); } }); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); addPanel.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 159, 290, 46)); jTextField1.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField1.setText("Client Name"); jTextField1.setBorder(null); jTextField1.setOpaque(false); jTextField1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField1MouseDragged(evt); } }); jTextField1.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField1FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField1FocusLost(evt); } }); jTextField1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField1MouseClicked(evt); } }); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); addPanel.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 90, 290, 46)); buttonGroup1.add(jRadioButton1); jRadioButton1.setOpaque(false); jRadioButton1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jRadioButton1MouseClicked(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jRadioButton1MouseReleased(evt); } }); addPanel.add(jRadioButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 18, -1, -1)); buttonGroup1.add(jRadioButton2); jRadioButton2.setOpaque(false); jRadioButton2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jRadioButton2MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jRadioButton2MouseEntered(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jRadioButton2MouseReleased(evt); } }); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton2ActionPerformed(evt); } }); addPanel.add(jRadioButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 18, -1, -1)); buttonGroup1.add(jRadioButton3); jRadioButton3.setToolTipText(""); jRadioButton3.setOpaque(false); jRadioButton3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jRadioButton3MouseClicked(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jRadioButton3MouseReleased(evt); } }); addPanel.add(jRadioButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 18, -1, -1)); jCheckBox1.setOpaque(false); jCheckBox1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jCheckBox1MouseClicked(evt); } }); addPanel.add(jCheckBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 316, -1, -1)); jCheckBox2.setOpaque(false); jCheckBox2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jCheckBox2MouseClicked(evt); } }); addPanel.add(jCheckBox2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 316, -1, -1)); jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/sendButton.png"))); // NOI18N jLabel9.setToolTipText(""); jLabel9.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel9.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel9MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel9MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel9MouseExited(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel9MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel9MouseReleased(evt); } }); addPanel.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 350, 92, 35)); jLabel14.setFont(new java.awt.Font("Vrinda", 1, 18)); // NOI18N jLabel14.setForeground(new java.awt.Color(255, 0, 51)); addPanel.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 350, 300, 30)); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/addnewPanel.png"))); // NOI18N addPanel.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 870, 400)); jLabel8.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jLabel8MouseDragged(evt); } }); jLabel8.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jLabel8MousePressed(evt); } }); addPanel.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(-240, -20, 1010, 80)); getContentPane().add(addPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 120, 870, 400)); editPanel.setOpaque(false); editPanel.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { editPanelFocusGained(evt); } }); editPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jComboBox2.setBackground(new java.awt.Color(38, 98, 140)); jComboBox2.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jComboBox2.setForeground(new java.awt.Color(38, 98, 140)); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "team 1", "team 2", "team 3", "team 4", "team 1", "team 2", "team 3", "team 4", "team 1", "team 2", "team 3", "team 4", "team 1", "team 2", "team 3", "team 4" })); editPanel.add(jComboBox2, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 160, 160, 46)); jTextField8.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField8.setText("Client Name"); jTextField8.setBorder(null); jTextField8.setOpaque(false); jTextField8.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField8MouseDragged(evt); } }); jTextField8.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField8FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField8FocusLost(evt); } }); jTextField8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField8MouseClicked(evt); } }); jTextField8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField8ActionPerformed(evt); } }); editPanel.add(jTextField8, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 70, 290, 46)); jTextField7.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField7.setText("Phone Number"); jTextField7.setBorder(null); jTextField7.setOpaque(false); jTextField7.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField7MouseDragged(evt); } }); jTextField7.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField7FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField7FocusLost(evt); } }); jTextField7.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField7MouseClicked(evt); } }); jTextField7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField7ActionPerformed(evt); } }); editPanel.add(jTextField7, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 130, 290, 46)); jTextField5.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField5.setText("Address"); jTextField5.setBorder(null); jTextField5.setOpaque(false); jTextField5.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField5MouseDragged(evt); } }); jTextField5.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField5FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField5FocusLost(evt); } }); jTextField5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField5MouseClicked(evt); } }); jTextField5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField5ActionPerformed(evt); } }); editPanel.add(jTextField5, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 188, 290, 46)); jTextField6.setFont(new java.awt.Font("Gadugi", 0, 24)); // NOI18N jTextField6.setText("Address 2"); jTextField6.setToolTipText(""); jTextField6.setBorder(null); jTextField6.setOpaque(false); jTextField6.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jTextField6MouseDragged(evt); } }); jTextField6.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTextField6FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { jTextField6FocusLost(evt); } }); jTextField6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTextField6MouseClicked(evt); } }); jTextField6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField6ActionPerformed(evt); } }); editPanel.add(jTextField6, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 247, 290, 46)); buttonGroup1.add(jRadioButton4); jRadioButton4.setSelected(true); jRadioButton4.setOpaque(false); jRadioButton4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jRadioButton4MouseClicked(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jRadioButton4MouseReleased(evt); } }); editPanel.add(jRadioButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 18, -1, -1)); buttonGroup1.add(jRadioButton5); jRadioButton5.setOpaque(false); jRadioButton5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jRadioButton5MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jRadioButton5MouseEntered(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jRadioButton5MouseReleased(evt); } }); jRadioButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton5ActionPerformed(evt); } }); editPanel.add(jRadioButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 18, -1, -1)); buttonGroup1.add(jRadioButton6); jRadioButton6.setToolTipText(""); jRadioButton6.setOpaque(false); jRadioButton6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jRadioButton6MouseClicked(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jRadioButton6MouseReleased(evt); } }); editPanel.add(jRadioButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 18, -1, -1)); jCheckBox3.setOpaque(false); editPanel.add(jCheckBox3, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 316, -1, -1)); jCheckBox4.setOpaque(false); editPanel.add(jCheckBox4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 316, -1, -1)); jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/edit_Button.png"))); // NOI18N jLabel17.setToolTipText(""); jLabel17.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel17.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel14MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel14MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel14MouseExited(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel14MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel14MouseReleased(evt); } }); editPanel.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 350, 92, 35)); jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/addnewPanel1.png"))); // NOI18N editPanel.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 870, 400)); jLabel16.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jLabel16MouseDragged(evt); } }); jLabel16.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jLabel16MousePressed(evt); } }); editPanel.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(-240, -20, 1010, 80)); getContentPane().add(editPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 120, 870, 400)); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/new.png"))); // NOI18N jLabel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel2MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel2MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel2MouseExited(evt); } }); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 114, -1, -1)); jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/logout.png"))); // NOI18N jLabel3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel3MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel3MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel3MouseExited(evt); } }); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 414, 103, 95)); jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/list.png"))); // NOI18N jLabel4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel4MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel4MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel4MouseExited(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel4MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel4MouseReleased(evt); } }); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 214, 103, 95)); jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/report.png"))); // NOI18N jLabel5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel5MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel5MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel5MouseExited(evt); } }); getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 314, 103, 95)); jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/login/closebutton.png"))); // NOI18N jLabel6.setToolTipText("Close"); jLabel6.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM); jLabel6.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel6MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel6MouseEntered(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { jLabel6MousePressed(evt); } }); getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(940, 10, -1, -1)); jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/login/minbutton.png"))); // NOI18N jLabel7.setToolTipText("Minimize"); jLabel7.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jLabel7.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel7MouseClicked(evt); } }); getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(890, 10, -1, -1)); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/BossBG.jpg"))); // NOI18N jLabel1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel1MouseClicked(evt); } }); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1000, 600)); pack(); }// </editor-fold>//GEN-END:initComponents private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseClicked System.exit(0); }//GEN-LAST:event_jLabel6MouseClicked private void jLabel6MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseEntered }//GEN-LAST:event_jLabel6MouseEntered private void jLabel6MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MousePressed // TODO add your handling code here: }//GEN-LAST:event_jLabel6MousePressed private void jLabel7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel7MouseClicked this.setState(BOss.ICONIFIED); }//GEN-LAST:event_jLabel7MouseClicked private void jLabel8MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MouseDragged this.setLocation((int) evt.getXOnScreen() - x, (int) evt.getYOnScreen() - y); }//GEN-LAST:event_jLabel8MouseDragged int x, y; private void jLabel8MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MousePressed x = evt.getX(); y = evt.getY(); }//GEN-LAST:event_jLabel8MousePressed private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened try { this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 500, Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 300); addPanel.setVisible(false); listPanel.setVisible(false); editPanel.setVisible(false); listPanel2.setVisible(false); boss(); } catch (SQLException | ClassNotFoundException | IOException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_formWindowOpened private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked new login().setVisible(true); this.dispose(); }//GEN-LAST:event_jLabel3MouseClicked private void jLabel2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseEntered jLabel2.setIcon(new ImageIcon(getClass().getResource("newh.png"))); }//GEN-LAST:event_jLabel2MouseEntered private void jLabel2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseExited jLabel2.setIcon(new ImageIcon(getClass().getResource("new.png"))); }//GEN-LAST:event_jLabel2MouseExited private void jLabel4MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseReleased }//GEN-LAST:event_jLabel4MouseReleased private void jLabel4MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MousePressed }//GEN-LAST:event_jLabel4MousePressed private void jLabel5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseEntered jLabel5.setIcon(new ImageIcon(getClass().getResource("reporth.png"))); }//GEN-LAST:event_jLabel5MouseEntered private void jLabel5MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseExited jLabel5.setIcon(new ImageIcon(getClass().getResource("report.png"))); }//GEN-LAST:event_jLabel5MouseExited private void jLabel3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseEntered jLabel3.setIcon(new ImageIcon(getClass().getResource("logouth.png"))); }//GEN-LAST:event_jLabel3MouseEntered private void jLabel3MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseExited jLabel3.setIcon(new ImageIcon(getClass().getResource("logout.png"))); }//GEN-LAST:event_jLabel3MouseExited private void jLabel4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseEntered jLabel4.setIcon(new ImageIcon(getClass().getResource("listh.png"))); }//GEN-LAST:event_jLabel4MouseEntered private void jLabel4MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseExited jLabel4.setIcon(new ImageIcon(getClass().getResource("list.png"))); }//GEN-LAST:event_jLabel4MouseExited private void jRadioButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton2MouseClicked jTextField1.setText("Client Name"); jTextField2.setText("Phone Number"); jTextField3.setText("Address 1"); jTextField4.setText("Address 2"); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/addnewPanel1.png"))); jTextField1.setLocation(290, 70); jTextField2.setLocation(290, 130); jTextField3.setLocation(290, 190); jTextField4.setLocation(290, 247); jRadioButton2.setSelected(true); jRadioButton1.setSelected(false); jRadioButton3.setSelected(false); jTextField4.setVisible(true); }//GEN-LAST:event_jRadioButton2MouseClicked private void jRadioButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton2MouseReleased //clicked = false;clicked1 = false;clicked2 = false;clicked3 = false; }//GEN-LAST:event_jRadioButton2MouseReleased private void jRadioButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton1MouseReleased //clicked = false;clicked1 = false;clicked2 = false;clicked3 = false; }//GEN-LAST:event_jRadioButton1MouseReleased private void jRadioButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton1MouseClicked jTextField1.setText("Client Name"); jTextField2.setText("Phone Number"); jTextField3.setText("Address"); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/addnewPanel.png"))); jTextField1.setLocation(290, 90); jTextField2.setLocation(290, 159); jTextField3.setLocation(290, 235); jTextField4.setLocation(290, 247); jTextField4.setVisible(false); jTextField4.setText("---"); jRadioButton1.setSelected(true); jRadioButton2.setSelected(false); jRadioButton3.setSelected(false); }//GEN-LAST:event_jRadioButton1MouseClicked private void jRadioButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton3MouseClicked jTextField1.setText("Client Name"); jTextField2.setText("Phone Number"); jTextField3.setText("Address"); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/addnewPanel.png"))); jTextField1.setLocation(290, 90); jTextField2.setLocation(290, 159); jTextField3.setLocation(290, 235); jTextField4.setVisible(false); jRadioButton3.setSelected(true); jRadioButton2.setSelected(false); jRadioButton1.setSelected(false); }//GEN-LAST:event_jRadioButton3MouseClicked private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseClicked try { if ((jCheckBox1.isSelected() || jCheckBox2.isSelected())) { int type = 1; String Type = null; if (jRadioButton1.isSelected()) { type = 1; } if (jRadioButton2.isSelected()) { type = 2; } if (jRadioButton3.isSelected()) { type = 3; } if (jRadioButton1.isSelected() || jRadioButton3.isSelected()) { jTextField4.setText("---"); } if (jCheckBox1.isSelected()) { Type = "Wifi"; } if (jCheckBox2.isSelected()) { Type = "Phone Line"; } if (jCheckBox1.isSelected() && jCheckBox2.isSelected()) { Type = "Phone Line and Wifi"; } r.setter("clientTel", jTextField2.getText()); r.setter("address1", jTextField3.getText()); r.setter("address2", jTextField4.getText()); r.setter("clientName", jTextField1.getText()); r.setter("requestType", type + ""); r.setter("requestNet", Type); r.setter("idRequest", getLastId() + 1); r.setter("idBoss", boss.getId()); r.setter("idTeam", jComboBox1.getSelectedIndex() + 1); r.setter("seen", false); r.setter("error", false); r.setter("validated", false); r.setter("seenDate", new Date("1990/01/01")); r.setter("errorDate", new Date("1990/01/01")); r.setter("validatedDate", new Date("1990/01/01")); connect = new Connection(); Statement st = connect.con.createStatement(); Calendar cal = Calendar.getInstance(); String sql = "Insert Into request(IDREQUEST,Net,ID_TYPE,ID_USER,IDTEAM,TELCLIENT,ADDRESS1,ADDRESS2,CLIENTNAME,SEEN,ERROR,FINISHED,SEENDATE,ERRORDATE,FINISHEDDATE,SENDDATE)" + "values ('" + r.intGetter("idRequest") + "','" + Type + "','" + type + "','" + r.intGetter("idBoss") + "','" + r.intGetter("idTeam") + "','" + r.stringGetter("clientTel") + "','" + r.stringGetter("address1") + "','" + r.stringGetter("address2") + "','" + r.stringGetter("clientName") + "'," + "'" + 1 + "','" + 1 + "','" + 1 + "','" + new SimpleDateFormat("yyyy-MM-dd").format(new Date("1901/1/01")) + "','" + new SimpleDateFormat("yyyy-MM-dd").format(new Date("1901/01/01")) + "','" + new SimpleDateFormat("yyyy-MM-dd").format(new Date("1901/01/01")) + "','" + new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()) + "')"; st.executeUpdate(sql); jLabel14.setText(null); } else { jLabel14.setText("Please Select ADSL or Phone Line"); } } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel9MouseClicked private void jLabel9MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseEntered }//GEN-LAST:event_jLabel9MouseEntered private void jLabel9MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseExited // TODO add your handling code here: }//GEN-LAST:event_jLabel9MouseExited private void jLabel9MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MousePressed jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/sendButtonP.png"))); }//GEN-LAST:event_jLabel9MousePressed private void jLabel9MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseReleased jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/sendButton.png"))); }//GEN-LAST:event_jLabel9MouseReleased public void setItems() throws ClassNotFoundException, SQLException { connect = new Connection(); Statement st = connect.con.createStatement(); String sql = "Select * from team"; ResultSet rs = st.executeQuery(sql); while (rs.next()) { jComboBox1.addItem("Team " + rs.getString("idteam")); } } private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked try { addPanel.setVisible(true); listPanel.setVisible(false); editPanel.setVisible(false); listPanel2.setVisible(false); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/addnewPanel.png"))); jTextField1.setLocation(290, 90); jTextField2.setLocation(290, 159); jTextField3.setLocation(290, 235); jTextField4.setLocation(290, 247); jTextField4.setVisible(false); jRadioButton1.setSelected(true); jRadioButton2.setSelected(false); jRadioButton3.setSelected(false); r = new Request(); setItems(); } catch (ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel2MouseClicked private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel4MouseClicked try { addPanel.setVisible(false); listPanel.setVisible(true); editPanel.setVisible(false); listPanel2.setVisible(false); showrecords(); } catch (ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel4MouseClicked private void jLabel12MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseEntered jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/deleteButtonh.png"))); }//GEN-LAST:event_jLabel12MouseEntered private void jLabel12MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseExited jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/deleteButton.png"))); }//GEN-LAST:event_jLabel12MouseExited private void jLabel12MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MousePressed jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/deleteButtonp.png"))); }//GEN-LAST:event_jLabel12MousePressed private void jLabel12MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseReleased jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/deleteButtonh.png"))); }//GEN-LAST:event_jLabel12MouseReleased private void jLabel13MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseEntered jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/edith.png"))); }//GEN-LAST:event_jLabel13MouseEntered private void jLabel13MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseExited jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/edit.png"))); }//GEN-LAST:event_jLabel13MouseExited private void jLabel13MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MousePressed jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/edithP.png"))); }//GEN-LAST:event_jLabel13MousePressed private void jLabel13MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseReleased jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Boss/edith.png"))); }//GEN-LAST:event_jLabel13MouseReleased private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField2MouseClicked private void jTextField4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField4MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField4MouseClicked private void jTextField3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField3MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField3MouseClicked private void jTextField2MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField2MouseDragged private void jTextField3MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField3MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField3MouseDragged private void jTextField4MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField4MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField4MouseDragged private void jRadioButton3MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton3MouseReleased // clicked = false;clicked1 = false;clicked2 = false;clicked3 = false; }//GEN-LAST:event_jRadioButton3MouseReleased private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jTextField1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField1MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField1MouseClicked private void jTextField1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField1MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField1MouseDragged private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton2ActionPerformed /** * ******* * For function placeHolder By Walid Hammioui ********** */ private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost // TODO add your handling code here: String jf1 = jTextField1.getText(); if (jf1.isEmpty()) { jTextField1.setText("Client Name"); } }//GEN-LAST:event_jTextField1FocusLost private void jTextField1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusGained // TODO add your handling code here: if (jTextField1.getText().equalsIgnoreCase("client name")) { jTextField1.setText(null); } }//GEN-LAST:event_jTextField1FocusGained private void jTextField2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField2FocusGained // TODO add your handling code here: if (jTextField2.getText().equalsIgnoreCase("phone number")) { jTextField2.setText(null); } }//GEN-LAST:event_jTextField2FocusGained private void jTextField2FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField2FocusLost // TODO add your handling code here: if (jTextField2.getText().isEmpty()) { jTextField2.setText("Phone Number"); } }//GEN-LAST:event_jTextField2FocusLost private void jTextField3FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField3FocusGained // TODO add your handling code here: if (jTextField3.getText().equalsIgnoreCase("address 1") || jTextField3.getText().equalsIgnoreCase("address")) { jTextField3.setText(null); } }//GEN-LAST:event_jTextField3FocusGained private void jTextField3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField3FocusLost // TODO add your handling code here: if (jTextField3.getText().isEmpty()) { jTextField3.setText("Address"); } }//GEN-LAST:event_jTextField3FocusLost private void jTextField4FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField4FocusGained // TODO add your handling code here: if (jTextField4.getText().equalsIgnoreCase("address 2")) { jTextField4.setText(null); } }//GEN-LAST:event_jTextField4FocusGained private void jTextField4FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField4FocusLost if (jTextField4.getText().isEmpty()) { jTextField4.setText("Address 2"); } }//GEN-LAST:event_jTextField4FocusLost private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jLabel1MouseClicked private void jLabel12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseClicked try { deleteRE(); showrecords(); } catch (SQLException | ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel12MouseClicked String sss; int re; private void jLabel13MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseClicked try { jCheckBox3.setSelected(false); jCheckBox4.setSelected(false); addPanel.setVisible(false); listPanel.setVisible(false); editPanel.setVisible(true); connect = new Connection(); Statement st = connect.con.createStatement(); String sql = "select * from request where IDREQUEST =" + getSelectedrequest(); ResultSet rs = st.executeQuery(sql); rs.next(); re = rs.getInt("idrequest"); switch (rs.getString("Net")) { case "Wifi": jCheckBox3.setSelected(true); break; case "Phone Line": jCheckBox4.setSelected(true); break; default: jCheckBox3.setSelected(true); jCheckBox4.setSelected(true); break; } if (rs.getInt("ID_TYPE") == 1) { jRadioButton4.setSelected(true); jRadioButton5.setSelected(false); jRadioButton6.setSelected(false); jTextField8.setText(rs.getString("CLIENTNAME")); jTextField7.setText(rs.getString("TELCLIENT")); jTextField5.setText(rs.getString("ADDRESS1")); jTextField6.setText(rs.getString("ADDRESS2")); jTextField6.enable(false); } if (rs.getInt("ID_TYPE") == 2) { jRadioButton4.setSelected(false); jRadioButton5.setSelected(true); jRadioButton6.setSelected(false); jTextField8.setText(rs.getString("CLIENTNAME")); jTextField7.setText(rs.getString("TELCLIENT")); jTextField5.setText(rs.getString("ADDRESS1")); jTextField6.setText(rs.getString("ADDRESS2")); jTextField6.enable(true); sss = jTextField6.getText(); } if (rs.getInt("ID_TYPE") == 3) { jRadioButton4.setSelected(false); jRadioButton5.setSelected(false); jRadioButton6.setSelected(true); jTextField8.setText(rs.getString("CLIENTNAME")); jTextField7.setText(rs.getString("TELCLIENT")); jTextField5.setText(rs.getString("ADDRESS1")); jTextField6.setText(rs.getString("ADDRESS2")); jTextField6.enable(false); } } catch (SQLException | ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel13MouseClicked private void jTextField5MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField5MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField5MouseDragged private void jTextField5FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField5FocusGained // TODO add your handling code here: }//GEN-LAST:event_jTextField5FocusGained private void jTextField5FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField5FocusLost // TODO add your handling code here: }//GEN-LAST:event_jTextField5FocusLost private void jTextField5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField5MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField5MouseClicked private void jTextField6MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField6MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField6MouseDragged private void jTextField6FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField6FocusGained // TODO add your handling code here: }//GEN-LAST:event_jTextField6FocusGained private void jTextField6FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField6FocusLost // TODO add your handling code here: }//GEN-LAST:event_jTextField6FocusLost private void jTextField6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField6MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField6MouseClicked private void jTextField7MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField7MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField7MouseDragged private void jTextField7FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField7FocusGained // TODO add your handling code here: }//GEN-LAST:event_jTextField7FocusGained private void jTextField7FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField7FocusLost // TODO add your handling code here: }//GEN-LAST:event_jTextField7FocusLost private void jTextField7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField7MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField7MouseClicked private void jTextField7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField7ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField7ActionPerformed private void jTextField8MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField8MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jTextField8MouseDragged private void jTextField8FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField8FocusGained // TODO add your handling code here: }//GEN-LAST:event_jTextField8FocusGained private void jTextField8FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField8FocusLost // TODO add your handling code here: }//GEN-LAST:event_jTextField8FocusLost private void jTextField8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField8MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextField8MouseClicked private void jTextField8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField8ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField8ActionPerformed private void jLabel14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MouseClicked int type = 1; String Type = null; int team = jComboBox2.getSelectedIndex() + 1; if (jRadioButton4.isSelected()) { type = 1; } if (jRadioButton5.isSelected()) { type = 2; } if (jRadioButton6.isSelected()) { type = 3; } if (jCheckBox3.isSelected()) { Type = "Wifi"; } if (jCheckBox4.isSelected()) { Type = "Phone Line"; } if (jCheckBox3.isSelected() && jCheckBox4.isSelected()) { Type = "Phone Line and Wifi"; } try { connect = new Connection(); Statement st = connect.con.createStatement(); String sql = "UPDATE request SET net='" + Type + "',idteam=" + team + ",id_type=" + type + ",CLIENTNAME ='" + jTextField8.getText() + "',TELCLIENT='" + jTextField7.getText() + "',ADDRESS1='" + jTextField5.getText() + "',ADDRESS2='" + jTextField6.getText() + "' where idrequest = " + re; System.out.println("wa3"); st.executeUpdate(sql); } catch (SQLException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel14MouseClicked private void jLabel14MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jLabel14MouseEntered private void jLabel14MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MouseExited // TODO add your handling code here: }//GEN-LAST:event_jLabel14MouseExited private void jLabel14MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MousePressed jLabel14.setIcon(new ImageIcon(getClass().getResource("/boss/edit_Buttonh.png"))); }//GEN-LAST:event_jLabel14MousePressed private void jLabel14MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MouseReleased jLabel14.setIcon(new ImageIcon(getClass().getResource("/boss/edit_Button.png"))); }//GEN-LAST:event_jLabel14MouseReleased private void jLabel16MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel16MouseDragged // TODO add your handling code here: }//GEN-LAST:event_jLabel16MouseDragged private void jLabel16MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel16MousePressed // TODO add your handling code here: }//GEN-LAST:event_jLabel16MousePressed private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField5ActionPerformed private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField6ActionPerformed private void jRadioButton2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton2MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jRadioButton2MouseEntered private void editPanelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_editPanelFocusGained // TODO add your handling code here: }//GEN-LAST:event_editPanelFocusGained private void jRadioButton4MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton4MouseReleased // TODO add your handling code here: }//GEN-LAST:event_jRadioButton4MouseReleased private void jRadioButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton4MouseClicked jTextField6.enable(false); jTextField6.setText("---"); }//GEN-LAST:event_jRadioButton4MouseClicked private void jRadioButton6MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton6MouseReleased // TODO add your handling code here: }//GEN-LAST:event_jRadioButton6MouseReleased private void jRadioButton6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton6MouseClicked jTextField6.enable(false); jTextField6.setText("---"); }//GEN-LAST:event_jRadioButton6MouseClicked private void jRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton5ActionPerformed private void jRadioButton5MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton5MouseReleased // TODO add your handling code here: }//GEN-LAST:event_jRadioButton5MouseReleased private void jRadioButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton5MouseClicked jTextField6.enable(true); jTextField6.setText(sss); }//GEN-LAST:event_jRadioButton5MouseClicked private void jRadioButton5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadioButton5MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jRadioButton5MouseEntered private void jCheckBox2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jCheckBox2MouseClicked }//GEN-LAST:event_jCheckBox2MouseClicked private void jCheckBox1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jCheckBox1MouseClicked }//GEN-LAST:event_jCheckBox1MouseClicked private void jLabel18MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel18MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jLabel18MouseClicked private void jLabel18MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel18MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jLabel18MouseEntered private void jLabel18MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel18MouseExited // TODO add your handling code here: }//GEN-LAST:event_jLabel18MouseExited private void jLabel18MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel18MousePressed // TODO add your handling code here: }//GEN-LAST:event_jLabel18MousePressed private void jLabel18MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel18MouseReleased // TODO add your handling code here: }//GEN-LAST:event_jLabel18MouseReleased private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked try { addPanel.setVisible(false); listPanel.setVisible(false); editPanel.setVisible(false); listPanel2.setVisible(true); showrecords1(); } catch (ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jLabel5MouseClicked private void jTable2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable2MouseClicked if (evt.getClickCount() == 2) { try { connect = new Connection(); Statement st = connect.con.createStatement(); String SQL = "SELECT * FROM request where idrequest =" + getSelectedrequest1(); ResultSet rq = st.executeQuery(SQL); rq.next(); /*****************************/ String type = ""; if (parseInt(rq.getString("id_type")) == 1) { type = "Instalation"; } if (parseInt(rq.getString("id_type")) == 2) { type = "Transfer"; } if (parseInt(rq.getString("id_type")) == 3) { type = "Maintenamce"; } /**************************/ Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("report.pdf")); document.open(); Paragraph paragraph = new Paragraph(); paragraph.add(new Paragraph("Request : \n", FontFactory.getFont(FontFactory.COURIER_BOLD, 20, Font.BOLD, BaseColor.DARK_GRAY))); paragraph.add("ID Request :"); paragraph.add(rq.getString("idRequest") + ""); paragraph.add("\nRequest type :"); paragraph.add(type); paragraph.add("\nClient name :"); paragraph.add(rq.getString("clientName")); paragraph.add("\nPhone number :"); paragraph.add(rq.getString("TELCLIENT")); paragraph.add("\nAddress 1 :"); paragraph.add(rq.getString("address1")); paragraph.add("\nAddress 2 :"); paragraph.add(rq.getString("address2")); paragraph.add("\nTeam :"); paragraph.add(rq.getString("IDTEAM") + "\n"); /***********************/ String sql = "Select * from report where IDREQUEST = '" + getSelectedrequest1() + "' "; ResultSet rs = st.executeQuery(sql); rs.next(); /**********************/ paragraph.add(new Paragraph("Report : \n", FontFactory.getFont(FontFactory.COURIER_BOLD, 20, Font.BOLD, BaseColor.DARK_GRAY))); paragraph.add(rs.getString("REPORT") + "\n"); Paragraph date = new Paragraph(rs.getString("REPORTDATE").toString().substring(0, 10)); date.setAlignment(Element.ALIGN_RIGHT); Paragraph title = new Paragraph("Report\n", FontFactory.getFont(FontFactory.COURIER_BOLD, 20, Font.BOLD, BaseColor.BLACK)); title.setAlignment(Element.ALIGN_CENTER); document.add(date); document.add(title); document.add(paragraph); document.close(); /* Open Pdf */ Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.OPEN)) { desktop.open(new File("report.pdf")); } else { System.out.println("Open is not supported"); } } catch (SQLException | ClassNotFoundException | DocumentException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } } }//GEN-LAST:event_jTable2MouseClicked /* GET id Request From Table */ private int getSelectedrequest1() { DefaultTableModel model = (DefaultTableModel) jTable2.getModel(); return parseInt((String) jTable2.getValueAt(jTable2.getSelectedRow(), 0)); } private void jTable2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTable2FocusGained // TODO add your handling code here: }//GEN-LAST:event_jTable2FocusGained private void jTable2MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable2MousePressed // TODO add your handling code here: }//GEN-LAST:event_jTable2MousePressed /* ********************************* *************functions********** ********************************* */ // Creating user object public void boss() throws SQLException, ClassNotFoundException, IOException { connect = new Connection(); Statement stmt = connect.con.createStatement(); FileReader fr; try { fr = new FileReader("user.txt"); BufferedReader br = new BufferedReader(fr); int iduser = parseInt(br.readLine()); String SQL = "SELECT * FROM user where ID_USER =" + iduser; ResultSet results = stmt.executeQuery(SQL); results.next(); boss = new Boss(parseInt(results.getString("id_user")), results.getString("name"), results.getString("lastname"), results.getString("nid"), results.getString("position"), results.getString("password")); } catch (FileNotFoundException ex) { System.out.println("file not found"); } } //Get Last id public int getLastId() throws ClassNotFoundException { int idr = 0; try { connect = new Connection(); Statement st = connect.con.createStatement(); String sql = "Select * from request"; ResultSet rs = st.executeQuery(sql); while (rs.next()) { idr = parseInt(rs.getString("idrequest")); } } catch (SQLException ez) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ez); } return idr; } private int getSelectedrequest() { model = (DefaultTableModel) jTable1.getModel(); return parseInt((String) jTable1.getValueAt(jTable1.getSelectedRow(), 0)); } public void deleteRE() throws SQLException { try { connect = new Connection(); Statement st = connect.con.createStatement(); String sql = "delete from request where IDREQUEST =" + getSelectedrequest(); st.execute(sql); } catch (ClassNotFoundException ex) { Logger.getLogger(BOss.class.getName()).log(Level.SEVERE, null, ex); } } public void showrecords() throws ClassNotFoundException { model = (DefaultTableModel) jTable1.getModel(); try { connect = new Connection(); Statement st = connect.con.createStatement(); model.getDataVector().removeAllElements(); revalidate(); String sql = "Select * from request where ID_USER =" + boss.getId() + ""; ResultSet rs = st.executeQuery(sql); while (rs.next()) { String v = ""; String seen = ""; if (rs.getInt("seen") == 1) { seen = "Not yet"; } if (rs.getInt("seen") == 2) { seen = "Yes"; } if (rs.getInt("Finished") == 1) { v = "NOT yet"; } if (rs.getInt("Finished") == 2) { v = "Validated"; } model.addRow(new Object[] { rs.getString("IDREQUEST"), "Team " + rs.getString("IDTEAM"), rs.getString("SENDDATE"), seen, v }); } } catch (SQLException ez) { JOptionPane.showMessageDialog(this, ez.getMessage()); } } //Show records for Report public void showrecords1() throws ClassNotFoundException { model = (DefaultTableModel) jTable2.getModel(); try { connect = new Connection(); Statement st = connect.con.createStatement(); Statement s = connect.con.createStatement(); model.getDataVector().removeAllElements(); revalidate(); String sql = "Select * from request where ID_USER =" + boss.getId() + ""; ResultSet rs = st.executeQuery(sql); while (rs.next()) { sql = "Select * from report where idrequest =" + rs.getInt("idrequest") + ""; ResultSet r = s.executeQuery(sql); if (r.next()) { String v = ""; if (rs.getInt("Finished") == 1) { v = "Error"; } if (rs.getInt("Finished") == 2) { v = "Validated"; } model.addRow(new Object[] { rs.getString("IDREQUEST"), "Team " + rs.getString("IDTEAM"), v, r.getString("REPORTDATE") }); } } } catch (SQLException ez) { JOptionPane.showMessageDialog(this, ez.getMessage()); } } 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 ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(BOss.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(BOss.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(BOss.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(BOss.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new BOss().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel addPanel; private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JPanel editPanel; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JCheckBox jCheckBox3; private javax.swing.JCheckBox jCheckBox4; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JRadioButton jRadioButton3; private javax.swing.JRadioButton jRadioButton4; private javax.swing.JRadioButton jRadioButton5; private javax.swing.JRadioButton jRadioButton6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTable jTable1; private javax.swing.JTable jTable2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; private javax.swing.JPanel listPanel; private javax.swing.JPanel listPanel2; // End of variables declaration//GEN-END:variables //Added Variables public Boss boss; public DefaultTableModel model; public Request r; Connection connect; }