Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 InheritancePackage;
- import java.awt.Color;
- import java.awt.event.KeyEvent;
- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- import javax.swing.JOptionPane;
- import javax.swing.border.LineBorder;
- /**
- *
- * @author Muhammad Faheem
- */
- public class AddEmployee extends javax.swing.JFrame {
- LoginPage LP = new LoginPage();
- EmployeeInfo removedEmployee;
- public static MyHashTable theHT = new MyHashTable(10);
- FTE someFTE;
- PTE somePTE;
- FTE removedFTE;
- PTE removedPTE;
- public String EN;
- public String FN;
- public String LN;
- public String EG;
- public String WL;
- public String DR;
- public String AS;
- public String HW;
- public String HPW;
- public String WPY;
- public String EEA;
- public float NI;
- public float GI;
- boolean found = false;
- public void SaveToFile(){
- String file = LP.fileName;
- try {
- FileWriter fw = new FileWriter(file,true);
- BufferedWriter out = new BufferedWriter(fw);
- if (((String) jComboBox1.getSelectedItem()).equals("Part-Time")){
- out.write(jComboBox1.getSelectedItem().toString().trim()+","+EN+","+EEA+","+FN+","+LN+","+EG+","+WL+","+DR+","+HW+","+HPW+","+WPY+","+GI+","+NI);
- }
- else{
- out.write(jComboBox1.getSelectedItem().toString().trim()+","+EN+","+EEA+","+FN+","+LN+","+EG+","+WL+","+DR+","+"-"+","+"-"+","+"-"+","+AS+","+NI);
- }
- out.newLine();
- out.close();
- }
- catch(IOException e){
- JOptionPane.showMessageDialog(null, e.getMessage());
- }
- }
- public void SearchInFile(String s){
- String fileName = LP.fileName;
- try {
- FileReader reader = new FileReader(fileName);
- BufferedReader br = new BufferedReader(reader);
- String line;
- while ((line = br.readLine()) != null) {
- String[] parts = line.split(",");
- if (parts[1].equals(s)){
- found = true;
- }
- }
- reader.close();
- br.close();
- }
- catch (Exception ex) {
- JOptionPane.showMessageDialog(null,ex.getMessage()); ;
- }
- }
- public AddEmployee() {
- initComponents();
- UsernameLabel.setText((String) LP.fileName);
- this.setOpacity(0.95f);
- if (((String) jComboBox1.getSelectedItem()).equals("Part-Time")) {
- IAS.setVisible(false);
- aS.setVisible(false);
- jSeparator8.setVisible(false);
- }
- }
- /**
- * 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">
- private void initComponents() {
- MenuBar = new javax.swing.JPanel();
- SignOutPanel = new javax.swing.JPanel();
- SignOutLabel = new javax.swing.JLabel();
- EditPanel = new javax.swing.JPanel();
- EditLabel = new javax.swing.JLabel();
- RemovePanel = new javax.swing.JPanel();
- RemoveLabel = new javax.swing.JLabel();
- ViewPanel = new javax.swing.JPanel();
- ViewLabel = new javax.swing.JLabel();
- AddPanel = new javax.swing.JPanel();
- AddLabel = new javax.swing.JLabel();
- MenuPanel = new javax.swing.JPanel();
- MenuLabel = new javax.swing.JLabel();
- jPanel1 = new javax.swing.JPanel();
- ToolPanel = new javax.swing.JPanel();
- ToolLabel = new javax.swing.JLabel();
- jComboBox1 = new javax.swing.JComboBox<>();
- eN = new javax.swing.JLabel();
- IEN = new javax.swing.JFormattedTextField();
- jSeparator2 = new javax.swing.JSeparator();
- fN = new javax.swing.JLabel();
- jSeparator3 = new javax.swing.JSeparator();
- IFN = new javax.swing.JTextField();
- lN = new javax.swing.JLabel();
- jSeparator4 = new javax.swing.JSeparator();
- ILN = new javax.swing.JTextField();
- eG = new javax.swing.JLabel();
- IEG = new javax.swing.JComboBox<>();
- wL = new javax.swing.JLabel();
- jSeparator6 = new javax.swing.JSeparator();
- IWL = new javax.swing.JTextField();
- dR = new javax.swing.JLabel();
- IDR = new javax.swing.JFormattedTextField();
- jSeparator7 = new javax.swing.JSeparator();
- Save = new javax.swing.JPanel();
- jLabel18 = new javax.swing.JLabel();
- SaveLabel = new javax.swing.JLabel();
- aS = new javax.swing.JLabel();
- IAS = new javax.swing.JFormattedTextField();
- jSeparator8 = new javax.swing.JSeparator();
- hW = new javax.swing.JLabel();
- IHW = new javax.swing.JFormattedTextField();
- jSeparator11 = new javax.swing.JSeparator();
- hPW = new javax.swing.JLabel();
- IHPW = new javax.swing.JFormattedTextField();
- jSeparator9 = new javax.swing.JSeparator();
- wPY = new javax.swing.JLabel();
- IWPY = new javax.swing.JFormattedTextField();
- jSeparator10 = new javax.swing.JSeparator();
- eEA = new javax.swing.JLabel();
- IEEA = new javax.swing.JTextField();
- jSeparator5 = new javax.swing.JSeparator();
- jPanel3 = new javax.swing.JPanel();
- jSeparator1 = new javax.swing.JSeparator();
- Find = new javax.swing.JTextField();
- jLabel7 = new javax.swing.JLabel();
- UsernameLabel = new javax.swing.JLabel();
- ExitPanel = new javax.swing.JPanel();
- ExitLabel = new javax.swing.JLabel();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setTitle("Employee Information and Mangement System");
- setMinimumSize(new java.awt.Dimension(640, 757));
- setUndecorated(true);
- getContentPane().setLayout(null);
- MenuBar.setBackground(new java.awt.Color(0, 102, 153));
- MenuBar.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- SignOutPanel.setBackground(new java.awt.Color(0, 102, 153));
- SignOutPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- SignOutPanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- SignOutPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- SignOutPanelMouseExited(evt);
- }
- });
- SignOutPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- SignOutPanel.add(SignOutLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));
- MenuBar.add(SignOutPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 390, 50, 30));
- EditPanel.setBackground(new java.awt.Color(0, 102, 153));
- EditPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- EditPanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- EditPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- EditPanelMouseExited(evt);
- }
- });
- EditPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- EditPanel.add(EditLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));
- MenuBar.add(EditPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 250, 50, 30));
- RemovePanel.setBackground(new java.awt.Color(0, 102, 153));
- RemovePanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- RemovePanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- RemovePanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- RemovePanelMouseExited(evt);
- }
- });
- RemovePanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- RemovePanel.add(RemoveLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));
- MenuBar.add(RemovePanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 180, 50, 30));
- ViewPanel.setBackground(new java.awt.Color(0, 102, 153));
- ViewPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- ViewPanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- ViewPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- ViewPanelMouseExited(evt);
- }
- });
- ViewPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- ViewPanel.add(ViewLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));
- MenuBar.add(ViewPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 320, 50, 30));
- AddPanel.setBackground(new java.awt.Color(0, 102, 153));
- AddPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- AddPanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- AddPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- AddPanelMouseExited(evt);
- }
- });
- AddPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- AddPanel.add(AddLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));
- MenuBar.add(AddPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 110, 50, 30));
- MenuPanel.setBackground(new java.awt.Color(0, 102, 153));
- MenuPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- MenuPanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- MenuPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- MenuPanelMouseExited(evt);
- }
- });
- MenuPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- MenuPanel.add(MenuLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));
- MenuBar.add(MenuPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 50, 30));
- getContentPane().add(MenuBar);
- MenuBar.setBounds(0, 0, 50, 1000);
- jPanel1.setBackground(new java.awt.Color(0, 0, 0));
- jPanel1.setRequestFocusEnabled(false);
- jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- ToolPanel.setBackground(new java.awt.Color(0, 0, 0));
- ToolPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 1, true));
- ToolPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- ToolPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- ToolPanelMouseExited(evt);
- }
- });
- ToolPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- ToolLabel.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
- ToolLabel.setForeground(new java.awt.Color(255, 255, 255));
- ToolLabel.setText("Add Employee to the System");
- ToolPanel.add(ToolLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 10, -1, -1));
- jPanel1.add(ToolPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 560, 50));
- jComboBox1.setBackground(new java.awt.Color(0, 0, 0));
- jComboBox1.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
- jComboBox1.setForeground(new java.awt.Color(255, 153, 0));
- jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Part-Time", "Full-Time" }));
- jComboBox1.setBorder(null);
- jComboBox1.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent evt) {
- jComboBox1ItemStateChanged(evt);
- }
- });
- jComboBox1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jComboBox1ActionPerformed(evt);
- }
- });
- jPanel1.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, 160, -1));
- eN.setBackground(new java.awt.Color(255, 255, 255));
- eN.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- eN.setForeground(new java.awt.Color(51, 52, 54));
- eN.setText("Employee Number");
- jPanel1.add(eN, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, -1, -1));
- IEN.setBackground(new java.awt.Color(0, 0, 0));
- IEN.setBorder(null);
- IEN.setForeground(new java.awt.Color(255, 153, 0));
- IEN.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
- IEN.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IEN.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IENFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IENFocusLost(evt);
- }
- });
- jPanel1.add(IEN, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 170, 560, 20));
- jSeparator2.setMaximumSize(null);
- jSeparator2.setMinimumSize(null);
- jSeparator2.setPreferredSize(null);
- jSeparator2.setRequestFocusEnabled(false);
- jPanel1.add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 190, 560, -1));
- fN.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- fN.setForeground(new java.awt.Color(51, 52, 54));
- fN.setText("First Name");
- jPanel1.add(fN, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, -1, -1));
- jPanel1.add(jSeparator3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 330, 560, -1));
- IFN.setBackground(new java.awt.Color(0, 0, 0));
- IFN.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IFN.setForeground(new java.awt.Color(255, 153, 0));
- IFN.setBorder(null);
- IFN.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IFNFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IFNFocusLost(evt);
- }
- });
- jPanel1.add(IFN, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 310, 560, 20));
- lN.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- lN.setForeground(new java.awt.Color(51, 52, 54));
- lN.setText("Last Name");
- jPanel1.add(lN, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 350, -1, -1));
- jPanel1.add(jSeparator4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 400, 560, -1));
- ILN.setBackground(new java.awt.Color(0, 0, 0));
- ILN.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- ILN.setForeground(new java.awt.Color(255, 153, 0));
- ILN.setBorder(null);
- ILN.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- ILNFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- ILNFocusLost(evt);
- }
- });
- jPanel1.add(ILN, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 380, 560, 20));
- eG.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- eG.setForeground(new java.awt.Color(51, 52, 54));
- eG.setText("Gender");
- jPanel1.add(eG, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 410, -1, -1));
- IEG.setBackground(new java.awt.Color(0, 0, 0));
- IEG.setForeground(new java.awt.Color(255, 153, 0));
- IEG.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Male", "Female", "Other" }));
- IEG.setBorder(null);
- IEG.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IEGFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IEGFocusLost(evt);
- }
- });
- jPanel1.add(IEG, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 430, 560, 40));
- wL.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- wL.setForeground(new java.awt.Color(51, 52, 54));
- wL.setText("Work Location");
- jPanel1.add(wL, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 490, -1, -1));
- jPanel1.add(jSeparator6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 540, 560, -1));
- IWL.setBackground(new java.awt.Color(0, 0, 0));
- IWL.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IWL.setForeground(new java.awt.Color(255, 153, 0));
- IWL.setBorder(null);
- IWL.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IWLFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IWLFocusLost(evt);
- }
- });
- jPanel1.add(IWL, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 520, 560, 20));
- dR.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- dR.setForeground(new java.awt.Color(51, 52, 54));
- dR.setText("Deduction Rate");
- jPanel1.add(dR, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 560, -1, -1));
- IDR.setBackground(new java.awt.Color(0, 0, 0));
- IDR.setBorder(null);
- IDR.setForeground(new java.awt.Color(255, 153, 0));
- IDR.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
- IDR.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IDR.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IDRFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IDRFocusLost(evt);
- }
- });
- jPanel1.add(IDR, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 590, 560, 20));
- jPanel1.add(jSeparator7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 610, 560, -1));
- Save.setBackground(new java.awt.Color(0, 0, 0));
- Save.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 1, true));
- Save.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- SaveMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- SaveMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- SaveMouseExited(evt);
- }
- });
- Save.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/InheritancePackage/Save_1.png"))); // NOI18N
- Save.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));
- SaveLabel.setBackground(new java.awt.Color(255, 255, 255));
- SaveLabel.setFont(new java.awt.Font("Segoe UI Light", 1, 18)); // NOI18N
- SaveLabel.setForeground(new java.awt.Color(255, 255, 255));
- SaveLabel.setText("Save");
- Save.add(SaveLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, 50, -1));
- jPanel1.add(Save, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 70, 60, 80));
- aS.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- aS.setForeground(new java.awt.Color(51, 52, 54));
- aS.setText("Salary");
- jPanel1.add(aS, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 630, -1, -1));
- IAS.setBackground(new java.awt.Color(0, 0, 0));
- IAS.setBorder(null);
- IAS.setForeground(new java.awt.Color(255, 153, 0));
- IAS.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
- IAS.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IAS.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IASFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IASFocusLost(evt);
- }
- });
- jPanel1.add(IAS, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 660, 560, 20));
- jPanel1.add(jSeparator8, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 680, 560, -1));
- hW.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- hW.setForeground(new java.awt.Color(51, 52, 54));
- hW.setText("HourlyWage");
- jPanel1.add(hW, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 630, -1, -1));
- IHW.setBackground(new java.awt.Color(0, 0, 0));
- IHW.setBorder(null);
- IHW.setForeground(new java.awt.Color(255, 153, 0));
- IHW.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
- IHW.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IHW.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IHWFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IHWFocusLost(evt);
- }
- });
- jPanel1.add(IHW, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 660, 160, 20));
- jPanel1.add(jSeparator11, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 680, 160, 10));
- hPW.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- hPW.setForeground(new java.awt.Color(51, 52, 54));
- hPW.setText("Hours Per Week");
- jPanel1.add(hPW, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 630, -1, -1));
- IHPW.setBackground(new java.awt.Color(0, 0, 0));
- IHPW.setBorder(null);
- IHPW.setForeground(new java.awt.Color(255, 153, 0));
- IHPW.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
- IHPW.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IHPW.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IHPWFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IHPWFocusLost(evt);
- }
- });
- jPanel1.add(IHPW, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 660, 160, 20));
- jPanel1.add(jSeparator9, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 680, 160, 10));
- wPY.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- wPY.setForeground(new java.awt.Color(51, 52, 54));
- wPY.setText("Weeks Per Year");
- jPanel1.add(wPY, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 630, -1, -1));
- IWPY.setBackground(new java.awt.Color(0, 0, 0));
- IWPY.setBorder(null);
- IWPY.setForeground(new java.awt.Color(255, 153, 0));
- IWPY.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
- IWPY.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IWPY.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IWPYFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IWPYFocusLost(evt);
- }
- });
- jPanel1.add(IWPY, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 660, 160, 20));
- jPanel1.add(jSeparator10, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 680, 160, 10));
- eEA.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- eEA.setForeground(new java.awt.Color(51, 52, 54));
- eEA.setText("Employee Email Address");
- jPanel1.add(eEA, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 210, -1, -1));
- IEEA.setBackground(new java.awt.Color(0, 0, 0));
- IEEA.setFont(new java.awt.Font("Calibri", 0, 18)); // NOI18N
- IEEA.setForeground(new java.awt.Color(255, 153, 0));
- IEEA.setBorder(null);
- IEEA.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- IEEAFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- IEEAFocusLost(evt);
- }
- });
- jPanel1.add(IEEA, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 240, 560, 20));
- jPanel1.add(jSeparator5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 260, 560, -1));
- getContentPane().add(jPanel1);
- jPanel1.setBounds(50, 50, 600, 720);
- jPanel3.setBackground(new java.awt.Color(255, 255, 255));
- jPanel3.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
- public void mouseDragged(java.awt.event.MouseEvent evt) {
- jPanel3MouseDragged(evt);
- }
- });
- jPanel3.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mousePressed(java.awt.event.MouseEvent evt) {
- jPanel3MousePressed(evt);
- }
- });
- jPanel3.setLayout(null);
- jPanel3.add(jSeparator1);
- jSeparator1.setBounds(100, 40, 210, 10);
- Find.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
- Find.setForeground(new java.awt.Color(255, 153, 0));
- Find.setBorder(null);
- Find.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent evt) {
- FindKeyPressed(evt);
- }
- });
- jPanel3.add(Find);
- Find.setBounds(100, 10, 210, 30);
- jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/InheritancePackage/search.png"))); // NOI18N
- jPanel3.add(jLabel7);
- jLabel7.setBounds(60, 10, 32, 30);
- UsernameLabel.setText("Username");
- jPanel3.add(UsernameLabel);
- UsernameLabel.setBounds(460, 0, 100, 40);
- ExitPanel.setBackground(new java.awt.Color(255, 255, 255));
- ExitPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 1, true));
- ExitPanel.setMaximumSize(new java.awt.Dimension(32, 32));
- ExitPanel.setMinimumSize(new java.awt.Dimension(32, 32));
- ExitPanel.setPreferredSize(new java.awt.Dimension(32, 32));
- ExitPanel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- ExitPanelMouseClicked(evt);
- }
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- ExitPanelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- ExitPanelMouseExited(evt);
- }
- });
- ExitPanel.setLayout(new java.awt.GridLayout(1, 0));
- ExitLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- ExitPanel.add(ExitLabel);
- jPanel3.add(ExitPanel);
- ExitPanel.setBounds(590, 0, 32, 32);
- getContentPane().add(jPanel3);
- jPanel3.setBounds(0, 0, 980, 50);
- pack();
- setLocationRelativeTo(null);
- }// </editor-fold>
- private int xMouse, yMouse;
- private void jPanel3MousePressed(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- xMouse = evt.getX();
- yMouse = evt.getY();
- }
- private void jPanel3MouseDragged(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- int x = evt.getXOnScreen();
- int y= evt.getYOnScreen();
- setLocation(x-xMouse,y-yMouse);
- }
- private void MenuPanelMouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- this.dispose();
- new Menu().setVisible(true);
- }
- private void MenuPanelMouseEntered(java.awt.event.MouseEvent evt) {
- MenuPanel.setBackground(new Color(255,153,0));
- }
- private void MenuPanelMouseExited(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- MenuPanel.setBackground(new Color(0,102,153));
- }
- private void AddPanelMouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- this.dispose();
- new AddEmployee().setVisible(true);
- }
- private void AddPanelMouseEntered(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- AddPanel.setBackground(new Color(255,153,0));
- }
- private void AddPanelMouseExited(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- AddPanel.setBackground(new Color(0,102,153));
- }
- private void RemovePanelMouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- this.dispose();
- new RemoveEmployee().setVisible(true);
- }
- private void RemovePanelMouseEntered(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- RemovePanel.setBackground(new Color(255,153,0));
- }
- private void RemovePanelMouseExited(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- RemovePanel.setBackground(new Color(0,102,153));
- }
- private void EditPanelMouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- this.dispose();
- new EditEmployee().setVisible(true);
- }
- private void EditPanelMouseEntered(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- EditPanel.setBackground(new Color(255,153,0));
- }
- private void EditPanelMouseExited(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- EditPanel.setBackground(new Color(0,102,153));
- }
- private void ViewPanelMouseClicked(java.awt.event.MouseEvent evt) {
- this.dispose();
- new DisplaySystem().setVisible(true);
- }
- private void ViewPanelMouseEntered(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- ViewPanel.setBackground(new Color(255,153,0));
- }
- private void ViewPanelMouseExited(java.awt.event.MouseEvent evt) {
- ViewPanel.setBackground(new Color(0,102,153));
- }
- private void SignOutPanelMouseClicked(java.awt.event.MouseEvent evt) {
- new LoginPage().setVisible(true);
- this.dispose();
- }
- private void SignOutPanelMouseEntered(java.awt.event.MouseEvent evt) {
- SignOutPanel.setBackground(new Color(255,153,0));
- }
- private void SignOutPanelMouseExited(java.awt.event.MouseEvent evt) {
- SignOutPanel.setBackground(new Color(0,102,153));
- }
- private void ToolPanelMouseEntered(java.awt.event.MouseEvent evt) {
- ToolLabel.setForeground(Color.WHITE);
- ToolPanel.setBackground(new Color(255,153,0));
- ToolPanel.setBorder(new LineBorder(new Color(255,153,0),1,true));
- }
- private void ToolPanelMouseExited(java.awt.event.MouseEvent evt) {
- ToolLabel.setForeground(Color.WHITE);
- ToolPanel.setBackground(Color.BLACK);
- ToolPanel.setBorder(new LineBorder(Color.WHITE,1,true));
- }
- private void ExitPanelMouseClicked(java.awt.event.MouseEvent evt) {
- System.exit(0);
- }
- private void ExitPanelMouseEntered(java.awt.event.MouseEvent evt) {
- ExitLabel.setForeground(Color.WHITE);
- ExitPanel.setBackground(new Color(255, 255, 255));
- ExitPanel.setBorder(new LineBorder(new Color(255, 153, 0), 1, true));
- }
- private void ExitPanelMouseExited(java.awt.event.MouseEvent evt) {
- ExitLabel.setForeground(new Color(255, 153, 0));
- ExitPanel.setBackground(new Color(0, 102, 153));
- ExitPanel.setBorder(new LineBorder(Color.WHITE, 0, true));
- }
- private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {
- // TODO add your handling code here:
- if (((String) jComboBox1.getSelectedItem()).equals("Full-Time")){
- IAS.setVisible(true);
- aS.setVisible(true);
- jSeparator8.setVisible(true);
- jSeparator9.setVisible(false);
- jSeparator10.setVisible(false);
- jSeparator11.setVisible(false);
- hPW.setVisible(false);
- hW.setVisible(false);
- wPY.setVisible(false);
- IHW.setText(null);
- IHW.setVisible(false);
- IHPW.setText(null);
- IHPW.setVisible(false);
- IWPY.setText(null);
- IWPY.setVisible(false);
- }
- else{
- IAS.setText(null);
- IAS.setVisible(false);
- aS.setVisible(false);
- jSeparator8.setVisible(false);
- jSeparator9.setVisible(true);
- jSeparator10.setVisible(true);
- jSeparator11.setVisible(true);
- hPW.setVisible(true);
- hW.setVisible(true);
- wPY.setVisible(true);
- IHW.setVisible(true);
- IHPW.setVisible(true);
- IWPY.setVisible(true);
- }
- }
- private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void SaveMouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- SearchInFile(IEN.getText().trim());
- EN = IEN.getText().trim();
- FN = IFN.getText().trim();
- LN = ILN.getText().trim();
- EG = IEG.getSelectedItem().toString().trim();
- WL = IWL.getText().trim();
- DR = IDR.getText().trim();
- AS = IAS.getText().trim();
- HW = IHW.getText().trim();
- HPW = IHPW.getText().trim();
- WPY = IWPY.getText().trim();
- EEA = IEEA.getText().trim();
- if (((String) jComboBox1.getSelectedItem()).equals("Full-Time") && (EEA.isEmpty() || EN.isEmpty() || FN.isEmpty() || LN.isEmpty() || WL.isEmpty() || DR.isEmpty() || AS.isEmpty())) {
- JOptionPane.showMessageDialog(null, "Please Enter All Fields!");
- } else if (((String) jComboBox1.getSelectedItem()).equals("Part-Time") && (EEA.isEmpty() || EN.isEmpty() || FN.isEmpty() || LN.isEmpty() || WL.isEmpty() || DR.isEmpty() || HW.isEmpty() || HPW.isEmpty() || WPY.isEmpty())) {
- JOptionPane.showMessageDialog(null, "Please Enter All Fields!");
- } else if (found == false) {
- if (((String) jComboBox1.getSelectedItem()).equals("Full-Time")) {
- someFTE = new FTE(Integer.parseInt(EN), FN, LN, EG, WL, Double.parseDouble(DR), Double.parseDouble(AS));
- theHT.addToTable(someFTE);
- NI = (Float.parseFloat(AS)*(1-(Float.parseFloat(DR)/100)));
- SaveToFile();
- } else {
- somePTE = new PTE(Integer.parseInt(EN), FN, LN, EG, WL, Double.parseDouble(DR), Double.parseDouble(HW), Double.parseDouble(HPW), Double.parseDouble(WPY));
- NI = (Float.parseFloat(HPW)*Float.parseFloat(WPY)*Float.parseFloat(HW)*(1-(Float.parseFloat(DR)/100)));
- GI = (Float.parseFloat(HPW)*Float.parseFloat(WPY)*Float.parseFloat(HW));
- SaveToFile();
- }
- IAS.setText(null);
- IHW.setText(null);
- IHPW.setText(null);
- IWPY.setText(null);
- IEN.setText(null);
- IDR.setText(null);
- IWL.setText(null);
- IFN.setText(null);
- ILN.setText(null);
- IEEA.setText(null);
- JOptionPane.showMessageDialog(null, "Employee Added 😁!");
- IEN.setText(null);
- } else if (found == true) {
- JOptionPane.showMessageDialog(null, "Employee number already in database!");
- found = false;
- }
- }
- private void SaveMouseEntered(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- SaveLabel.setForeground(Color.WHITE);
- Save.setBackground(new Color(255,153,0));
- Save.setBorder(new LineBorder(new Color(255,153,0),1,true));
- }
- private void SaveMouseExited(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- SaveLabel.setForeground(Color.white);
- Save.setBackground(Color.BLACK);
- Save.setBorder(new LineBorder(Color.WHITE,1,true));
- }
- private void IENFocusGained(java.awt.event.FocusEvent evt) {
- // TODO add your handling code here
- eN.setForeground(new Color(53,113,177));
- }
- private void IENFocusLost(java.awt.event.FocusEvent evt) {
- eN.setForeground(new Color(51,52,54));
- }
- private void IFNFocusGained(java.awt.event.FocusEvent evt) {
- fN.setForeground(new Color(53,113,177));
- }
- private void IFNFocusLost(java.awt.event.FocusEvent evt) {
- fN.setForeground(new Color(51,52,54));
- }
- private void ILNFocusGained(java.awt.event.FocusEvent evt) {
- lN.setForeground(new Color(53,113,177)); }
- private void ILNFocusLost(java.awt.event.FocusEvent evt) {
- lN.setForeground(new Color(51,52,54));
- }
- private void IWLFocusGained(java.awt.event.FocusEvent evt) {
- wL.setForeground(new Color(53,113,177)); }
- private void IWLFocusLost(java.awt.event.FocusEvent evt) {
- wL.setForeground(new Color(51,52,54));
- }
- private void IDRFocusGained(java.awt.event.FocusEvent evt) {
- dR.setForeground(new Color(53,113,177)); }
- private void IDRFocusLost(java.awt.event.FocusEvent evt) {
- dR.setForeground(new Color(51,52,54));
- }
- private void IASFocusGained(java.awt.event.FocusEvent evt) {
- aS.setForeground(new Color(53,113,177)); }
- private void IASFocusLost(java.awt.event.FocusEvent evt) {
- aS.setForeground(new Color(51,52,54));
- }
- private void IHWFocusGained(java.awt.event.FocusEvent evt) {
- hW.setForeground(new Color(53,113,177)); }
- private void IHWFocusLost(java.awt.event.FocusEvent evt) {
- hW.setForeground(new Color(51,52,54));
- }
- private void IHPWFocusGained(java.awt.event.FocusEvent evt) {
- hPW.setForeground(new Color(53,113,177)); }
- private void IHPWFocusLost(java.awt.event.FocusEvent evt) {
- hPW.setForeground(new Color(51,52,54));
- }
- private void IWPYFocusGained(java.awt.event.FocusEvent evt) {
- wPY.setForeground(new Color(53,113,177)); }
- private void IWPYFocusLost(java.awt.event.FocusEvent evt) {
- wPY.setForeground(new Color(51,52,54));
- }
- private void FindKeyPressed(java.awt.event.KeyEvent evt) {
- DisplaySystem DS = new DisplaySystem();
- if (evt.getKeyCode()==KeyEvent.VK_ENTER){
- DS.Search(Find.getText().trim());
- }
- }
- private void IEGFocusGained(java.awt.event.FocusEvent evt) {
- eG.setForeground(new Color(53,113,177)); }
- private void IEGFocusLost(java.awt.event.FocusEvent evt) {
- eG.setForeground(new Color(51,52,54)); }
- private void IEEAFocusGained(java.awt.event.FocusEvent evt) {
- eEA.setForeground(new Color(53,113,177));
- }
- private void IEEAFocusLost(java.awt.event.FocusEvent evt) {
- eEA.setForeground(new Color(51,52,54));
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new AddEmployee().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JLabel AddLabel;
- private javax.swing.JPanel AddPanel;
- private javax.swing.JLabel EditLabel;
- private javax.swing.JPanel EditPanel;
- private javax.swing.JLabel ExitLabel;
- private javax.swing.JPanel ExitPanel;
- private javax.swing.JTextField Find;
- public static javax.swing.JFormattedTextField IAS;
- public static javax.swing.JFormattedTextField IDR;
- public static javax.swing.JTextField IEEA;
- public static javax.swing.JComboBox<String> IEG;
- public static javax.swing.JFormattedTextField IEN;
- public static javax.swing.JTextField IFN;
- public static javax.swing.JFormattedTextField IHPW;
- public static javax.swing.JFormattedTextField IHW;
- public static javax.swing.JTextField ILN;
- public static javax.swing.JTextField IWL;
- public static javax.swing.JFormattedTextField IWPY;
- private javax.swing.JPanel MenuBar;
- private javax.swing.JLabel MenuLabel;
- private javax.swing.JPanel MenuPanel;
- private javax.swing.JLabel RemoveLabel;
- private javax.swing.JPanel RemovePanel;
- private javax.swing.JPanel Save;
- private javax.swing.JLabel SaveLabel;
- private javax.swing.JLabel SignOutLabel;
- private javax.swing.JPanel SignOutPanel;
- private javax.swing.JLabel ToolLabel;
- private javax.swing.JPanel ToolPanel;
- private javax.swing.JLabel UsernameLabel;
- private javax.swing.JLabel ViewLabel;
- private javax.swing.JPanel ViewPanel;
- private javax.swing.JLabel aS;
- private javax.swing.JLabel dR;
- private javax.swing.JLabel eEA;
- private javax.swing.JLabel eG;
- private javax.swing.JLabel eN;
- private javax.swing.JLabel fN;
- private javax.swing.JLabel hPW;
- private javax.swing.JLabel hW;
- public static javax.swing.JComboBox<String> jComboBox1;
- private javax.swing.JLabel jLabel18;
- private javax.swing.JLabel jLabel7;
- private javax.swing.JPanel jPanel1;
- private javax.swing.JPanel jPanel3;
- private javax.swing.JSeparator jSeparator1;
- private javax.swing.JSeparator jSeparator10;
- private javax.swing.JSeparator jSeparator11;
- private javax.swing.JSeparator jSeparator2;
- private javax.swing.JSeparator jSeparator3;
- private javax.swing.JSeparator jSeparator4;
- private javax.swing.JSeparator jSeparator5;
- private javax.swing.JSeparator jSeparator6;
- private javax.swing.JSeparator jSeparator7;
- private javax.swing.JSeparator jSeparator8;
- private javax.swing.JSeparator jSeparator9;
- private javax.swing.JLabel lN;
- private javax.swing.JLabel wL;
- private javax.swing.JLabel wPY;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement